[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/gui component.hxx,1.4,1.5 gui_manager
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/gui component.hxx,1.4,1.5 gui_manager.cxx,1.4,1.5 gui_manager.hxx,1.4,1.5 |
Date: |
1 Aug 2002 21:40:04 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/gui
In directory dark:/tmp/cvs-serv6419/gui
Modified Files:
component.hxx gui_manager.cxx gui_manager.hxx
Log Message:
more gui and input cleanup, client is still broken
Index: component.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui/component.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- component.hxx 30 Jul 2002 01:58:16 -0000 1.4
+++ component.hxx 1 Aug 2002 21:40:02 -0000 1.5
@@ -59,7 +59,8 @@
/** return true if currently pressed */
bool is_pressed ();
- /** true if mouse is currently over */
+ /** true if mouse is currently over, FIXME: these seem to be
+ unimplementable without renaming on_pointer_enter() and wrapp them */
bool pointer_over ();
};
}
Index: gui_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui/gui_manager.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gui_manager.cxx 30 Jul 2002 14:57:26 -0000 1.4
+++ gui_manager.cxx 1 Aug 2002 21:40:02 -0000 1.5
@@ -124,24 +124,36 @@
{
/** Send the release event to the same component
which got the press event */
- assert (pressed_component);
- pressed_component->on_button_release (x_pos, y_pos);
-
- if (pressed_component == comp)
+ if (pressed_component)
{
- comp->on_button_click (x_pos, y_pos);
+ pressed_component->on_button_release (x_pos, y_pos);
+
+ if (pressed_component == comp)
+ {
+ comp->on_button_click (x_pos, y_pos);
+ }
+ else
+ {
+ // discard click
+ }
+ pressed_component = 0;
}
else
{
- // discard click
+ /* FIXME: This happens when you press a button
+ FIXME: in one GUIManager and switch in the
+ FIXME: on_button_press() method to another
+ FIXME: manager, not sure if there is or
+ FIXME: should be a workaround */
+ std::cout << "GUIManager: Got a release without a
press, possibly a bug" << std::endl;
}
-
- pressed_component = 0;
}
}
else
{
- std::cout << "RootGUIManager: Clicked into a non managed
region" << std::endl;
+ std::cout << "GUIManager: Clicked into a non managed region" <<
std::endl;
+ unhandled_event ();
+
if (pressed_component)
{
pressed_component->on_button_release (x_pos, y_pos);
@@ -151,7 +163,7 @@
break;
}
default:
- std::cout << "RootGUIManager: unhandled event type " <<
(*i)->get_type() << std::endl;
+ std::cout << "GUIManager: unhandled event type " << (*i)->get_type()
<< std::endl;
break;
}
}
@@ -192,6 +204,12 @@
}
return false;
+}
+
+void
+GUIManager::unhandled_event ()
+{
+ std::cout << "GUIManager::unhandled_event ()" << std::endl;
}
/* EOF */
Index: gui_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui/gui_manager.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gui_manager.hxx 30 Jul 2002 14:57:26 -0000 1.4
+++ gui_manager.hxx 1 Aug 2002 21:40:02 -0000 1.5
@@ -33,8 +33,15 @@
namespace GUI
{
- /** interface class which holds all GUI components and displays
- them */
+ /** The GUIManager class holds a group of components and manages
+ them. It dispatches the GameDelta to each individual
+ component
+
+ FIXME: We translate GameDelta into another 'language' which is
+ then understood by the GUI, this seems unclear, not sure at
+ which point it is best to split the GameDelta into
+ on_button_press(), etc.
+ */
class GUIManager : public Component
{
private:
@@ -60,6 +67,9 @@
virtual void update (const GameDelta& delta);
virtual void update (float delta) {}
+ /** Called once an unhandled event is recieved */
+ virtual void unhandled_event ();
+
/** Add a component to the manager, if delete_component is true
the component will get deleted on destruction of the manager,
if false is supplied the user has to handle the component
@@ -70,7 +80,7 @@
void remove (Component*);
Component* component_at (int x, int y);
- bool is_at (int x, int y);
+ virtual bool is_at (int x, int y);
};
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/gui component.hxx,1.4,1.5 gui_manager.cxx,1.4,1.5 gui_manager.hxx,1.4,1.5,
grumbel <=
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldmap manager.cxx,1.4,1.5 manager.hxx,1.3,1.4 node.cxx,1.4,1.5 worldmap.cxx,1.3,1.4 worldmap.hxx,1.2,1.3
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldmap manager.cxx,1.4,1.5 manager.hxx,1.3,1.4 node.cxx,1.4,1.5 worldmap.cxx,1.3,1.4 worldmap.hxx,1.2,1.3
- Index(es):