[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src client.cxx,1.30,1.31 client.hxx,1.23,
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src client.cxx,1.30,1.31 client.hxx,1.23,1.24 gui_screen.cxx,1.12,1.13 gui_screen.hxx,1.12,1.13 input_debug_screen.cxx,1.4,1.5 playfield.cxx,1.27,1.28 |
Date: |
28 Oct 2002 20:13:42 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv28932
Modified Files:
client.cxx client.hxx gui_screen.cxx gui_screen.hxx
input_debug_screen.cxx playfield.cxx
Log Message:
hooked up scroll events in the client, fixed axis_scroller
Index: client.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/client.cxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- client.cxx 12 Oct 2002 00:49:09 -0000 1.30
+++ client.cxx 28 Oct 2002 20:13:40 -0000 1.31
@@ -38,6 +38,12 @@
#include "button_panel.hxx"
#include "screen_manager.hxx"
#include "gui/gui_manager.hxx"
+// Input
+#include "input/controller.hxx"
+#include "input/event.hxx"
+#include "input/axis_event.hxx"
+#include "input/scroll_event.hxx"
+
Client::Client (TrueServer * s)
: server (s),
@@ -101,112 +107,54 @@
Client::update (const GameDelta& delta)
{
GUIScreen::update (delta);
+ process_events(delta);
}
-#if 0
void
-Client::process_events ()
+Client::process_events (const GameDelta& delta)
{
- std::list<Input::Event*>& events = input_controller->get_events ();
+ const std::list<Input::Event*>& events = delta.get_events ();
- for (std::list<Input::Event*>::iterator i = events.begin (); i != events.end
(); ++i)
+ for (std::list<Input::Event*>::const_iterator i = events.begin ();
+ i != events.end ();
+ ++i)
{
//std::cout << "Events: " << (*i)->get_type () << std::endl;
switch ((*i)->get_type ())
{
case Input::ButtonEventType:
- process_button_event (static_cast<class Input::ButtonEvent*>(*i));
+ // Ignore, is handled in GUIScreen
+ //process_button_event (dynamic_cast<class Input::ButtonEvent*
const>(*i));
break;
case Input::PointerEventType:
- process_pointer_event (static_cast<class Input::PointerEvent*>(*i));
+ // Ignore, is handled in GUIScreen
+ //process_pointer_event (dynamic_cast<class Input::PointerEvent*
const>(*i));
break;
case Input::AxisEventType:
- process_axis_event (static_cast<class Input::AxisEvent*>(*i));
+ // ???
+ process_axis_event (dynamic_cast<Input::AxisEvent* const>(*i));
break;
+ case Input::ScrollEventType:
+ process_scroll_event(dynamic_cast<Input::ScrollEvent* const>(*i));
+ break;
+
default:
// unhandled event
- //std::cout << "Client::process_events (): unhandled event: " <<
(*i)->get_type() << std::endl;
+ std::cout << "Client::process_events (): unhandled event: " <<
(*i)->get_type() << std::endl;
break;
}
}
}
void
-Client::process_button_event (Input::ButtonEvent* event)
-{
- std::cout << "Client::process_button_event (): " << event->name << " " <<
event->state << std::endl;
-
- switch (event->name)
- {
- case Input::primary:
- {
- if (event->state == Input::pressed)
- {
- //GuiObj* obj = get_gui_object (int(event->x), int(event->y));
- //obj->on_mouse_press ();
- }
- else
- {
- //GuiObj* obj = get_gui_object (int(event->x), int(event->y));
- //obj->on_mouse_leave ();
- }
- }
- break;
- case Input::secondary:
- break;
- default:
- break;
- }
-}
-
-void
-Client::process_pointer_event (Input::PointerEvent* event)
+Client::process_scroll_event (Input::ScrollEvent* ev)
{
- if (event->type == 1)
- std::cout << "Client::process_pointer_event (): "
- << event->x << " " << event->y << " "
- << event->type << std::endl;
-
- switch (event->type)
- {
- /*
-
- case Input::scroll: // FIXME: incorrect enum name
- {
- GuiObj* obj = get_gui_object (int(event->x), int(event->y));
- if (obj)
- {
- if (obj != current_gui_obj)
- {
- current_gui_obj = obj;
- obj->on_mouse_enter();
- }
- else
- {
- if (current_gui_obj) current_gui_obj->on_mouse_leave();
- current_gui_obj = 0;
- }
- }
- else
- {
- if (current_gui_obj) current_gui_obj->on_mouse_leave();
- current_gui_obj = 0;
- }
- }
- break;
- */
-
- //se Input::scroll:
- //reak;
-
- //default:
- //std::cout << "Client::process_pointer_event: unhandled event" <<
std::endl;
- //break;
- }
+ std::cout << "Client::process_scroll_event ()" << std::endl;
+ playfield->scroll(ev->x_delta, ev->y_delta);
}
void
@@ -214,13 +162,6 @@
{
std::cout << "Client::process_axis_event ()" << std::endl;
}
-
-void
-Client::send_next_event()
-{
-}
-#endif
-
bool
Client::replay()
Index: client.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/client.hxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- client.hxx 4 Oct 2002 16:54:03 -0000 1.23
+++ client.hxx 28 Oct 2002 20:13:40 -0000 1.24
@@ -31,6 +31,7 @@
class Controller;
class ButtonEvent;
class PointerEvent;
+class ScrollEvent;
class AxisEvent;
} // namespace Input
@@ -109,6 +110,10 @@
void on_action_axis_move (float);
private:
+ void process_events (const GameDelta& events);
+ void process_scroll_event (Input::ScrollEvent*);
+ void process_axis_event (Input::AxisEvent*);
+
Client (const Client&);
Client& operator= (const Client&);
};
Index: gui_screen.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui_screen.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gui_screen.cxx 3 Oct 2002 12:33:08 -0000 1.12
+++ gui_screen.cxx 28 Oct 2002 20:13:40 -0000 1.13
@@ -95,7 +95,7 @@
}
void
-GUIScreen::process_button_event (Input::ButtonEvent* event)
+GUIScreen::process_button_event (const Input::ButtonEvent* event)
{
//std::cout << "GUIScreen::process_button_event (Input::ButtonEvent* event)"
<< std::endl;
Index: gui_screen.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui_screen.hxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gui_screen.hxx 3 Oct 2002 12:33:08 -0000 1.12
+++ gui_screen.hxx 28 Oct 2002 20:13:40 -0000 1.13
@@ -65,7 +65,7 @@
virtual void on_action_axis_move (float) {}
private:
- void process_button_event (Input::ButtonEvent* event);
+ void process_button_event (const Input::ButtonEvent* event);
GUIScreen (const GUIScreen&);
GUIScreen& operator= (const GUIScreen&);
Index: input_debug_screen.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input_debug_screen.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- input_debug_screen.cxx 1 Oct 2002 21:48:32 -0000 1.4
+++ input_debug_screen.cxx 28 Oct 2002 20:13:40 -0000 1.5
@@ -17,10 +17,14 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <ClanLib/Core/System/system.h>
#include <iostream>
#include "input/event.hxx"
+#include "input/scroll_event.hxx"
#include "input_debug_screen.hxx"
+using namespace Input;
+
InputDebugScreen::InputDebugScreen ()
{
}
@@ -34,6 +38,7 @@
InputDebugScreen::draw (GraphicContext& gc)
{
std::cout << "InputDebugScreen::draw ()" << std::endl;
+ CL_System::sleep(100);
UNUSED_ARG(gc);
return true;
}
@@ -47,7 +52,33 @@
i != delta.get_events ().end ();
++i)
{
- std::cout << "Event: " << (*i)->get_type() << std::endl;
+ switch((*i)->get_type())
+ {
+ case ButtonEventType:
+ std::cout << "InputDebugScreen: Button event : " << (*i)->get_type()
<< std::endl;
+ break;
+
+ case PointerEventType:
+ std::cout << "InputDebugScreen: Pointer event : " <<
(*i)->get_type() << std::endl;
+ break;
+
+ case AxisEventType:
+ std::cout << "InputDebugScreen: Axis event : " << (*i)->get_type()
<< std::endl;
+
+ break;
+ case ScrollEventType:
+ {
+ ScrollEvent* ev = dynamic_cast<ScrollEvent*>(*i);
+ assert(ev);
+ std::cout << "InputDebugScreen: Scroll event : "
+ << ev->x_delta << " " << ev->y_delta << std::endl;
+ }
+ break;
+
+ default:
+ std::cout << "InputDebugScreen: Unknown event : " <<
(*i)->get_type() << std::endl;
+ break;
+ }
}
}
Index: playfield.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/playfield.cxx,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- playfield.cxx 12 Oct 2002 00:49:10 -0000 1.27
+++ playfield.cxx 28 Oct 2002 20:13:40 -0000 1.28
@@ -312,8 +312,8 @@
void
Playfield::scroll (int x, int y)
{
- UNUSED_ARG(x);
- UNUSED_ARG(y);
+ view[current_view]->shift_x_offset(x);
+ view[current_view]->shift_y_offset(y);
}
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src client.cxx,1.30,1.31 client.hxx,1.23,1.24 gui_screen.cxx,1.12,1.13 gui_screen.hxx,1.12,1.13 input_debug_screen.cxx,1.4,1.5 playfield.cxx,1.27,1.28,
grumbel <=