[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] rev 2348 - in trunk/src: . gui
From: |
Ingo Ruhnke |
Subject: |
[Pingus-CVS] rev 2348 - in trunk/src: . gui |
Date: |
Fri, 25 Jun 2004 01:59:40 +0200 |
Author: grumbel
Date: 2004-06-25 01:59:40 +0200 (Fri, 25 Jun 2004)
New Revision: 2348
Modified:
trunk/src/gui/gui_manager.cxx
trunk/src/gui/gui_manager.hxx
trunk/src/pingus_menu.cxx
trunk/src/pingus_menu.hxx
trunk/src/pingus_menu_manager.cxx
trunk/src/pingus_menu_manager.hxx
Log:
- added some more buttons to the main menu, just placeholder
Modified: trunk/src/gui/gui_manager.cxx
===================================================================
--- trunk/src/gui/gui_manager.cxx 2004-06-24 22:43:08 UTC (rev 2347)
+++ trunk/src/gui/gui_manager.cxx 2004-06-24 23:59:40 UTC (rev 2348)
@@ -89,17 +89,18 @@
}
void
-GUIManager::add (Component* c, bool delete_component)
+GUIManager::add(Component* c, bool delete_component)
{
components.push_back(c);
UNUSED_ARG(delete_component);
}
void
-GUIManager::remove (Component* c)
+GUIManager::remove(Component* c)
{
- /* components.erase(c); */
- UNUSED_ARG(c);
+ Components::iterator i = std::find(components.begin(), components.end(), c);
+ if (i != components.end())
+ components.erase(i);
}
Component*
Modified: trunk/src/gui/gui_manager.hxx
===================================================================
--- trunk/src/gui/gui_manager.hxx 2004-06-24 22:43:08 UTC (rev 2347)
+++ trunk/src/gui/gui_manager.hxx 2004-06-24 23:59:40 UTC (rev 2348)
@@ -42,7 +42,8 @@
class GUIManager : public Component
{
private:
- std::vector<Component*> components;
+ typedef std::vector<Component*> Components;
+ Components components;
/** The component which recieved the last pressed event */
Component* primary_pressed_component;
Modified: trunk/src/pingus_menu.cxx
===================================================================
--- trunk/src/pingus_menu.cxx 2004-06-24 22:43:08 UTC (rev 2347)
+++ trunk/src/pingus_menu.cxx 2004-06-24 23:59:40 UTC (rev 2348)
@@ -41,9 +41,76 @@
: PingusSubMenu (m)
{
is_init = false;
+
+ editor_button = new MenuButton(CL_Point(CL_Display::get_width() * 150 / 800,
+ CL_Display::get_height() * 370 /
600),
+ Resource::load_sprite("menu/create_on",
"core"),
+ _("Create a\nLevel"),
+ _("..:: Launch the level editor ::.."));
+
+ start_button = new MenuButton(CL_Point(CL_Display::get_width() * 400 / 800,
+ CL_Display::get_height() * 370 / 600),
+ Resource::load_sprite("menu/play_on", "core"),
+ _("Start"),
+ _("..:: Start the game ::.."));
+
+ quit_button = new MenuButton(CL_Point(CL_Display::get_width() * 650 / 800,
+ CL_Display::get_height() * 370 / 600),
+ Resource::load_sprite("menu/exit_on", "core"),
+ _("Exit"),
+ _("..:: Bye, bye ::.."));
+
+ contrib_button = new MenuButton(CL_Point(CL_Display::get_width() * 150 / 800,
+ CL_Display::get_height() * 370 /
600),
+ Resource::load_sprite("menu/options_on",
"core"),
+ _("Contrib\nLevels"),
+ _("..:: Play User Build levels ::.."));
+
+ story_button = new MenuButton(CL_Point(CL_Display::get_width() * 400 / 800,
+ CL_Display::get_height() * 370 /
600),
+ Resource::load_sprite("menu/credits_on",
"core"),
+ _("Story"),
+ _("..:: Start the story ::.."));
+
+ multiplayer_button = new MenuButton(CL_Point(CL_Display::get_width() * 650 /
800,
+ CL_Display::get_height() * 370
/ 600),
+ Resource::load_sprite("menu/multi_on",
"core"),
+ _("Multiplayer"),
+ _("..:: Multiplayer Match ::.."));
+
+ slots.push_back(editor_button->sig_click().connect(this,
&PingusMenu::do_editor));
+ slots.push_back(start_button->sig_click().connect(this,
&PingusMenu::setup_game_menu));
+ slots.push_back(quit_button->sig_click().connect(this,
&PingusMenu::do_quit));
+
+ slots.push_back(story_button->sig_click().connect(this,
&PingusMenu::do_start));
+ slots.push_back(multiplayer_button->sig_click().connect(this,
&PingusMenu::setup_main_menu));
}
void
+PingusMenu::setup_main_menu()
+{
+ gui_manager->remove(contrib_button);
+ gui_manager->remove(story_button);
+ gui_manager->remove(multiplayer_button);
+
+ gui_manager->add(quit_button);
+ gui_manager->add(start_button);
+ gui_manager->add(editor_button);
+}
+
+void
+PingusMenu::setup_game_menu()
+{
+ gui_manager->remove(quit_button);
+ gui_manager->remove(start_button);
+ gui_manager->remove(editor_button);
+
+ gui_manager->add(contrib_button);
+ gui_manager->add(story_button);
+ gui_manager->add(multiplayer_button);
+}
+
+void
PingusMenu::preload ()
{
if (!is_init)
@@ -51,32 +118,7 @@
is_init = true;
background = Resource::load_sprite("misc/logo", "core");
-
- MenuButton* editor_button = new
MenuButton(CL_Point(CL_Display::get_width() * 150 / 800,
-
CL_Display::get_height() * 370 / 600),
-
Resource::load_sprite("menu/create_on", "core"),
- _("Create a\nLevel"),
- _("..:: Launch the
level editor ::.."));
-
- MenuButton* start_button = new
MenuButton(CL_Point(CL_Display::get_width() * 400 / 800,
-
CL_Display::get_height() * 370 / 600),
-
Resource::load_sprite("menu/play_on", "core"),
- _("Start"),
- _("..:: Start the game
::.."));
-
- MenuButton* quit_button = new
MenuButton(CL_Point(CL_Display::get_width() * 650 / 800,
-
CL_Display::get_height() * 370 / 600),
-
Resource::load_sprite("menu/exit_on", "core"),
- _("Exit"),
- _("..:: Bye, bye ::.."));
-
- slots.push_back(editor_button->sig_click().connect(this,
&PingusMenu::do_editor));
- slots.push_back(start_button->sig_click().connect(this,
&PingusMenu::do_start));
- slots.push_back(quit_button->sig_click().connect(this,
&PingusMenu::do_quit));
-
- gui_manager->add(quit_button);
- gui_manager->add(start_button);
- gui_manager->add(editor_button);
+ setup_main_menu();
}
}
Modified: trunk/src/pingus_menu.hxx
===================================================================
--- trunk/src/pingus_menu.hxx 2004-06-24 22:43:08 UTC (rev 2347)
+++ trunk/src/pingus_menu.hxx 2004-06-24 23:59:40 UTC (rev 2348)
@@ -36,9 +36,7 @@
class GUIManager;
} // namespace GUI
-namespace Input {
-class Controller;
-} // namespace Input
+class MenuButton;
class PingusMenu : public PingusSubMenu
{
@@ -46,17 +44,28 @@
bool is_init;
private:
std::vector<CL_Slot> slots;
- Input::Controller* controller;
CL_Sprite background;
LayerManager layer_manager;
CL_Surface cursor_sur;
+ MenuButton* editor_button;
+ MenuButton* start_button;
+ MenuButton* quit_button;
+
+ MenuButton* contrib_button;
+ MenuButton* story_button;
+ MenuButton* multiplayer_button;
+
void on_resize (int w, int h);
+ void setup_main_menu();
+ void setup_game_menu();
+
void do_quit();
void do_start();
void do_editor();
+
public:
PingusMenu (PingusMenuManager* m);
~PingusMenu();
Modified: trunk/src/pingus_menu_manager.cxx
===================================================================
--- trunk/src/pingus_menu_manager.cxx 2004-06-24 22:43:08 UTC (rev 2347)
+++ trunk/src/pingus_menu_manager.cxx 2004-06-24 23:59:40 UTC (rev 2348)
@@ -62,7 +62,7 @@
//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);
+ menu_stack.back()->update (delta);
}
void
Modified: trunk/src/pingus_menu_manager.hxx
===================================================================
--- trunk/src/pingus_menu_manager.hxx 2004-06-24 22:43:08 UTC (rev 2347)
+++ trunk/src/pingus_menu_manager.hxx 2004-06-24 23:59:40 UTC (rev 2348)
@@ -50,18 +50,11 @@
MenuBackground background;
ExitMenu exitmenu;
- virtual ~PingusMenuManager ();
+ virtual ~PingusMenuManager();
- bool draw (GraphicContext& gc);
- void update (const GameDelta&);
+ bool draw(GraphicContext& gc);
+ void update(const GameDelta&);
- // !FIXME! Should use controller instead
- /*
- void on_button_press (CL_InputDevice*,const CL_Key &);
- void on_button_release (CL_InputDevice*,const CL_Key &);
- void on_mouse_move (CL_InputDevice*, int, int);
- */
-
/// Exit the menu manager (which means to exit the while() loop in display
())
void show_exit_menu ();
@@ -71,9 +64,10 @@
// Replace the current menu with a new one
void set_menu (PingusSubMenu * menu);
+
/** Remove the current menu and fall back to the last one.
This is used for yes/no dialoges and such things. */
- void pop_menu ();
+ void pop_menu();
/** Add's a new menu to the menu stack. This is used for yes/no
dialoges and such things.*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] rev 2348 - in trunk/src: . gui,
Ingo Ruhnke <=