pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.23,1.24 button_pan


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.23,1.24 button_panel.hxx,1.16,1.17 pingus_main.cxx,1.56,1.57 result_screen.cxx,1.5,1.6 result_screen.hxx,1.2,1.3 start_screen.cxx,1.3,1.4 start_screen.hxx,1.1,1.2stat_manager.cxx,1.4,1.5
Date: 30 Mar 2003 13:12:37 -0000

Update of /var/lib/cvs/Games/Pingus/src
In directory dark:/tmp/cvs-serv7109/src

Modified Files:
        button_panel.cxx button_panel.hxx pingus_main.cxx 
        result_screen.cxx result_screen.hxx start_screen.cxx 
        start_screen.hxx stat_manager.cxx 
Log Message:
- show editor help screen at startup, but only for the first time
- added solid-tutorial level
- added descriptions for all levels
- removed some more useless std::cout's
- added scrollwheel support, doesn't use the input/ stuff, since it was
  easier this way
- added some keyboard shortcuts for result/start screen
- added clanlib patches

Index: button_panel.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/button_panel.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- button_panel.cxx    29 Dec 2002 23:29:00 -0000      1.23
+++ button_panel.cxx    30 Mar 2003 13:12:35 -0000      1.24
@@ -17,6 +17,8 @@
 //  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/Input/mouse.h>
+#include <iostream>
 #include <algorithm>
 #include "globals.hxx"
 #include "button_panel.hxx"
@@ -62,6 +64,20 @@
     }
 
   pressed_button = 0;
+  wheel_slot = CL_Mouse::sig_button_press().connect(this, 
&ButtonPanel::on_wheel_move);
+}
+
+void
+ButtonPanel::on_wheel_move(const CL_Key& key)
+{
+  if (key.id == CL_MOUSE_WHEELDOWN)
+    {
+      next_action();
+    }
+  else if (key.id == CL_MOUSE_WHEELUP)
+    {
+      previous_action();
+    }
 }
 
 ButtonPanel::~ButtonPanel()

Index: button_panel.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/button_panel.hxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- button_panel.hxx    1 Dec 2002 17:45:22 -0000       1.16
+++ button_panel.hxx    30 Mar 2003 13:12:35 -0000      1.17
@@ -47,6 +47,9 @@
   static CL_Surface button_cap;
 
   int x_pos, y_pos;
+
+  CL_Slot wheel_slot;
+  void on_wheel_move(const CL_Key& key);
 public:
   ButtonPanel(Client* c, int arg_x_pos, int arg_y_pos);
   virtual ~ButtonPanel();

Index: pingus_main.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/pingus_main.cxx,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- pingus_main.cxx     28 Mar 2003 23:54:14 -0000      1.56
+++ pingus_main.cxx     30 Mar 2003 13:12:35 -0000      1.57
@@ -274,14 +274,11 @@
       break;
     case 't': // -t, --set-speed
       game_speed = atoi(optarg);
-      if (verbose) 
-       std::cout << "PingusMain:check_args: Game Speed = "
-                 << game_speed << std::endl;
       break;
     case 'e':
       start_editor = true;
       intro_disabled = true;
-      std::cout << "PingusMain: Starting Editor" << std::endl;
+      //std::cout << "PingusMain: Starting Editor" << std::endl;
       break;
     case 'q':
       quick_play = true;
@@ -636,7 +633,8 @@
     }
   else
     {
-      std::cout << "setlocale returned '" << ret << "'" << std::endl;
+      if (maintainer_mode)
+        std::cout << "setlocale returned '" << ret << "'" << std::endl;
     }
   bindtextdomain (PACKAGE, (path_manager.get_base_path () + 
"/../../locale/").c_str());
   // We use another LOCALEDIR to make static binaries possible
@@ -649,8 +647,11 @@
 void
 PingusMain::print_greeting_message()
 {
-  std::cout << "Welcome to Pingus "VERSION"!\n"
-            << "=======================\n" << std::endl;
+  std::string greeting = "Welcome to Pingus "VERSION"!";
+  std::cout <<  greeting << std::endl;
+  for (int i = 0; i < greeting.length(); ++i)
+    std::cout.put('=');
+  std::cout << std::endl;
   
 #ifdef HAVE_LIBCLANVORBIS
   std::cout << "clanVorbis support: ok" << std::endl;

Index: result_screen.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/result_screen.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- result_screen.cxx   28 Mar 2003 16:16:00 -0000      1.5
+++ result_screen.cxx   30 Mar 2003 13:12:35 -0000      1.6
@@ -47,17 +47,20 @@
 class ResultScreenOkButton 
   : public GUI::SurfaceButton
 {
+private:
+  ResultScreen* parent;
 public:
-  ResultScreenOkButton()
+  ResultScreenOkButton(ResultScreen* p)
     : GUI::SurfaceButton(100, 500, 
                          ResDescriptor("result/ok", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("result/ok", "core", 
ResDescriptor::RD_RESOURCE),
-                         ResDescriptor("result/ok", "core", 
ResDescriptor::RD_RESOURCE))
+                         ResDescriptor("result/ok", "core", 
ResDescriptor::RD_RESOURCE)),
+      parent(p)
   {
   }
 
   void on_click() {
-    ScreenManager::instance()->pop_screen();    
+    parent->close_screen();
   }
 };
 
@@ -65,9 +68,9 @@
   : public GUI::SurfaceButton
 {
 private:
-  ResultScreenComponent* parent;
+  ResultScreen* parent;
 public:
-  ResultScreenRetryButton(ResultScreenComponent* p)
+  ResultScreenRetryButton(ResultScreen* p)
     : GUI::SurfaceButton(500, 500, 
                          ResDescriptor("result/retry", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("result/retry", "core", 
ResDescriptor::RD_RESOURCE),
@@ -78,8 +81,7 @@
 
   void on_click() 
   {
-    ScreenManager::instance()->replace_screen(new PingusGameSession 
(parent->result.plf, false),
-                                              true);
+    parent->retry_level();
   }
 };
 
@@ -122,9 +124,17 @@
     gc.print_left(Fonts::chalk_small, 250, 370, to_string(result.max_time - 
result.used_time));
 
   if (result.success())
-    gc.print_center(Fonts::chalk_large, gc.get_width()/2, 450, "Success! 
=:-)");
+    {
+      gc.print_center(Fonts::chalk_large, gc.get_width()/2, 450, "Success! 
=:-)");
+      gc.print_center(Fonts::pingus_small, gc.get_width()/2, 
gc.get_height()-30,
+                      "..:: Press Space to continue ::..");
+    }
   else
-    gc.print_center(Fonts::chalk_large, gc.get_width()/2, 450, "Failure! :-(");
+    {
+      gc.print_center(Fonts::chalk_large, gc.get_width()/2, 450, "Failure! 
:-(");
+      gc.print_center(Fonts::pingus_small, gc.get_width()/2, 
gc.get_height()-30,
+                      "..:: Press Space to retry the level ::..");
+    }
 }
 
 ResultScreen::ResultScreen(Result arg_result)
@@ -135,8 +145,8 @@
 
   ResultScreenComponent* comp = new ResultScreenComponent(result);
   gui_manager->add(comp);
-  gui_manager->add(new ResultScreenOkButton());
-  gui_manager->add(new ResultScreenRetryButton(comp));
+  gui_manager->add(new ResultScreenOkButton(this));
+  gui_manager->add(new ResultScreenRetryButton(this));
   //gui_manager->add(new GUI::SurfaceButton(500, 500, cancel_desc, 
cancel_desc, cancel_desc));
 }
 
@@ -151,6 +161,40 @@
     {
       PingusSound::play_music("pingus-2.it");
     }
+}
+
+void
+ResultScreen::retry_level()
+{
+  ScreenManager::instance()->replace_screen(new PingusGameSession (result.plf, 
false),
+                                            true);
+}
+
+void
+ResultScreen::close_screen()
+{
+  ScreenManager::instance()->pop_screen();  
+}
+
+void 
+ResultScreen::on_fast_forward_press()
+{
+  on_pause_press();
+}
+
+void
+ResultScreen::on_pause_press()
+{
+  if (result.success())
+    close_screen();
+  else
+    retry_level();
+}
+
+void
+ResultScreen::on_escape_press()
+{
+  close_screen();
 }
 
 /* EOF */

Index: result_screen.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/result_screen.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- result_screen.hxx   28 Mar 2003 16:16:00 -0000      1.2
+++ result_screen.hxx   30 Mar 2003 13:12:35 -0000      1.3
@@ -32,6 +32,12 @@
   ResultScreen(Result result);
   void on_startup();
 
+  void on_pause_press();
+  void on_fast_forward_press();
+  void on_escape_press();
+
+  void retry_level();
+  void close_screen();
 private:
   ResultScreen (const ResultScreen&);
   ResultScreen& operator= (const ResultScreen&);

Index: start_screen.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/start_screen.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- start_screen.cxx    28 Mar 2003 16:16:00 -0000      1.3
+++ start_screen.cxx    30 Mar 2003 13:12:35 -0000      1.4
@@ -46,31 +46,23 @@
 class StartScreenOkButton : public GUI::SurfaceButton
 {
 private:
-  PLFHandle plf;
+  StartScreen* parent;
 public:
-  StartScreenOkButton(PLFHandle p)
+  StartScreenOkButton(StartScreen* p)
     : GUI::SurfaceButton(300, 500, 
                          ResDescriptor("result/ok", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("result/ok", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("result/ok", "core", 
ResDescriptor::RD_RESOURCE)),
-      plf(p)
+      parent(p)
   {
   }
 
   void on_click() 
   {
-    PingusGameSession* game_session = new PingusGameSession(plf, true);
-    ScreenManager::instance()->replace_screen(game_session, true);
+    parent->start_game();
   }
 };
 
-StartScreen::StartScreen(PLFHandle plf)
-{
-  StartScreenComponent* comp = new StartScreenComponent(plf);
-  gui_manager->add(comp);
-  gui_manager->add(new StartScreenOkButton(plf));
-}
-
 StartScreen::~StartScreen()
 {
   
@@ -88,13 +80,20 @@
   //gc.clear(0,0,0);
   background.put_screen(0,0);
   gc.print_center(Fonts::chalk_large, gc.get_width()/2, 100, 
System::translate(plf->get_levelname()));
-  gc.print_center(Fonts::chalk_normal, gc.get_width()/2, 160, 
System::translate(plf->get_description()));
+  gc.print_left(Fonts::chalk_normal, 130, 160, 
System::translate(plf->get_description()));
 
-  gc.print_left(Fonts::chalk_normal, 250, 250, _("Number of Pingus: ") + 
to_string(plf->get_pingus()));
-  gc.print_left(Fonts::chalk_normal, 250, 280, _("Number to Save: ") + 
to_string(plf->get_number_to_save()));
-  gc.print_left(Fonts::chalk_normal, 250, 310, _("Time: ") + 
to_string(plf->get_time()));
+  gc.print_left (Fonts::chalk_normal, 300, 290, _("Number of Pingus: "));
+  gc.print_right(Fonts::chalk_normal, 500, 290, to_string(plf->get_pingus()));
+
+  gc.print_left (Fonts::chalk_normal, 300, 320, _("Number to Save: "));
+  gc.print_right(Fonts::chalk_normal, 500, 320, 
to_string(plf->get_number_to_save()));
+
+  gc.print_left (Fonts::chalk_normal, 300, 350, _("Time: "));
+  gc.print_right(Fonts::chalk_normal, 500, 350, to_string(plf->get_time()));
   
-  gc.print_left(Fonts::chalk_normal, 250, 340, _("Difficulty:"));
+  gc.print_left (Fonts::chalk_normal, 300, 380, _("Difficulty:"));
+  gc.print_right(Fonts::chalk_normal, 500, 380, 
to_string(plf->get_difficulty() + "/100"));
+
   /*for (int i = 0; plf->get_difficulty())
     {
     }*/
@@ -103,6 +102,45 @@
 
   if (maintainer_mode)
     gc.print_left(Fonts::chalk_small, 110, 430, _("Filename: ") + 
plf->get_filename());
+}
+
+StartScreen::StartScreen(PLFHandle arg_plf)
+  : plf(arg_plf)
+{
+  StartScreenComponent* comp = new StartScreenComponent(plf);
+  gui_manager->add(comp);
+  gui_manager->add(new StartScreenOkButton(this));
+}
+
+void
+StartScreen::on_fast_forward_press()
+{
+  start_game();
+}
+
+void
+StartScreen::on_pause_press ()
+{
+  start_game();
+}
+
+void
+StartScreen::on_escape_press()
+{
+  cancel_game();
+}
+
+void
+StartScreen::start_game()
+{
+  PingusGameSession* game_session = new PingusGameSession(plf, true);
+  ScreenManager::instance()->replace_screen(game_session, true);
+}
+
+void
+StartScreen::cancel_game()
+{
+  ScreenManager::instance()->pop_screen();
 }
 
 /* EOF */

Index: start_screen.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/start_screen.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- start_screen.hxx    21 Mar 2003 22:40:12 -0000      1.1
+++ start_screen.hxx    30 Mar 2003 13:12:35 -0000      1.2
@@ -27,9 +27,17 @@
 class StartScreen : public GUIScreen
 {
 private:
+  PLFHandle plf;
 public:
   StartScreen(PLFHandle plf);
   ~StartScreen();
+
+  void start_game();
+  void cancel_game();
+
+  void on_pause_press();
+  void on_fast_forward_press();
+  void on_escape_press();
 private:
   StartScreen (const StartScreen&);
   StartScreen& operator= (const StartScreen&);

Index: stat_manager.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/stat_manager.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- stat_manager.cxx    28 Mar 2003 23:54:14 -0000      1.4
+++ stat_manager.cxx    30 Mar 2003 13:12:35 -0000      1.5
@@ -112,7 +112,8 @@
 
   for (Table::iterator i = stats.begin(); i != stats.end(); ++i)
     {
-      xml << "  <" << i->first << ">" << i->second << "</" << i->first << ">" 
<< std::endl;
+      if (!i->second.empty())
+        xml << "  <" << i->first << ">" << i->second << "</" << i->first << 
">" << std::endl;
     }
 
   xml << "</pingus-stats>\n";





reply via email to

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