[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.2,1.3 root_gui_ma
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/gui component.hxx,1.2,1.3 root_gui_manager.cxx,1.1,1.2 root_gui_manager.hxx,1.1,1.2 |
Date: |
29 Jul 2002 11:57:40 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/gui
In directory dark:/tmp/cvs-serv10519/gui
Modified Files:
component.hxx root_gui_manager.cxx root_gui_manager.hxx
Log Message:
transformed button_panel and smallmap into GUI::Components
Index: component.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui/component.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- component.hxx 29 Jul 2002 10:44:12 -0000 1.2
+++ component.hxx 29 Jul 2002 11:57:38 -0000 1.3
@@ -32,7 +32,7 @@
virtual void draw () =0;
virtual void update (float delta) {}
- virtual bool is_at (int x, int y) { return false; }
+ virtual bool is_at (int x, int y) =0;
// Events
/** Gets issued once the primary button is pressed */
@@ -50,6 +50,10 @@
/** Emmitted when pointer leaves the region of the component */
virtual void on_pointer_leave () {}
+
+ /** Emitted when the pointer moved, x and y are the new pointer
+ coordinates */
+ virtual void on_pointer_move (int x, int y) {}
// status functions for use in the update() function
/** return true if currently pressed */
Index: root_gui_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui/root_gui_manager.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- root_gui_manager.cxx 29 Jul 2002 10:44:12 -0000 1.1
+++ root_gui_manager.cxx 29 Jul 2002 11:57:38 -0000 1.2
@@ -75,11 +75,18 @@
case Input::PointerEventType:
{
PointerEvent* event = dynamic_cast<PointerEvent*>(*i);
- x_pos = event->x;
- y_pos = event->y;
+ x_pos = int(event->x);
+ y_pos = int(event->y);
Component* comp = component_at (x_pos, y_pos);//FIXME
+ if (pressed_component)
+ pressed_component->on_pointer_move (x_pos, y_pos);
+ else if (comp)
+ {
+ comp->on_pointer_move (x_pos, y_pos);
+ }
+
if (comp)
{
if (comp != mouse_over_component)
@@ -167,6 +174,19 @@
return *i;
}
return 0;
+}
+
+bool
+RootGUIManager::is_at (int x, int y)
+{
+ for (std::vector<Component*>::iterator i = components.begin ();
+ i != components.end (); ++i)
+ {
+ if ((*i)->is_at (x, y))
+ return true;
+ }
+
+ return false;
}
/* EOF */
Index: root_gui_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui/root_gui_manager.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- root_gui_manager.hxx 29 Jul 2002 10:44:12 -0000 1.1
+++ root_gui_manager.hxx 29 Jul 2002 11:57:38 -0000 1.2
@@ -50,6 +50,8 @@
void draw ();
void update (float delta);
+ bool is_at (int x, int y);
+
void process_input (float delta);
Component* component_at (int x, int y);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/gui component.hxx,1.2,1.3 root_gui_manager.cxx,1.1,1.2 root_gui_manager.hxx,1.1,1.2,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/gui Makefile.am,NONE,1.1 component.cxx,NONE,1.1 root_gui_manager.cxx,NONE,1.1 root_gui_manager.hxx,NONE,1.1 surface_button.cxx,NONE,1.1 surface_button.hxx,NONE,1.1 button.hxx,1.1,1.2 component.hxx,1.1,1.2 gui_manager.cxx,1.1,1.2 gui_manager.hxx,1.1,1.2
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.5,1.6 button_panel.hxx,1.4,1.5 client.cxx,1.6,1.7 multiplayer_client_child.cxx,1.4,1.5 smallmap.cxx,1.6,1.7 smallmap.hxx,1.5,1.6
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/gui Makefile.am,NONE,1.1 component.cxx,NONE,1.1 root_gui_manager.cxx,NONE,1.1 root_gui_manager.hxx,NONE,1.1 surface_button.cxx,NONE,1.1 surface_button.hxx,NONE,1.1 button.hxx,1.1,1.2 component.hxx,1.1,1.2 gui_manager.cxx,1.1,1.2 gui_manager.hxx,1.1,1.2
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.5,1.6 button_panel.hxx,1.4,1.5 client.cxx,1.6,1.7 multiplayer_client_child.cxx,1.4,1.5 smallmap.cxx,1.6,1.7 smallmap.hxx,1.5,1.6
- Index(es):