pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3273 - in trunk/pingus: . data/data data/images/core/edito


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3273 - in trunk/pingus: . data/data data/images/core/editor data/images/core/menu src
Date: Fri, 5 Oct 2007 06:08:23 +0200

Author: grumbel
Date: 2007-10-05 06:08:22 +0200 (Fri, 05 Oct 2007)
New Revision: 3273

Added:
   trunk/pingus/data/images/core/editor/minimap.png
   trunk/pingus/data/images/core/menu/marker.png
   trunk/pingus/src/addon_menu.cpp
   trunk/pingus/src/addon_menu.hpp
   trunk/pingus/src/level_menu.cpp
   trunk/pingus/src/level_menu.hpp
Modified:
   trunk/pingus/SConstruct
   trunk/pingus/data/data/core.res
   trunk/pingus/src/global_event.cpp
   trunk/pingus/src/option_menu.cpp
Log:
- added dummy Add-on and level menu

Modified: trunk/pingus/SConstruct
===================================================================
--- trunk/pingus/SConstruct     2007-10-02 15:44:54 UTC (rev 3272)
+++ trunk/pingus/SConstruct     2007-10-05 04:08:22 UTC (rev 3273)
@@ -51,6 +51,7 @@
 'src/actions/teleported.cpp', 
 'src/actions/waiter.cpp', 
 'src/actions/walker.cpp', 
+'src/addon_menu.cpp', 
 'src/blitter.cpp',
 # 'blitter_test.cpp', 
 'src/capture_rectangle.cpp', 
@@ -143,6 +144,7 @@
 'src/screen/screen_ptr.cpp', 
 
 'src/line_iterator.cpp',
+'src/level_menu.cpp',
 
 'src/lisp/getters.cpp',
 'src/lisp/lexer.cpp',

Modified: trunk/pingus/data/data/core.res
===================================================================
--- trunk/pingus/data/data/core.res     2007-10-02 15:44:54 UTC (rev 3272)
+++ trunk/pingus/data/data/core.res     2007-10-05 04:08:22 UTC (rev 3273)
@@ -343,6 +343,10 @@
 
           (section (name "menu")
                    (sprite
+                    (name "marker")
+                    (image-file "../images/core/menu/marker.png"))
+
+                   (sprite
                     (name "filedialog")
                     (image-file "../images/core/menu/filedialog.png"))
 

Added: trunk/pingus/data/images/core/editor/minimap.png
===================================================================
(Binary files differ)


Property changes on: trunk/pingus/data/images/core/editor/minimap.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/pingus/data/images/core/menu/marker.png
===================================================================
(Binary files differ)


Property changes on: trunk/pingus/data/images/core/menu/marker.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/pingus/src/addon_menu.cpp
===================================================================
--- trunk/pingus/src/addon_menu.cpp     2007-10-02 15:44:54 UTC (rev 3272)
+++ trunk/pingus/src/addon_menu.cpp     2007-10-05 04:08:22 UTC (rev 3273)
@@ -0,0 +1,72 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 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 "gettext.h"
+#include "resource.hpp"
+#include "screen/screen_manager.hpp"
+#include "fonts.hpp"
+#include "display/drawing_context.hpp"
+#include "option_menu.hpp"
+#include "addon_menu.hpp"
+
+AddOnMenu::AddOnMenu()
+{
+  background = Resource::load_sprite("core/menu/filedialog");
+  ok_button  = Resource::load_sprite("core/start/ok");
+}
+
+AddOnMenu::~AddOnMenu()
+{
+}
+
+void
+AddOnMenu::update(const GameDelta& delta)
+{
+  GUIScreen::update(delta);
+  SDL_Delay(50);
+}
+
+void
+AddOnMenu::draw_background(DrawingContext& gc)
+{
+  // gc.draw_fillrect(Rect(100, 100, 400, 400), Color(255, 0, 0));
+  gc.draw(background, gc.get_width()/2 - background.get_width()/2, 
gc.get_height()/2 - background.get_height()/2);
+
+  gc.print_center(Fonts::chalk_large, gc.get_width()/2, 90, "Add-On Menu");
+
+  gc.print_left(Fonts::chalk_normal, 120, 145, "X-Mas Pingus Sprites");
+  gc.print_left(Fonts::chalk_small,  140, 170, "christmas look for penguins");
+  gc.print_left(Fonts::chalk_small,  140, 190, "Author: John Foo 
<address@hidden>");
+
+  gc.print_center(Fonts::chalk_normal, gc.get_width()/2, gc.get_height()/2 + 
160, "Update Online [ ]");
+
+  gc.print_center(Fonts::chalk_normal, gc.get_width()/2 + 225 + 30, 
gc.get_height()/2 + 125 - 20, _("Close"));
+  gc.draw(ok_button, gc.get_width()/2 + 225, gc.get_height()/2 + 125);
+
+  gc.draw(ok_button, 610, 145);
+}
+
+void
+AddOnMenu::on_escape_press()
+{
+  std::cout << "OptionMenu: poping screen" << std::endl;
+  ScreenManager::instance()->pop_screen();
+}
+
+/* EOF */


Property changes on: trunk/pingus/src/addon_menu.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/addon_menu.hpp
===================================================================
--- trunk/pingus/src/addon_menu.hpp     2007-10-02 15:44:54 UTC (rev 3272)
+++ trunk/pingus/src/addon_menu.hpp     2007-10-05 04:08:22 UTC (rev 3273)
@@ -0,0 +1,63 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 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_ADDON_MENU_HPP
+#define HEADER_ADDON_MENU_HPP
+
+#include "sprite.hpp"
+#include "screen/gui_screen.hpp"
+
+/** */
+class AddOnMenu : public GUIScreen
+{
+private:
+  Sprite background;
+  Sprite ok_button;
+
+  struct AddOnEntry
+  {
+    std::string title;
+    std::string description;
+    std::string author;
+
+    AddOnEntry(const std::string& title,
+               const std::string& description,
+               const std::string& author)
+      : title(title),
+        description(description),
+        author(author)     
+    {}
+  };
+
+public:
+  AddOnMenu();
+  ~AddOnMenu();
+  
+  void draw_background (DrawingContext& gc);
+  void update (const GameDelta& delta);
+  void on_escape_press ();
+
+private:
+  AddOnMenu (const AddOnMenu&);
+  AddOnMenu& operator= (const AddOnMenu&);
+};
+
+#endif
+
+/* EOF */


Property changes on: trunk/pingus/src/addon_menu.hpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: trunk/pingus/src/global_event.cpp
===================================================================
--- trunk/pingus/src/global_event.cpp   2007-10-02 15:44:54 UTC (rev 3272)
+++ trunk/pingus/src/global_event.cpp   2007-10-05 04:08:22 UTC (rev 3273)
@@ -25,6 +25,8 @@
 #include "fps_counter.hpp"
 #include "screen/screen_manager.hpp"
 #include "option_menu.hpp"
+#include "level_menu.hpp"
+#include "addon_menu.hpp"
 #include "global_event.hpp"
 #include "globals.hpp"
 
@@ -66,6 +68,16 @@
           ScreenManager::instance()->push_screen(new OptionMenu(), true);
         break;
 
+      case SDLK_F6:
+        if (!dynamic_cast<AddOnMenu*>(ScreenManager::instance()->get_screen()))
+          ScreenManager::instance()->push_screen(new AddOnMenu(), true);
+        break;
+
+      case SDLK_F7:
+        if (!dynamic_cast<LevelMenu*>(ScreenManager::instance()->get_screen()))
+          ScreenManager::instance()->push_screen(new LevelMenu(), true);
+        break;
+
       case SDLK_F12:
         {
           std::string filename;

Added: trunk/pingus/src/level_menu.cpp
===================================================================
--- trunk/pingus/src/level_menu.cpp     2007-10-02 15:44:54 UTC (rev 3272)
+++ trunk/pingus/src/level_menu.cpp     2007-10-05 04:08:22 UTC (rev 3273)
@@ -0,0 +1,98 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 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 <boost/format.hpp>
+#include "gettext.h"
+#include "resource.hpp"
+#include "screen/screen_manager.hpp"
+#include "fonts.hpp"
+#include "display/drawing_context.hpp"
+#include "option_menu.hpp"
+#include "level_menu.hpp"
+
+
+LevelMenu::LevelMenu()
+{
+  background = Resource::load_sprite("core/menu/filedialog");
+  ok_button  = Resource::load_sprite("core/start/ok");
+  marker     = Resource::load_sprite("core/menu/marker");
+
+  levelsets.push_back(LevelsetEntry("Desert Set 1",
+                                    "20 Levels in a desert setting of easy 
difficulty\n"
+                                    "Author: John Foo <address@hidden>",
+                                    78, 20));
+
+  levelsets.push_back(LevelsetEntry("Random Set 2",
+                                    "10 Levels in a random setting of easy 
difficulty\n"
+                                    "Author: John Foo <address@hidden>",
+                                    48, 10));
+
+  levelsets.push_back(LevelsetEntry("Unsorted Levels",
+                                    "Levels that aren't group in any 
levelset\n"
+                                    "Created by lots of random people",
+                                    48, 10));
+
+  levelsets.push_back(LevelsetEntry("User Created Levels",
+                                    "Levels created by you\n"
+                                    "Use the editor to create them if you 
haven't already",
+                                    48, 10));
+}
+
+LevelMenu::~LevelMenu()
+{
+}
+
+void
+LevelMenu::update(const GameDelta& delta)
+{
+  GUIScreen::update(delta);
+  SDL_Delay(50);
+}
+
+void
+LevelMenu::draw_background(DrawingContext& gc)
+{
+  // gc.draw_fillrect(Rect(100, 100, 400, 400), Color(255, 0, 0));
+  gc.draw(background, gc.get_width()/2 - background.get_width()/2, 
gc.get_height()/2 - background.get_height()/2);
+
+  gc.print_center(Fonts::chalk_large, gc.get_width()/2, 90, "Contrib Level 
Menu");
+
+  int y = 145;
+  for(Levelsets::iterator i = levelsets.begin(); i != levelsets.end(); ++i)
+    {
+      gc.print_left(Fonts::chalk_normal, 120,  0 + y, i->title);
+      gc.print_left(Fonts::chalk_small,  140, 25 + y, i->description);
+
+      gc.print_right(Fonts::chalk_normal, 650, 0 + y, 
(boost::format("Completion: %1%%%") % i->completion).str());
+      gc.print_right(Fonts::chalk_small, 650, 45 + y, (boost::format("%1% 
levels") % i->number_of_levels).str());
+
+      y += 90;
+    }
+  gc.draw(marker, 100, 136);
+  //gc.draw(ok_button, 610, 145);
+}
+
+void
+LevelMenu::on_escape_press()
+{
+  std::cout << "OptionMenu: poping screen" << std::endl;
+  ScreenManager::instance()->pop_screen();
+}
+
+/* EOF */


Property changes on: trunk/pingus/src/level_menu.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/level_menu.hpp
===================================================================
--- trunk/pingus/src/level_menu.hpp     2007-10-02 15:44:54 UTC (rev 3272)
+++ trunk/pingus/src/level_menu.hpp     2007-10-05 04:08:22 UTC (rev 3273)
@@ -0,0 +1,71 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 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_LEVEL_MENU_HPP
+#define HEADER_LEVEL_MENU_HPP
+
+#include "sprite.hpp"
+#include "screen/gui_screen.hpp"
+
+/** */
+class LevelMenu : public GUIScreen
+{
+private:
+  Sprite background;
+  Sprite ok_button;
+  Sprite marker;
+
+  struct LevelsetEntry
+  {
+    std::string title;
+    std::string description;
+
+    int completion;
+    int number_of_levels;
+
+    LevelsetEntry(const std::string& title,
+                  const std::string& description,
+                  int completion,
+                  int number_of_levels)
+      : title(title),
+        description(description),
+        completion(completion),
+        number_of_levels(number_of_levels)
+    {}
+  };
+
+  typedef std::vector<LevelsetEntry> Levelsets;
+  Levelsets levelsets;
+
+public:
+  LevelMenu();
+  ~LevelMenu();
+  
+  void draw_background (DrawingContext& gc);
+  void update (const GameDelta& delta);
+  void on_escape_press ();
+
+private:
+  LevelMenu (const LevelMenu&);
+  LevelMenu& operator= (const LevelMenu&);
+};
+
+#endif
+
+/* EOF */


Property changes on: trunk/pingus/src/level_menu.hpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: trunk/pingus/src/option_menu.cpp
===================================================================
--- trunk/pingus/src/option_menu.cpp    2007-10-02 15:44:54 UTC (rev 3272)
+++ trunk/pingus/src/option_menu.cpp    2007-10-05 04:08:22 UTC (rev 3273)
@@ -81,6 +81,7 @@
   strs2.push_back(OptionEntry("Music Volume:",  
"[||||||||||||||||||||||||||||||]"));
   strs2.push_back(OptionEntry("Scroll Mode:",     "<drag&drop>"));
   strs2.push_back(OptionEntry("Mouse Grab:",     "[X]"));
+  //strs2.push_back(OptionEntry("Auto Online Updates:", "[X]"));
 
   y = 145;
   for(std::vector<OptionEntry>::iterator i = strs2.begin(); i != strs2.end(); 
++i)





reply via email to

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