pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src config.cxx,1.7,1.8 delta_manager.hxx,


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src config.cxx,1.7,1.8 delta_manager.hxx,1.6,1.7 game_delta.hxx,1.9,1.10 game_time.hxx,1.7,1.8 pingu_action_factory.cxx,1.10,1.11 screen_manager.cxx,1.26,1.27 screen_manager.hxx,1.15,1.16
Date: 27 Nov 2002 20:05:44 -0000

Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv30864/src

Modified Files:
        config.cxx delta_manager.hxx game_delta.hxx game_time.hxx 
        pingu_action_factory.cxx screen_manager.cxx screen_manager.hxx 
Log Message:
- little cleanup here and there
- added level names to the worldmap
- added absolute time to gamedelta


Index: config.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/config.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- config.cxx  8 Nov 2002 01:38:27 -0000       1.7
+++ config.cxx  27 Nov 2002 20:05:42 -0000      1.8
@@ -308,15 +308,15 @@
     {
       fullscreen_enabled = str_to_bool(value);
     }
-  else if (valueid == "tile_size")
+  else if (valueid == "tile-size")
     {
       tile_size = str_to_int(value);
     }
-  else if (valueid == "game_speed")
+  else if (valueid == "game-speed")
     {
       game_speed = str_to_int(value);
     }
-  else if (valueid == "print_fps")
+  else if (valueid == "print-fps")
     {
       print_fps = str_to_bool(value);
     }
@@ -324,27 +324,27 @@
     {
       intro_disabled = !str_to_bool(value);
     }
-  else if (valueid == "fast_mode")
+  else if (valueid == "fast-mode")
     {
       fast_mode = str_to_bool(value);
     }
-  else if (valueid == "maintainer_mode")
+  else if (valueid == "maintainer-mode")
     {
       maintainer_mode = str_to_bool(value);
     }
-  else if (valueid == "unlimited_actions")
+  else if (valueid == "unlimited-actions")
     {
       Cheat::unlimited_actions = str_to_bool(value);
     }
-  else if (valueid == "quick_play")
+  else if (valueid == "quick-play")
     {
       quick_play = str_to_bool(value);
     }
-  else if (valueid == "cursor_enabled")
+  else if (valueid == "cursor-enabled")
     {
       cursor_enabled = str_to_bool(value);
     }
-  else if (valueid == "auto_scrolling")
+  else if (valueid == "auto-scrolling")
     {
       auto_scrolling = str_to_bool(value);
     }
@@ -360,7 +360,7 @@
     {
       screen_height = str_to_int(value);
     }
-  else if (valueid == "preload_data")
+  else if (valueid == "preload-data")
     {
       preload_data = str_to_bool(value);
     }

Index: delta_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/delta_manager.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- delta_manager.hxx   26 Oct 2002 17:31:42 -0000      1.6
+++ delta_manager.hxx   27 Nov 2002 20:05:42 -0000      1.7
@@ -26,10 +26,12 @@
 class DeltaManager
 {
 private:
+  unsigned int absolute_time;
   unsigned int last_time;
 public:
   DeltaManager ()
-    : last_time (CL_System::get_time ())
+    : absolute_time(0),
+      last_time (CL_System::get_time ())
   {}
 
   float getset ()
@@ -42,14 +44,21 @@
   void set () 
   {
     last_time = CL_System::get_time ();
+    absolute_time += last_time;
   }
   
-  float get () 
+  float get () const
   {
     assert (CL_System::get_time () >= last_time);
     return (CL_System::get_time () - last_time) / 1000.0f;
   }
   
+  /** @return time in miliseconds passed since the start of the DeltaManager */
+  unsigned int get_absolute() const
+  {
+    return absolute_time;
+  }
+
 private:
   DeltaManager (const DeltaManager&);
   DeltaManager& operator= (const DeltaManager&);

Index: game_delta.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_delta.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- game_delta.hxx      27 Sep 2002 11:26:43 -0000      1.9
+++ game_delta.hxx      27 Nov 2002 20:05:42 -0000      1.10
@@ -20,8 +20,9 @@
 #ifndef HEADER_PINGUS_GAME_DELTA_HXX
 #define HEADER_PINGUS_GAME_DELTA_HXX
 
-#include "pingus.hxx"
 #include <list>
+#include "pingus.hxx"
+#include "delta_manager.hxx"
 
 namespace Input
 {
@@ -33,7 +34,7 @@
 {
 private:
   /** time delta since the last update */
-  float time_delta;
+  const DeltaManager& time_delta;
     
   /** Reference to the event list from the controller, we must not
       delete the Event* */
@@ -41,11 +42,16 @@
     
 public:
   /** Construct a GameDelta with both time and events */
-  GameDelta (float d,std::list<Input::Event*>& e)
+  GameDelta (const DeltaManager& d,
+             const std::list<Input::Event*>& e)
     : time_delta (d), events (e) {}
 
   /** Return the time that has passed in seconds since the last update() */
-  float get_time () const { return time_delta; }
+  float get_time () const { return time_delta.get(); }
+
+  /** @return the time since the application startup in miliseconds
+      (1/1000 second) */
+  unsigned int get_absolute_time () const { return time_delta.get_absolute(); }
 
   /** Return the events */
   const std::list<Input::Event*>& get_events () const { return events; }

Index: game_time.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_time.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- game_time.hxx       27 Sep 2002 11:26:43 -0000      1.7
+++ game_time.hxx       27 Nov 2002 20:05:42 -0000      1.8
@@ -25,9 +25,7 @@
 /** The GameTime represents the time which passes in the Pingus World.
     Its behaviour is analogue to CL_System::get_time (), but with the
     difference that it only increases if the game runs, if the game is
-    in pause mode, the time will not continue. 
-    
-    FIXME: This should not be a static singletone class */
+    in pause mode, the time will not continue. */
 class GameTime
 {
 private:

Index: pingu_action_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action_factory.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pingu_action_factory.cxx    5 Nov 2002 03:02:48 -0000       1.10
+++ pingu_action_factory.cxx    27 Nov 2002 20:05:42 -0000      1.11
@@ -54,6 +54,9 @@
 
 PinguActionFactory::~PinguActionFactory ()
 {
+  delete_actions ();
+
+  // Delete the action factories
   for (std::map<Actions::ActionName, PinguActionAbstractFactory*>::iterator i 
= factories.begin();
        i != factories.end();
        ++i)

Index: screen_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/screen_manager.cxx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- screen_manager.cxx  5 Nov 2002 03:02:48 -0000       1.26
+++ screen_manager.cxx  27 Nov 2002 20:05:42 -0000      1.27
@@ -48,11 +48,11 @@
   // Main loop for the menu
   while (!screens.empty())
     {
-      float time_delta = delta_manager.getset ();
+      delta_manager.set ();
       
-      if (time_delta > 1.0)
+      if (delta_manager.get() > 1.0)
        {
-         std::cout << "ScreenManager: detected large delta (" << time_delta
+         std::cout << "ScreenManager: detected large delta (" << 
delta_manager.get()
                    << "), ignoring and doing frameskip" << std::endl;
          continue;
        }
@@ -61,10 +61,10 @@
       CL_System::keep_alive ();
 
       // Get new events from ClanLib
-      input_controller.update (time_delta);
+      input_controller.update (delta_manager.get());
 
       // Fill the delta with values
-      GameDelta delta (time_delta, input_controller.get_events ());
+      GameDelta delta (delta_manager, input_controller.get_events ());
 
       last_screen = get_current_screen();
 
@@ -188,6 +188,12 @@
     {
       screens.back ()->on_startup ();
     }
+}
+
+void
+ScreenManager::fade_out()
+{
+  FadeOut::black_rect();
 }
 
 void

Index: screen_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/screen_manager.hxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- screen_manager.hxx  5 Nov 2002 03:02:48 -0000       1.15
+++ screen_manager.hxx  27 Nov 2002 20:05:42 -0000      1.16
@@ -69,6 +69,9 @@
   /** Remove the current screen and fall back to the last one */
   void pop_screen ();
 
+  /** Fade the screen out, this call blocks till the screen is black */
+  void fade_out();
+
 private:
   /** Replace the current screen */
   void real_replace_screen (const ScreenPtr&);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]