pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src input_debug_screen.cxx,NONE,1.1 input


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src input_debug_screen.cxx,NONE,1.1 input_debug_screen.hxx,NONE,1.1 Makefile.am,1.88,1.89 credits.cxx,1.3,1.4 credits.hxx,1.4,1.5 global_event.hxx,1.3,1.4 globals.cxx,1.1,1.2 globals.hxx,1.5,1.6 gui_screen.cxx,1.3,1.4 gui_screen.hxx,1.3,1.4 intro.cxx,1.2,1.3 intro.hxx,1.2,1.3 pingus_menu.cxx,1.5,1.6 pingus_menu_manager.cxx,1.9,1.10 screen_manager.cxx,1.9,1.10 surface_button.cxx,1.8,1.9 xml_helper.cxx,1.11,1.12
Date: 16 Aug 2002 17:15:33 -0000

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

Modified Files:
        Makefile.am credits.cxx credits.hxx global_event.hxx 
        globals.cxx globals.hxx gui_screen.cxx gui_screen.hxx 
        intro.cxx intro.hxx pingus_menu.cxx pingus_menu_manager.cxx 
        screen_manager.cxx surface_button.cxx xml_helper.cxx 
Added Files:
        input_debug_screen.cxx input_debug_screen.hxx 
Log Message:

- added some more input handling to the credits screen
- added a InputDebug screen (only prints out the event type at the moment)
- added draw_foreground/background to gui_screen to make it easier to handle 
non-GUI stuff
- disabled the intro, 'cause its currently not working (100% CPU and no visible 
changes on screen)


--- NEW FILE: input_debug_screen.cxx ---
//  $Id: input_debug_screen.cxx,v 1.1 2002/08/16 17:15:31 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include <iostream>
#include "input/event.hxx"
#include "input_debug_screen.hxx"

InputDebugScreen::InputDebugScreen ()
{
}

InputDebugScreen::~InputDebugScreen ()
{
}

/** Draw this screen */
void
InputDebugScreen::draw ()
{
  std::cout << "InputDebugScreen::draw ()" << std::endl;
}

/** Pass a delta to the screen */
void
InputDebugScreen::update (const GameDelta& delta)
{
  std::cout << "InputDebugScreen::update (" << delta.get_time () << ")" << 
std::endl;
  for (std::list<Input::Event*>::const_iterator i = delta.get_events ().begin 
(); 
       i != delta.get_events ().end ();
       ++i)
    {
      std::cout << "Event: " << (*i)->get_type() << std::endl;
    }
}

/** Called once the screen gets activated and becomes the current
    screen */
void
InputDebugScreen::on_startup ()
{
  std::cout << "InputDebugScreen::on_startup ()" << std::endl;
}

/** Called once the screen gets replaced or poped or shadowed by a
    newly pushed screen */ 
void
InputDebugScreen::on_shutdown ()
{
  std::cout << "InputDebugScreen::on_shutdown ()" << std::endl;
}

/* EOF */

--- NEW FILE: input_debug_screen.hxx ---
//  $Id: input_debug_screen.hxx,v 1.1 2002/08/16 17:15:31 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef HEADER_PINGUS_INPUT_DEBUG_SCREEN_HXX
#define HEADER_PINGUS_INPUT_DEBUG_SCREEN_HXX

#include "pingus.hxx"
#include "screen.hxx"

class InputDebugScreen : public Screen
{
private:
  
public:
  InputDebugScreen ();
  virtual ~InputDebugScreen ();

  /** Draw this screen */
  void draw ();

  /** Pass a delta to the screen */
  void update (const GameDelta& delta);

  /** Called once the screen gets activated and becomes the current
      screen */
  void on_startup ();

  /** Called once the screen gets replaced or poped or shadowed by a
      newly pushed screen */ 
  void on_shutdown ();
};

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Makefile.am,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- Makefile.am 9 Aug 2002 22:02:13 -0000       1.88
+++ Makefile.am 16 Aug 2002 17:15:31 -0000      1.89
@@ -167,6 +167,8 @@
 hurry_up.cxx \
 hurry_up.hxx \
 input_event.hxx \
+input_debug_screen.hxx \
+input_debug_screen.cxx \
 intro.cxx \
 intro.hxx \
 layer_manager.cxx \

Index: credits.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/credits.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- credits.cxx 4 Aug 2002 15:42:23 -0000       1.3
+++ credits.cxx 16 Aug 2002 17:15:31 -0000      1.4
@@ -50,6 +50,7 @@
     {
       is_init = true;
       
+      fast_scrolling = false;
       surface = PingusResource::load_surface("Game/pingubw", "game");
       font = PingusResource::load_font("Fonts/pingus","fonts");
       font_small = PingusResource::load_font("Fonts/pingus_small","fonts");
@@ -109,14 +110,17 @@
 void 
 Credits::update (const GameDelta& delta)
 {
-  offset -= 50.0f * delta.get_time ();
+  if (fast_scrolling)
+    offset -= 250.0f * delta.get_time ();
+  else
+    offset -= 50.0f * delta.get_time ();
 
   if (offset < -1200.0f)
     ScreenManager::instance()->pop_screen ();
 }
 
 void 
-Credits::draw ()
+Credits::draw_background ()
 {
   int x;
   int y;
@@ -174,6 +178,23 @@
     return instance_;
   else
     return instance_ = new Credits ();
+}
+
+void
+Credits::on_pause_press ()
+{
+}
+
+void
+Credits::on_fast_forward_press ()
+{
+  fast_scrolling != fast_scrolling;
+}
+
+void
+Credits::on_escape_press ()
+{
+  ScreenManager::instance ()->pop_screen ();
 }
 
 /* EOF */

Index: credits.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/credits.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- credits.hxx 14 Aug 2002 12:45:02 -0000      1.4
+++ credits.hxx 16 Aug 2002 17:15:31 -0000      1.5
@@ -23,16 +23,17 @@
 #include <string>
 #include <vector>
 #include <ClanLib/Display/Display/surface.h>
-#include "screen.hxx"
+#include "gui_screen.hxx"
 
 class CL_Font;
 class GameDelta;
 
-class Credits : public Screen
+class Credits : public GUIScreen
 {
 private:
   static Credits* instance_;
 
+  bool fast_scrolling;
   CL_Surface surface;
   CL_Font*    font;
   CL_Font*    font_small;
@@ -56,11 +57,15 @@
 
   void init ();
   void update (const GameDelta& delta);
-  void draw ();
+  void draw_background ();
 
   void on_startup ();
 
   static Credits* instance ();
+
+  void on_pause_press ();
+  void on_fast_forward_press ();
+  void on_escape_press ();
 };
 
 #endif

Index: global_event.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/global_event.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- global_event.hxx    16 Aug 2002 13:03:35 -0000      1.3
+++ global_event.hxx    16 Aug 2002 17:15:31 -0000      1.4
@@ -25,23 +25,16 @@
 class CL_Key;
 class CL_InputDevice;
 
-
-///
 class GlobalEvent  
-  //public CL_Event_ButtonPress, 
-  //public CL_Event_ButtonRelease
 {
 private:
   
 public:
-  ///
   virtual void on_button_press(CL_InputDevice *device, const CL_Key &key);
-  ///
   virtual void on_button_release(CL_InputDevice *device, const CL_Key &key);
   
 };
 
-///
 extern GlobalEvent global_event;
 
 #endif

Index: globals.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/globals.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- globals.cxx 12 Jun 2002 19:09:37 -0000      1.1
+++ globals.cxx 16 Aug 2002 17:15:31 -0000      1.2
@@ -52,6 +52,7 @@
 float       frame_skip                      = 1.0f;
 bool        use_opengl                      = false;
 bool        action_help                     = true;
+bool        show_input_debug_screen         = false;
 
 std::string global_username;
 std::string global_email; 

Index: globals.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/globals.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- globals.hxx 16 Aug 2002 13:03:35 -0000      1.5
+++ globals.hxx 16 Aug 2002 17:15:31 -0000      1.6
@@ -62,7 +62,7 @@
 extern float       frame_skip;                      ///< --frame-skip
 extern bool        use_opengl;                      ///< --use-opengl
 extern bool        action_help;                     ///< --action-help
-
+extern bool        show_input_debug_screen;         ///
 
 extern std::string global_username;                 ///< The name of the 
currently logged in user
 extern std::string global_email;                    ///< The email address of 
the currently logged in user

Index: gui_screen.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui_screen.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gui_screen.cxx      3 Aug 2002 09:59:23 -0000       1.3
+++ gui_screen.cxx      16 Aug 2002 17:15:31 -0000      1.4
@@ -38,7 +38,9 @@
 void
 GUIScreen::draw ()
 {
+  draw_background ();
   gui_manager->draw ();
+  draw_foreground ();
 }
 
   /** Pass a delta to the screen */

Index: gui_screen.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui_screen.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gui_screen.hxx      3 Aug 2002 09:59:23 -0000       1.3
+++ gui_screen.hxx      16 Aug 2002 17:15:31 -0000      1.4
@@ -43,6 +43,8 @@
   virtual ~GUIScreen ();
 
   /** Draw this screen */
+  virtual void draw_foreground () {}
+  virtual void draw_background () {}
   virtual void draw ();
 
   /** Pass a delta to the screen */

Index: intro.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/intro.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- intro.cxx   13 Jun 2002 14:25:12 -0000      1.2
+++ intro.cxx   16 Aug 2002 17:15:31 -0000      1.3
@@ -106,12 +106,6 @@
 }
 
 void 
-Intro::on_click ()
-{
-  std::cout << _("Start menu") << std::endl;
-}
-
-void 
 Intro::preload ()
 {
   font = PingusResource::load_font ("Fonts/pingus","fonts");
@@ -129,11 +123,11 @@
 }
 
 
-void 
+/*void 
 Intro::on_button_press (CL_InputDevice* device,const CL_Key& key)
 {
   if (device == CL_Input::keyboards[0] && key.id == CL_KEY_SPACE)
     manager->set_menu (&(manager->mainmenu));
-}
+}*/
 
 /* EOF */

Index: intro.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/intro.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- intro.hxx   24 Jun 2002 22:52:55 -0000      1.2
+++ intro.hxx   16 Aug 2002 17:15:31 -0000      1.3
@@ -48,8 +48,6 @@
   void draw();
   void update (float delta);
   void preload ();
-  void on_click ();
-  void on_button_press (CL_InputDevice* device,const CL_Key& key);
 };
 
 #endif

Index: pingus_menu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_menu.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pingus_menu.cxx     30 Jul 2002 14:57:25 -0000      1.5
+++ pingus_menu.cxx     16 Aug 2002 17:15:31 -0000      1.6
@@ -47,14 +47,8 @@
       pout << "PingusMenu::init ()" << std::endl;
       //event_enabled = true;
       is_init = true;
-         SurfaceButton* editor_button = new EditorButton (this);
- 
-      if (start_editor)
-       {  
-         std::cout << "Editor starting is disabled" << std::endl;
-         //editor_button->on_click ();
-       }
-
+      SurfaceButton* editor_button = new EditorButton (this);
+         
       background = PingusResource::load_surface("misc/logo", "core");
 
       // FIXME: Lilla... memory leak

Index: pingus_menu_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_menu_manager.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- pingus_menu_manager.cxx     4 Aug 2002 15:42:23 -0000       1.9
+++ pingus_menu_manager.cxx     16 Aug 2002 17:15:31 -0000      1.10
@@ -17,6 +17,7 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include <ClanLib/Display/Display/display.h>
 #include <ClanLib/Display/Input/input.h>
 #include <ClanLib/Display/Input/keyboard.h>
 #include "globals.hxx"
@@ -35,10 +36,10 @@
     exitmenu (this)
 {
   //current_menu = 0;
-  if (intro_disabled)
-    push_menu (&mainmenu);
-  else
-    push_menu (&intro); 
+  //if (intro_disabled)
+  push_menu (&mainmenu);
+  //else
+  //push_menu (&intro); 
 }
 
 PingusMenuManager::~PingusMenuManager ()
@@ -49,6 +50,9 @@
 PingusMenuManager::draw ()
 {
   background.draw ();
+  CL_Display::fill_rect(0, CL_Display::get_height () - 22,
+                       CL_Display::get_width (), CL_Display::get_height (),
+                       0, 0, 0, 1.0f);
 
   for (MenuStackIter i = menu_stack.begin (); i != menu_stack.end (); ++i)
     (*i)->draw ();
@@ -60,8 +64,7 @@
   background.update (delta.get_time ());
   // We copy the menu_stack so that we don't invalidate our
   // iterators when menu's are removed/added in update()
-  std::vector<PingusSubMenu *> tmp_menu_stack = menu_stack;
-
+  //std::vector<PingusSubMenu *> tmp_menu_stack = menu_stack;
   /*for (MenuStackIter i = tmp_menu_stack.begin (); i != tmp_menu_stack.end 
(); ++i)
     (*i)->update (delta);*/
   menu_stack.back ()->update (delta);

Index: screen_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/screen_manager.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- screen_manager.cxx  13 Aug 2002 18:44:50 -0000      1.9
+++ screen_manager.cxx  16 Aug 2002 17:15:31 -0000      1.10
@@ -18,6 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <iostream>
+#include "globals.hxx"
 #include "input/controller.hxx"
 #include "delta_manager.hxx"
 #include "game_delta.hxx"
@@ -26,6 +27,7 @@
 #include "pingus_menu_manager.hxx"
 #include "screen_manager.hxx"
 #include "path_manager.hxx"
+#include "input_debug_screen.hxx"
 
 ScreenManager* ScreenManager::instance_ = 0;
 
@@ -37,7 +39,10 @@
   cached_action = none;
 
   // Set the root screen
-  push_screen (PingusMenuManager::instance (), false);
+  if (!show_input_debug_screen)
+    push_screen (PingusMenuManager::instance (), false);
+  else
+    push_screen (new InputDebugScreen (), true);
 }
 
 ScreenManager::~ScreenManager ()

Index: surface_button.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/surface_button.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- surface_button.cxx  14 Aug 2002 12:45:02 -0000      1.8
+++ surface_button.cxx  16 Aug 2002 17:15:31 -0000      1.9
@@ -122,12 +122,13 @@
 {
   mouse_over = true;
   PingusSound::play_sound ("sounds/chain.wav", 0.1f);
+  //std::cout << "X: " << this << "enter" << std::endl;
 }
 
 void
 SurfaceButton::on_pointer_leave ()
 {
-  std::cout << "X: " << this << "leave" << std::endl;
+  //std::cout << "X: " << this << "leave" << std::endl;
   mouse_over = false;
 }
 

Index: xml_helper.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/xml_helper.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- xml_helper.cxx      16 Aug 2002 13:02:06 -0000      1.11
+++ xml_helper.cxx      16 Aug 2002 17:15:31 -0000      1.12
@@ -26,6 +26,7 @@
 
 // Hack: if xmlIsBlankNode() is not present, we define an empty dummy
 #ifdef NO_XMLISBLANKNODE
+#error "int xmlIsBlankNode(xmlNodePtr node) missing from libxml"
 int xmlIsBlankNode(xmlNodePtr node) { return 0; }
 #endif
 





reply via email to

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