00001 // $Id: spring.hxx,v 1.5 2003/01/02 20:49:23 grumbel Exp $ 00002 // 00003 // Construo - A wire-frame construction game 00004 // Copyright (C) 2002 Ingo Ruhnke <[email protected]> 00005 // 00006 // This program is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU General Public License 00008 // as published by the Free Software Foundation; either version 2 00009 // of the License, or (at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 00020 #ifndef HEADER_CONSTRUO_SPRING_HXX 00021 #define HEADER_CONSTRUO_SPRING_HXX 00022 00023 #include <iostream> 00024 #include <assert.h> 00025 #include "particle.hxx" 00026 #include "world.hxx" 00027 #include "lisp_reader.hxx" 00028 00029 class World; 00030 00031 class Spring 00032 { 00033 public: 00034 std::pair<Particle*, Particle*> particles; 00035 00036 float length; 00037 bool destroyed; 00038 00039 float stiffness; 00040 float damping; 00041 float max_stretch; 00042 00043 Spring (Particle* f, Particle* s, float l); 00044 Spring (Particle* f, Particle* s); 00045 00046 Spring (World* world, lisp_object_t* cursor); 00047 00048 ~Spring (); 00049 00050 void update (float delta); 00051 void draw (ZoomGraphicContext* gc); 00052 void draw_highlight (ZoomGraphicContext* gc); 00053 00055 void recalc_length (); 00056 00057 lisp_object_t* serialize(); 00058 }; 00059 00060 #endif 00061 00062 /* EOF */