[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3850 - trunk/pingus/src
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3850 - trunk/pingus/src |
Date: |
Thu, 17 Jul 2008 12:02:17 +0200 |
Author: grumbel
Date: 2008-07-17 12:02:16 +0200 (Thu, 17 Jul 2008)
New Revision: 3850
Modified:
trunk/pingus/src/demo_session.cpp
trunk/pingus/src/demo_session.hpp
Log:
Implemented resize handling for the demosession
Modified: trunk/pingus/src/demo_session.cpp
===================================================================
--- trunk/pingus/src/demo_session.cpp 2008-07-17 09:28:18 UTC (rev 3849)
+++ trunk/pingus/src/demo_session.cpp 2008-07-17 10:02:16 UTC (rev 3850)
@@ -97,24 +97,24 @@
int world_height = server->get_world()->get_height();
playfield = new Playfield(server.get(), 0,
- Rect(Vector2i(Math::max((Display::get_width() -
world_width)/2, 0),
- Math::max((Display::get_height() -
world_height)/2, 0)),
- Size(Math::min(Display::get_width(),
world_width),
- Math::min(Display::get_height(),
world_height))));
+ Rect(Vector2i(Math::max((size.width -
world_width)/2, 0),
+ Math::max((size.height -
world_height)/2, 0)),
+ Size(Math::min(size.width, world_width),
+ Math::min(size.height, world_height))));
gui_manager->add(playfield);
small_map = new SmallMap(server.get(), playfield, Rect(Vector2i(5,
size.height - 105), Size(175, 100)));
gui_manager->add(small_map);
- gui_manager->add(new BButton(32+50, 32, "core/demo/fastforward",
-
boost::bind(&DemoSession::on_fast_forward_press, this),
- boost::bind(&DemoSession::is_fast_forward,
this)));
- gui_manager->add(new BButton(32, 32, "core/demo/pause",
- boost::bind(&DemoSession::on_pause_press, this),
- boost::bind(&DemoSession::is_pause, this)));
- gui_manager->add(new BButton(Display::get_width() - 32 - 48, 32,
"core/demo/reload",
- boost::bind(&DemoSession::restart, this)));
+ gui_manager->add(fastforward_button= new BButton(32+50, 32,
"core/demo/fastforward",
+
boost::bind(&DemoSession::on_fast_forward_press, this),
+
boost::bind(&DemoSession::is_fast_forward, this)));
+ gui_manager->add(pause_button =new BButton(32, 32, "core/demo/pause",
+
boost::bind(&DemoSession::on_pause_press, this),
+
boost::bind(&DemoSession::is_pause, this)));
+ gui_manager->add(restart_button = new BButton(size.width - 32 - 48, 32,
"core/demo/reload",
+
boost::bind(&DemoSession::restart, this)));
}
DemoSession::~DemoSession()
@@ -224,5 +224,26 @@
{
ScreenManager::instance()->replace_screen(new DemoSession(pathname));
}
+
+void
+DemoSession::resize(const Size& size)
+{
+ GUIScreen::resize(size);
+
+ int world_width = server->get_world()->get_width();
+ int world_height = server->get_world()->get_height();
+
+ playfield->set_rect(Rect(Vector2i(Math::max((size.width - world_width)/2,
0),
+ Math::max((size.height - world_height)/2,
0)),
+ Size(Math::min(size.width, world_width),
+ Math::min(size.height, world_height))));
+
+
+ fastforward_button->set_pos(32+50, 32);
+ pause_button->set_pos(32, 32);
+ restart_button->set_pos(size.width - 32 - 48, 32);
+
+ small_map->set_rect(Rect(Vector2i(5, size.height - 105), Size(175, 100)));
+}
/* EOF */
Modified: trunk/pingus/src/demo_session.hpp
===================================================================
--- trunk/pingus/src/demo_session.hpp 2008-07-17 09:28:18 UTC (rev 3849)
+++ trunk/pingus/src/demo_session.hpp 2008-07-17 10:02:16 UTC (rev 3850)
@@ -34,6 +34,7 @@
class PingusDemo;
class Playfield;
class SmallMap;
+class BButton;
/** A DemoSession is analog to a GameSession, but instead of loading a
level and letting the player play a game, a demo file will be
@@ -51,6 +52,10 @@
Playfield* playfield;
SmallMap* small_map;
+ BButton* fastforward_button;
+ BButton* pause_button;
+ BButton* restart_button;
+
bool pause;
bool fast_forward;
@@ -73,6 +78,9 @@
bool is_pause() { return pause; }
bool is_fast_forward() { return fast_forward; }
+
+ void resize(const Size& size);
+
private:
DemoSession (const DemoSession&);
DemoSession& operator= (const DemoSession&);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3850 - trunk/pingus/src,
grumbel at BerliOS <=