[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3121 - in trunk/pingus/src: . editor gui
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3121 - in trunk/pingus/src: . editor gui |
Date: |
Tue, 11 Sep 2007 16:59:05 +0200 |
Author: grumbel
Date: 2007-09-11 16:59:04 +0200 (Tue, 11 Sep 2007)
New Revision: 3121
Modified:
trunk/pingus/src/SConscript
trunk/pingus/src/editor/action_properties.cpp
trunk/pingus/src/editor/action_properties.hpp
trunk/pingus/src/editor/editor_screen.cpp
trunk/pingus/src/editor/editor_screen.hpp
trunk/pingus/src/editor/editor_viewport.cpp
trunk/pingus/src/editor/editor_viewport.hpp
trunk/pingus/src/editor/level_properties.cpp
trunk/pingus/src/editor/level_properties.hpp
trunk/pingus/src/editor/object_properties.cpp
trunk/pingus/src/editor/object_properties.hpp
trunk/pingus/src/editor/panel.cpp
trunk/pingus/src/gui/group_component.cpp
trunk/pingus/src/gui/group_component.hpp
trunk/pingus/src/gui/gui_manager.cpp
trunk/pingus/src/gui/gui_manager.hpp
Log:
- fixed input box
- partly implemented levelproperties and actionproperties
Modified: trunk/pingus/src/SConscript
===================================================================
--- trunk/pingus/src/SConscript 2007-09-11 14:57:58 UTC (rev 3120)
+++ trunk/pingus/src/SConscript 2007-09-11 14:59:04 UTC (rev 3121)
@@ -103,6 +103,7 @@
'editor/combobox.cpp',
'editor/editor_viewport.cpp',
'editor/level_objs.cpp',
+'editor/inputbox.cpp',
'editor/object_selector.cpp',
'editor/object_properties.cpp',
'editor/level_properties.cpp',
Modified: trunk/pingus/src/editor/action_properties.cpp
===================================================================
--- trunk/pingus/src/editor/action_properties.cpp 2007-09-11 14:57:58 UTC
(rev 3120)
+++ trunk/pingus/src/editor/action_properties.cpp 2007-09-11 14:59:04 UTC
(rev 3121)
@@ -23,21 +23,38 @@
** 02111-1307, USA.
*/
+#include <iostream>
+#include <boost/bind.hpp>
+#include "gui_style.hpp"
+#include "checkbox.hpp"
+#include "pingu_enums.hpp"
+#include "inputbox.hpp"
#include "action_properties.hpp"
namespace Editor {
/*
-
-ActionDialog:
-[active] [Actionname] [count]
-...
-
+ *
+ * ActionDialog:
+ * [active] [Actionname] [count]
+ *
*/
ActionProperties::ActionProperties(EditorScreen* editor, const Rect& rect)
-: GroupComponent(rect)
+ : GroupComponent(rect),
+ y_pos(0)
{
-
+ add_action(Actions::Basher);
+ add_action(Actions::Blocker);
+ add_action(Actions::Boarder);
+ add_action(Actions::Bomber);
+ add_action(Actions::Bridger);
+ add_action(Actions::Climber);
+ add_action(Actions::Digger);
+ add_action(Actions::Exiter);
+ add_action(Actions::Floater);
+ add_action(Actions::Jumper);
+ add_action(Actions::Miner);
+ add_action(Actions::Slider);
}
ActionProperties::~ActionProperties()
@@ -45,8 +62,9 @@
}
void
-ActionProperties::draw(DrawingContext& gc)
+ActionProperties::draw_background(DrawingContext& gc)
{
+ GUIStyle::draw_raised_box(gc, Rect(0,0,rect.get_width(), rect.get_height()));
}
void
@@ -54,6 +72,35 @@
{
}
+
+void
+ActionProperties::add_action(Actions::ActionName id)
+{
+ Checkbox* checkbox = new Checkbox(Rect(Vector2i(10,10 + y_pos),
Size(80,20)), Actions::action_to_string(id));
+ Inputbox* inputbox = new Inputbox(Rect(Vector2i(100,10 + y_pos),
Size(40,20)));
+
+ inputbox->set_text("20");
+
+ add(checkbox, true);
+ add(inputbox, true);
+
+
checkbox->on_change.connect(boost::bind(&ActionProperties::on_checkbox_change,
this, _1, id));
+
inputbox->on_change.connect(boost::bind(&ActionProperties::on_inputbox_change,
this, _1, id));
+
+ y_pos += 22;
+}
+
+void
+ActionProperties::on_checkbox_change(bool t, Actions::ActionName id)
+{
+ std::cout << "ActionProperties::on_checkbox_change: " << id << " " << t <<
std::endl;
+}
+
+void
+ActionProperties::on_inputbox_change(const std::string& value,
Actions::ActionName id)
+{
+ std::cout << "ActionProperties::on_inputbox_change: " << id << " " << value
<< std::endl;
+}
} // namespace Editor
Modified: trunk/pingus/src/editor/action_properties.hpp
===================================================================
--- trunk/pingus/src/editor/action_properties.hpp 2007-09-11 14:57:58 UTC
(rev 3120)
+++ trunk/pingus/src/editor/action_properties.hpp 2007-09-11 14:59:04 UTC
(rev 3121)
@@ -26,6 +26,7 @@
#ifndef HEADER_ACTION_PROPERTIES_HPP
#define HEADER_ACTION_PROPERTIES_HPP
+#include "pingu_enums.hpp"
#include "gui/group_component.hpp"
namespace Editor {
@@ -33,18 +34,23 @@
class EditorScreen;
/** */
-class ActionProperties : GUI::GroupComponent
+class ActionProperties : public GUI::GroupComponent
{
private:
EditorScreen* editor;
+ int y_pos;
public:
ActionProperties(EditorScreen* editor, const Rect& rect);
~ActionProperties();
- void draw (DrawingContext& gc);
+ void draw_background(DrawingContext& gc);
void update (float delta);
+
+ void add_action(Actions::ActionName id);
+ void on_checkbox_change(bool t, Actions::ActionName id);
+ void on_inputbox_change(const std::string& str, Actions::ActionName id);
private:
ActionProperties (const ActionProperties&);
ActionProperties& operator= (const ActionProperties&);
Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp 2007-09-11 14:57:58 UTC (rev
3120)
+++ trunk/pingus/src/editor/editor_screen.cpp 2007-09-11 14:59:04 UTC (rev
3121)
@@ -42,6 +42,8 @@
#include "level_objs.hpp"
#include "object_selector.hpp"
#include "object_properties.hpp"
+#include "action_properties.hpp"
+#include "level_properties.hpp"
namespace Editor {
@@ -60,9 +62,12 @@
// Create the panel for the buttons
panel = new Panel(this);
- object_selector = new ObjectSelector(this);
- object_properties = new ObjectProperties(this, Rect(Vector2i(0,440),
Size(240, 160)));
+ object_selector = new ObjectSelector(this);
+
+ object_properties = new ObjectProperties(this, Rect(Vector2i(0,400),
Size(240, 200)));
gui_manager->add(object_properties, true);
+
+
file_load_dialog = new FileLoadDialog(this, Rect(Vector2i(50, 50),
Size(Display::get_width() -
100,
Display::get_height()
- 100)));
@@ -71,6 +76,14 @@
gui_manager->add(file_load_dialog, true);
viewport->selection_changed.connect(boost::bind(&ObjectProperties::set_objects,
object_properties, _1));
+
+ action_properties = new ActionProperties(this, Rect(Vector2i(0, 38),
Size(150, 284)));
+ action_properties->hide();
+ gui_manager->add(action_properties, true);
+
+ level_properties = new LevelProperties(this, Rect(Vector2i(0,38),
Size(Display::get_width()-244,280)));
+ level_properties->hide();
+ gui_manager->add(level_properties, true);
}
// Destructor
@@ -113,17 +126,22 @@
EditorScreen::draw(DrawingContext& gc)
{
// Black out screen
- gc.fill_screen(Color(255,0,255));
+ //gc.fill_screen(Color(255,0,255)); // FIXME: Could be removed for added
speed
gui_manager->draw(gc);
if (show_help)
{
Size size(600, 400);
+ gc.draw_fillrect(int(gc.get_width()/2) - size.width/2 - 2,
+ int(gc.get_height()/2) - size.height/2 - 2,
+ int(gc.get_width()/2) + size.width/2 + 2,
+ int(gc.get_height()/2) + size.height/2 + 2,
+ Color(0,0,0));
gc.draw_fillrect(int(gc.get_width()/2) - size.width/2,
int(gc.get_height()/2) - size.height/2,
int(gc.get_width()/2) + size.width/2,
int(gc.get_height()/2) + size.height/2,
- Color(0,0,0));
+ Color(255,255,255));
gc.print_center(Fonts::verdana11,
int(gc.get_width()/2),
@@ -228,24 +246,6 @@
}
void
-EditorScreen::show_level_properties()
-{
- std::cout << "Function at '" << __FILE__ << ":" << __LINE__ << "' is
unimplemented" << std::endl;
-}
-
-void
-EditorScreen::show_action_properties()
-{
- std::cout << "Function at '" << __FILE__ << ":" << __LINE__ << "' is
unimplemented" << std::endl;
-}
-
-void
-EditorScreen::show_object_properties()
-{
- std::cout << "Function at '" << __FILE__ << ":" << __LINE__ << "' is
unimplemented" << std::endl;
-}
-
-void
EditorScreen::objects_delete()
{
viewport->delete_selected_objects();
@@ -309,7 +309,11 @@
void
EditorScreen::toggle_object_selector()
{
- std::cout << "Function at '" << __FILE__ << ":" << __LINE__ << "' is
unimplemented" << std::endl;
+ // need trigger a relayout
+ if (object_selector->is_visible())
+ object_selector->hide();
+ else
+ object_selector->show();
}
void
@@ -319,6 +323,33 @@
}
void
+EditorScreen::toggle_object_properties()
+{
+ if (object_properties->is_visible())
+ object_properties->hide();
+ else
+ object_properties->show();
+}
+
+void
+EditorScreen::toggle_action_properties()
+{
+ if (action_properties->is_visible())
+ action_properties->hide();
+ else
+ action_properties->show();
+}
+
+void
+EditorScreen::toggle_level_properties()
+{
+ if (level_properties->is_visible())
+ level_properties->hide();
+ else
+ level_properties->show();
+}
+
+void
EditorScreen::exit()
{
ScreenManager::instance()->pop_screen();
Modified: trunk/pingus/src/editor/editor_screen.hpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.hpp 2007-09-11 14:57:58 UTC (rev
3120)
+++ trunk/pingus/src/editor/editor_screen.hpp 2007-09-11 14:59:04 UTC (rev
3121)
@@ -37,6 +37,8 @@
class EditorViewport;
class ObjectSelector;
class ObjectProperties;
+class ActionProperties;
+class LevelProperties;
/** This class is the screen that contains all of the
editor objects */
@@ -49,6 +51,8 @@
EditorViewport* viewport;
ObjectSelector* object_selector;
ObjectProperties* object_properties;
+ ActionProperties* action_properties;
+ LevelProperties* level_properties;
FileLoadDialog* file_load_dialog;
bool show_help;
@@ -104,10 +108,6 @@
void level_save_as();
void level_play();
- void show_level_properties();
- void show_action_properties();
- void show_object_properties();
-
void objects_delete();
void objects_raise_to_top();
@@ -125,6 +125,10 @@
void toggle_object_selector();
+ void toggle_object_properties();
+ void toggle_action_properties();
+ void toggle_level_properties();
+
void toggle_help();
void exit();
Modified: trunk/pingus/src/editor/editor_viewport.cpp
===================================================================
--- trunk/pingus/src/editor/editor_viewport.cpp 2007-09-11 14:57:58 UTC (rev
3120)
+++ trunk/pingus/src/editor/editor_viewport.cpp 2007-09-11 14:59:04 UTC (rev
3121)
@@ -227,11 +227,18 @@
}
}
+void
+EditorViewport::on_key_pressed(const unsigned short c)
+{
+ std::cout << "EditorViewport::on_key_pressed: " << int(c) << " " << c <<
std::endl;
+}
+
// Draws all of the objects in the viewport and the background (if any)
void
EditorViewport::draw(DrawingContext &gc)
{
drawing_context->clear();
+ drawing_context->fill_screen(Color(255,0,255));
state.push(*drawing_context);
// Draw the level objects
Modified: trunk/pingus/src/editor/editor_viewport.hpp
===================================================================
--- trunk/pingus/src/editor/editor_viewport.hpp 2007-09-11 14:57:58 UTC (rev
3120)
+++ trunk/pingus/src/editor/editor_viewport.hpp 2007-09-11 14:59:04 UTC (rev
3121)
@@ -128,6 +128,8 @@
void on_secondary_button_click(int x, int y);
+ void on_key_pressed(const unsigned short c);
+
void delete_selected_objects();
void vflip_selected_objects();
void hflip_selected_objects();
Modified: trunk/pingus/src/editor/level_properties.cpp
===================================================================
--- trunk/pingus/src/editor/level_properties.cpp 2007-09-11 14:57:58 UTC
(rev 3120)
+++ trunk/pingus/src/editor/level_properties.cpp 2007-09-11 14:59:04 UTC
(rev 3121)
@@ -23,6 +23,9 @@
** 02111-1307, USA.
*/
+#include "label.hpp"
+#include "inputbox.hpp"
+#include "gui_style.hpp"
#include "level_properties.hpp"
/*
@@ -40,6 +43,30 @@
LevelProperties::LevelProperties(EditorScreen* editor, const Rect& rect)
: GroupComponent(rect)
{
+ int w = rect.get_width() - 120;
+ add(new Label (Rect(Vector2i( 10, 10), Size( 80, 20)), "Author:"), true);
+ add(new Inputbox(Rect(Vector2i(110, 10), Size( w, 20))), true);
+ add(new Label (Rect(Vector2i( 10, 32), Size( 80, 20)), "Levelname:"),
true);
+ add(new Inputbox(Rect(Vector2i(110, 32), Size( w, 20))), true);
+ add(new Label (Rect(Vector2i( 10, 54), Size( 80, 20)), "Description:"),
true);
+ add(new Inputbox(Rect(Vector2i(110, 54), Size( w, 20*3))), true);
+
+ int y = 116;
+ add(new Label (Rect(Vector2i( 10, y), Size( 80, 20)), "Pingus Count:"),
true);
+ add(new Inputbox(Rect(Vector2i(110, y), Size( w, 20))), true);
+ add(new Label (Rect(Vector2i( 10, y+22), Size( 80, 20)), "Pingus to
Save:"), true);
+ add(new Inputbox(Rect(Vector2i(110, y+22), Size( w, 20))), true);
+ add(new Label (Rect(Vector2i( 10, y+44), Size( 80, 20)), "Time:"), true);
+ add(new Inputbox(Rect(Vector2i(110, y+44), Size( w, 20))), true);
+ add(new Label (Rect(Vector2i( 10, y+66), Size( 80, 20)), "Width:"), true);
+ add(new Inputbox(Rect(Vector2i(110, y+66), Size( w, 20))), true);
+ add(new Label (Rect(Vector2i( 10, y+88), Size( 80, 20)), "Height:"),
true);
+ add(new Inputbox(Rect(Vector2i(110, y+88), Size( w, 20))), true);
+
+ add(new Label (Rect(Vector2i( 10, y+110), Size( 80, 20)), "Difficulty:"),
true);
+ add(new Inputbox(Rect(Vector2i(110, y+110), Size( w, 20))), true);
+ add(new Label (Rect(Vector2i( 10, y+132), Size( 80, 20)), "Comment:"),
true);
+ add(new Inputbox(Rect(Vector2i(110, y+132), Size( w, 20))), true);
}
LevelProperties::~LevelProperties()
@@ -47,8 +74,9 @@
}
void
-LevelProperties::draw(DrawingContext& gc)
+LevelProperties::draw_background(DrawingContext& gc)
{
+ GUIStyle::draw_raised_box(gc, Rect(0,0,rect.get_width(), rect.get_height()));
}
void
@@ -56,6 +84,31 @@
{
}
+void
+LevelProperties::on_author_change(const std::string& str)
+{
+}
+
+void
+LevelProperties::on_levelname_change(const std::string& str)
+{
+}
+
+void
+LevelProperties::on_description_change(const std::string& str)
+{
+}
+
+void
+LevelProperties::on_width_change(const std::string& str)
+{
+}
+
+void
+LevelProperties::on_height_change(const std::string& str)
+{
+}
+
} // namespace Editor
/* EOF */
Modified: trunk/pingus/src/editor/level_properties.hpp
===================================================================
--- trunk/pingus/src/editor/level_properties.hpp 2007-09-11 14:57:58 UTC
(rev 3120)
+++ trunk/pingus/src/editor/level_properties.hpp 2007-09-11 14:59:04 UTC
(rev 3121)
@@ -42,9 +42,16 @@
LevelProperties(EditorScreen* editor, const Rect& rect);
~LevelProperties();
- void draw (DrawingContext& gc);
+ void draw_background (DrawingContext& gc);
void update (float delta);
+ void on_author_change(const std::string& str);
+ void on_levelname_change(const std::string& str);
+ void on_description_change(const std::string& str);
+
+ void on_width_change(const std::string& str);
+ void on_height_change(const std::string& str);
+
private:
LevelProperties (const LevelProperties&);
LevelProperties& operator= (const LevelProperties&);
Modified: trunk/pingus/src/editor/object_properties.cpp
===================================================================
--- trunk/pingus/src/editor/object_properties.cpp 2007-09-11 14:57:58 UTC
(rev 3120)
+++ trunk/pingus/src/editor/object_properties.cpp 2007-09-11 14:59:04 UTC
(rev 3121)
@@ -26,6 +26,7 @@
#include "gui_style.hpp"
#include "groundtype.hpp"
#include "combobox.hpp"
+#include "inputbox.hpp"
#include "checkbox.hpp"
#include "object_properties.hpp"
@@ -68,6 +69,15 @@
stretch_x_checkbox->on_change.connect(boost::bind(&ObjectProperties::on_stretch_x_change,
this, _1));
stretch_y_checkbox->on_change.connect(boost::bind(&ObjectProperties::on_stretch_y_change,
this, _1));
+
+ add(para_x_label = new Label(Rect(Vector2i(10, 120), Size(80,20)),
"Para-X"), true);
+ add(para_y_label = new Label(Rect(Vector2i(10, 150), Size(80,20)),
"Para-Y"), true);
+
+ add(para_x_inputbox = new Inputbox(Rect(Vector2i(60, 120), Size(80,20))),
true);
+ add(para_y_inputbox = new Inputbox(Rect(Vector2i(60, 150), Size(80,20))),
true);
+
+ para_x_inputbox->set_text("Hello");
+ para_y_inputbox->set_text("World");
if (0)
{
Modified: trunk/pingus/src/editor/object_properties.hpp
===================================================================
--- trunk/pingus/src/editor/object_properties.hpp 2007-09-11 14:57:58 UTC
(rev 3120)
+++ trunk/pingus/src/editor/object_properties.hpp 2007-09-11 14:59:04 UTC
(rev 3121)
@@ -29,6 +29,7 @@
class Combobox;
class ComboItem;
class Checkbox;
+class Inputbox;
/** */
class ObjectProperties : public GUI::GroupComponent
@@ -47,7 +48,13 @@
Checkbox* stretch_x_checkbox;
Checkbox* stretch_y_checkbox;
+
+ Label* para_x_label;
+ Inputbox* para_x_inputbox;
+ Label* para_y_label;
+ Inputbox* para_y_inputbox;
+
public:
ObjectProperties(EditorScreen* editor, const Rect& rect);
~ObjectProperties();
Modified: trunk/pingus/src/editor/panel.cpp
===================================================================
--- trunk/pingus/src/editor/panel.cpp 2007-09-11 14:57:58 UTC (rev 3120)
+++ trunk/pingus/src/editor/panel.cpp 2007-09-11 14:59:04 UTC (rev 3121)
@@ -163,11 +163,13 @@
&EditorScreen::level_play);
add_separator();
add_button("core/editor/actions", "Configure actions",
- &EditorScreen::show_action_properties);
+ &EditorScreen::toggle_action_properties);
add_button("core/editor/document-properties", "Configure level",
- &EditorScreen::show_level_properties);
+ &EditorScreen::toggle_level_properties);
add_button("core/editor/object-properties", "Display object properties",
- &EditorScreen::show_object_properties);
+ &EditorScreen::toggle_object_properties);
+ add_button("core/editor/objects", "Show object insertion window",
+ &EditorScreen::toggle_object_selector);
add_separator();
add_button("core/editor/delete", "Delete the selected objects",
&EditorScreen::objects_delete);
@@ -193,8 +195,6 @@
add_separator();
//add_button("core/editor/snap-grid", "Snap objects to grid",
// &EditorScreen::toggle_grid_snap);
- add_button("core/editor/objects", "Show object insertion window",
- &EditorScreen::toggle_object_selector);
add_separator();
add_button("core/editor/help", "Display help",
&EditorScreen::toggle_help);
Modified: trunk/pingus/src/gui/group_component.cpp
===================================================================
--- trunk/pingus/src/gui/group_component.cpp 2007-09-11 14:57:58 UTC (rev
3120)
+++ trunk/pingus/src/gui/group_component.cpp 2007-09-11 14:59:04 UTC (rev
3121)
@@ -23,6 +23,7 @@
** 02111-1307, USA.
*/
+#include <iostream>
#include "group_component.hpp"
namespace GUI {
@@ -31,7 +32,8 @@
: RectComponent(rect),
drawing_context(rect, clip),
mouse_over_comp(0),
- press_over_comp(0)
+ press_over_comp(0),
+ focused_comp(0)
{
}
@@ -65,7 +67,11 @@
}
}
-bool is_at (int x, int y);
+bool
+GroupComponent::is_at (int x, int y)
+{
+ return (RectComponent::is_at(x,y) ||
component_at(drawing_context.screen_to_world(Vector2i(x, y))));
+}
void
GroupComponent::on_primary_button_press (int x, int y)
@@ -73,7 +79,17 @@
Vector2i mouse_pos = drawing_context.screen_to_world(Vector2i(x, y));
Component* comp = component_at(mouse_pos);
if (comp)
- comp->on_primary_button_press(mouse_pos.x, mouse_pos.y);
+ {
+ comp->on_primary_button_press(mouse_pos.x, mouse_pos.y);
+
+ if (focused_comp)
+ focused_comp->set_focus(false);
+
+ focused_comp = comp;
+
+ if (focused_comp)
+ focused_comp->set_focus(true);
+ }
press_over_comp = comp;
}
@@ -120,6 +136,17 @@
}
void
+GroupComponent::on_key_pressed(const unsigned short c)
+{
+ std::cout << "GroupComponent: " << int(c) << std::endl;
+
+ if (focused_comp)
+ focused_comp->on_key_pressed(c);
+ else if (mouse_over_comp)
+ mouse_over_comp->on_key_pressed(c);
+}
+
+void
GroupComponent::on_pointer_move(int x, int y)
{
Vector2i mouse_pos = drawing_context.screen_to_world(Vector2i(x, y));
@@ -141,12 +168,6 @@
mouse_over_comp = comp;
}
-void
-GroupComponent::on_key_pressed(const unsigned short c)
-{
-
-}
-
Component*
GroupComponent::component_at (const Vector2i& pos)
{
Modified: trunk/pingus/src/gui/group_component.hpp
===================================================================
--- trunk/pingus/src/gui/group_component.hpp 2007-09-11 14:57:58 UTC (rev
3120)
+++ trunk/pingus/src/gui/group_component.hpp 2007-09-11 14:59:04 UTC (rev
3121)
@@ -40,6 +40,7 @@
DrawingContext drawing_context;
Component* mouse_over_comp;
Component* press_over_comp;
+ Component* focused_comp;
public:
GroupComponent(const Rect& rect, bool clip = true);
@@ -59,17 +60,19 @@
void on_primary_button_click(int x, int y) {}
void on_secondary_button_click(int x, int y) {}
+ void on_key_pressed(const unsigned short c);
+
void on_pointer_enter() {}
void on_pointer_leave() {}
void on_pointer_move(int x, int y);
- void on_key_pressed(const unsigned short c);
-
void add(Component*, bool delete_comp);
void update_layout();
+ bool is_at(int x, int y);
+
Component* component_at (const Vector2i& pos);
private:
GroupComponent(const GroupComponent&);
Modified: trunk/pingus/src/gui/gui_manager.cpp
===================================================================
--- trunk/pingus/src/gui/gui_manager.cpp 2007-09-11 14:57:58 UTC (rev
3120)
+++ trunk/pingus/src/gui/gui_manager.cpp 2007-09-11 14:59:04 UTC (rev
3121)
@@ -201,7 +201,7 @@
if (event.name == PRIMARY_BUTTON && event.state == Input::BUTTON_PRESSED)
{
primary_pressed_component = comp;
- change_focussed_comp(comp);
+ change_focussed_comp(comp);
comp->on_primary_button_press (x_pos, y_pos);
// FIXME: add double click detection here
@@ -241,7 +241,7 @@
if (event.name == SECONDARY_BUTTON && event.state ==
Input::BUTTON_PRESSED)
{
secondary_pressed_component = comp;
- change_focussed_comp(comp);
+ change_focussed_comp(comp);
comp->on_secondary_button_press (x_pos, y_pos);
}
else if (event.name == SECONDARY_BUTTON && event.state ==
Input::BUTTON_RELEASED)
@@ -291,19 +291,21 @@
void
GUIManager::process_keyboard_event (const Input::KeyboardEvent &event)
{
- // Pass key value to last pressed component.
- if (focussed_component)
- focussed_component->on_key_pressed(event.key);
+ // Pass key value to last pressed component.
+ if (focussed_component)
+ focussed_component->on_key_pressed(event.key);
}
void
GUIManager::change_focussed_comp(Component* c)
{
- if (focussed_component)
- focussed_component->set_focus(false);
- focussed_component = c;
- if (focussed_component)
- focussed_component->set_focus(true);
+ if (focussed_component)
+ focussed_component->set_focus(false);
+
+ focussed_component = c;
+
+ if (focussed_component)
+ focussed_component->set_focus(true);
}
Modified: trunk/pingus/src/gui/gui_manager.hpp
===================================================================
--- trunk/pingus/src/gui/gui_manager.hpp 2007-09-11 14:57:58 UTC (rev
3120)
+++ trunk/pingus/src/gui/gui_manager.hpp 2007-09-11 14:59:04 UTC (rev
3121)
@@ -50,8 +50,8 @@
Component* primary_pressed_component;
Component* secondary_pressed_component;
- /** Component which currently has the focus (last clicked) */
- Component* focussed_component;
+ /** Component which currently has the focus (last clicked) */
+ Component* focussed_component;
/** The component over which the mouse was in the last update,
used to detecte enter/leave events */
@@ -64,10 +64,10 @@
void process_input (const GameDelta& delta);
void process_pointer_event (const Input::PointerEvent& event);
void process_button_event (unsigned int time_stamp, const
Input::ButtonEvent& event);
- void process_keyboard_event (const Input::KeyboardEvent& event);
+ void process_keyboard_event (const Input::KeyboardEvent& event);
- /** Change which component has the focus and notify the component */
- void change_focussed_comp(Component* c);
+ /** Change which component has the focus and notify the component */
+ void change_focussed_comp(Component* c);
public:
GUIManager ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3121 - in trunk/pingus/src: . editor gui,
grumbel at BerliOS <=