[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2621 - in trunk/src: gui input
From: |
jave27 |
Subject: |
[Pingus-CVS] r2621 - in trunk/src: gui input |
Date: |
Mon, 23 Jan 2006 06:00:17 +0100 |
Author: jave27
Date: 2006-01-23 06:00:10 +0100 (Mon, 23 Jan 2006)
New Revision: 2621
Modified:
trunk/src/gui/gui_manager.cxx
trunk/src/gui/gui_manager.hxx
trunk/src/input/controller.cxx
trunk/src/input/controller.hxx
Log:
Input working much better now. Added "focussed" component to the GUI
Manager.
Modified: trunk/src/gui/gui_manager.cxx
===================================================================
--- trunk/src/gui/gui_manager.cxx 2006-01-23 04:48:15 UTC (rev 2620)
+++ trunk/src/gui/gui_manager.cxx 2006-01-23 05:00:10 UTC (rev 2621)
@@ -32,6 +32,7 @@
GUIManager::GUIManager ()
: primary_pressed_component (0),
secondary_pressed_component (0),
+ focussed_component(0),
mouse_over_component (0),
x_pos (400), y_pos (300)
{
@@ -187,6 +188,7 @@
if (event.name == primary && event.state == Input::pressed)
{
primary_pressed_component = comp;
+ focussed_component = comp;
comp->on_primary_button_press (x_pos, y_pos);
// FIXME: add double click detection here
@@ -226,6 +228,7 @@
if (event.name == secondary && event.state == Input::pressed)
{
secondary_pressed_component = comp;
+ focussed_component = comp;
comp->on_secondary_button_press (x_pos, y_pos);
}
else if (event.name == secondary && event.state == Input::released)
@@ -276,8 +279,8 @@
GUIManager::process_keyboard_event (const Input::KeyboardEvent &event)
{
// Pass key value to last pressed component.
- if (primary_pressed_component)
- primary_pressed_component->on_key_pressed(event.key);
+ if (focussed_component)
+ focussed_component->on_key_pressed(event.key);
}
} // namespace Pingus
Modified: trunk/src/gui/gui_manager.hxx
===================================================================
--- trunk/src/gui/gui_manager.hxx 2006-01-23 04:48:15 UTC (rev 2620)
+++ trunk/src/gui/gui_manager.hxx 2006-01-23 05:00:10 UTC (rev 2621)
@@ -50,6 +50,9 @@
Component* primary_pressed_component;
Component* secondary_pressed_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 */
Component* mouse_over_component;
Modified: trunk/src/input/controller.cxx
===================================================================
--- trunk/src/input/controller.cxx 2006-01-23 04:48:15 UTC (rev 2620)
+++ trunk/src/input/controller.cxx 2006-01-23 05:00:10 UTC (rev 2621)
@@ -270,6 +270,15 @@
keys += event.str;
}
+std::string
+Controller::get_keys_pressed()
+{
+ std::string ret_keys = keys;
+ keys.clear();
+ return ret_keys;
+}
+
+
} // namespace Input
} // namespace Pingus
Modified: trunk/src/input/controller.hxx
===================================================================
--- trunk/src/input/controller.hxx 2006-01-23 04:48:15 UTC (rev 2620)
+++ trunk/src/input/controller.hxx 2006-01-23 05:00:10 UTC (rev 2621)
@@ -79,7 +79,7 @@
void key_pressed(const CL_InputEvent &event);
/** Get keyboard keys pressed to handle general keyboard input */
- std::string get_keys_pressed() { return keys; keys.clear(); }
+ std::string get_keys_pressed();
std::string keys;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2621 - in trunk/src: gui input,
jave27 <=