[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src client.cxx,1.8,1.9 hurry_up.hxx,1.2,1
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src client.cxx,1.8,1.9 hurry_up.hxx,1.2,1.3 pingus_counter.hxx,1.4,1.5 playfield.cxx,1.8,1.9 playfield.hxx,1.6,1.7 smallmap.cxx,1.7,1.8 time_display.hxx,1.3,1.4 view.cxx,1.4,1.5 view.hxx,1.3,1.4 |
Date: |
2 Aug 2002 11:53:54 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv30001
Modified Files:
client.cxx hurry_up.hxx pingus_counter.hxx playfield.cxx
playfield.hxx smallmap.cxx time_display.hxx view.cxx view.hxx
Log Message:
more fixes to the client, its basically playable again, even so escape
handling, armageddon and Co. are still unusable
Index: client.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/client.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- client.cxx 2 Aug 2002 11:25:46 -0000 1.8
+++ client.cxx 2 Aug 2002 11:53:52 -0000 1.9
@@ -76,7 +76,8 @@
Display::set_cursor(CL_MouseCursorProvider::load("Cursors/cursor",
PingusResource::get("game")));
-
+
+ // These object will get deleted by the gui_manager
button_panel = new ButtonPanel(server->get_plf (), 2,
CL_Display::get_height()/2);
playfield = new Playfield(this, server->get_plf (), server->get_world());
hurry_up = new HurryUp();
@@ -91,38 +92,27 @@
small_map->set_client(this);
time_display->set_server(server);
- gui_manager->add (small_map);
- gui_manager->add (button_panel);
+ gui_manager->add (playfield, true);
+ gui_manager->add (button_panel, true);
+ gui_manager->add (hurry_up, true);
+ gui_manager->add (pcounter, true);
+ gui_manager->add (small_map, true);
+ gui_manager->add (time_display, true);
/*playfield->set_clip_rect(0, 0,
CL_Display::get_width(),
- CL_Display::get_height());
+ CL_Display::get_height());*/
// Connect the button_panel with the playfield
playfield->set_buttons(button_panel);
playfield->set_server(server);
playfield->set_client(this);
- */
- // Adding all GuiObj's to the screen
- //obj.push_back(playfield);
- //obj.push_back(pcounter);
- //obj.push_back(time_display);
- //obj.push_back(hurry_up);
-
+
if (verbose) std::cout << "done " << timer.stop() << std::endl;
}
Client::~Client()
{
- //Display::remove_flip_screen_hook(cursor);
-
- //delete playfield;
- //delete button_panel;
- //delete pcounter;
- //delete small_map;
- //delete time_display;
- //delete hurry_up;
- // delete cursor;
}
void
@@ -146,9 +136,9 @@
//send_next_event();
/*float wannabe_delta = 0.0333f;
- unsigned int frames = 1;
- bool auto_frame_skip = false;
- float current_delta;*/
+ unsigned int frames = 1;
+ bool auto_frame_skip = false;
+ float current_delta;*/
if (server->is_finished())
{
@@ -157,24 +147,24 @@
}
/*
- CL_System::keep_alive ();
- CL_System::sleep (0);
+ CL_System::keep_alive ();
+ CL_System::sleep (0);
- if (current_delta > wannabe_delta)
+ if (current_delta > wannabe_delta)
{
- update (delta.getset ());
- ++frames;
- if (frames % int(frame_skip) == 0)
- {
- if (!auto_frame_skip)
- {
- draw ();
- }
- }
- else
- {
- CL_System::sleep (int(1000 * (wannabe_delta - delta.get ())));
- }
+ update (delta.getset ());
+ ++frames;
+ if (frames % int(frame_skip) == 0)
+ {
+ if (!auto_frame_skip)
+ {
+ draw ();
+ }
+ }
+ else
+ {
+ CL_System::sleep (int(1000 * (wannabe_delta - delta.get ())));
+ }
}*/
}
@@ -248,32 +238,32 @@
switch (event->type)
{
- /*
+ /*
- case Input::scroll: // FIXME: incorrect enum name
+ 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;
- }
+ 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;
Index: hurry_up.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/hurry_up.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- hurry_up.hxx 24 Jun 2002 22:52:54 -0000 1.2
+++ hurry_up.hxx 2 Aug 2002 11:53:52 -0000 1.3
@@ -20,13 +20,13 @@
#ifndef HEADER_PINGUS_HURRY_UP_HXX
#define HEADER_PINGUS_HURRY_UP_HXX
-#include "gui_obj.hxx"
+#include "gui/component.hxx"
class CL_Font;
class Client;
/** Hurry up if the time goes over... */
-class HurryUp : public GuiObj
+class HurryUp : public GUI::Component
{
private:
CL_Font* font;
Index: pingus_counter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_counter.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pingus_counter.hxx 2 Jul 2002 15:46:58 -0000 1.4
+++ pingus_counter.hxx 2 Aug 2002 11:53:52 -0000 1.5
@@ -21,31 +21,25 @@
#define HEADER_PINGUS_PINGUS_COUNTER_HXX
#include <ClanLib/Display/Display/surface.h>
-#include "gui_obj.hxx"
+#include "gui/component.hxx"
class CL_Font;
class World;
class Client;
-///
-class PingusCounter : public GuiObj
+class PingusCounter : public GUI::Component
{
private:
- ///
CL_Font* font;
CL_Surface background;
- ///
Client* client;
public:
- ///
PingusCounter();
+ virtual ~PingusCounter() {}
- ///
void draw(void);
- ///
void set_client(Client*);
-}///
-;
+};
#endif
Index: playfield.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/playfield.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- playfield.cxx 2 Aug 2002 11:25:47 -0000 1.8
+++ playfield.cxx 2 Aug 2002 11:53:52 -0000 1.9
@@ -147,22 +147,11 @@
world = w;
}
-void
-Playfield::process_input()
-{
- process_input_interactive();
-}
-
-void
-Playfield::process_input_demomode()
-{
-}
-
+#if 0
void
Playfield::process_input_interactive()
{
// FIXME: This should be replaced with something getting relative mouse co's
-#if 0
if (auto_scrolling)
{
scroll_speed = 30;
@@ -185,37 +174,27 @@
view[current_view]->set_y_offset(view[current_view]->get_y_offset() -
scroll_speed);
}
}
-#endif
-}
-
-///
-void
-Playfield::updateX()
-{
- process_input();
- do_scrolling();
}
+#endif
void
Playfield::update(float /*delta*/)
{
-#if 0
for(unsigned int i=0; i < view.size(); ++i)
{
if (view[i]->is_current() && !mouse_scrolling)
{
current_view = i;
- current_pingu = current_pingu_find(controller->get_x() -
view[i]->get_x_pos() - (view[i]->get_x_offset()),
- controller->get_y() -
view[i]->get_y_pos() - (view[i]->get_y_offset()));
+ current_pingu = current_pingu_find(mouse_x - view[i]->get_x_pos() -
(view[i]->get_x_offset()),
+ mouse_y - view[i]->get_y_pos() -
(view[i]->get_y_offset()));
view[i]->set_pingu(current_pingu);
break;
}
}
-#endif
}
-bool
-Playfield::on_button_press(const CL_Key & /*key*/)
+void
+Playfield::on_button_press(int x, int y)
{
if (current_pingu)
{
@@ -223,9 +202,15 @@
sprintf(str, "Pingu: %d:%s", current_pingu->get_id(),
action_to_string(buttons->get_action_name()).c_str());
server->send_event(str);
- return true;
}
- return false;
+}
+
+void
+Playfield::on_pointer_move (int x, int y)
+{
+ // FIXME: useless stuff, but currently the controller doesn't have a state
+ mouse_x = x;
+ mouse_y = y;
}
void
Index: playfield.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/playfield.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- playfield.hxx 2 Aug 2002 11:25:47 -0000 1.6
+++ playfield.hxx 2 Aug 2002 11:53:52 -0000 1.7
@@ -68,6 +68,8 @@
std::vector<Rect> clipping_rectangles;
+ int mouse_x;
+ int mouse_y;
public:
Playfield(Client*, PLF* plf, World*);
virtual ~Playfield();
@@ -81,14 +83,11 @@
void draw();
void update(float delta);
- void updateX();
- void process_input();
- void process_input_interactive();
- void process_input_demomode();
void set_world(World*);
Pingu* current_pingu_find(int x_pos, int y_pos);
- bool on_button_press(const CL_Key &key);
+ void on_button_press (int x, int y);
+ void on_pointer_move (int x, int y);
void enable_scroll_mode();
void do_scrolling();
@@ -101,6 +100,8 @@
void set_buttons(ButtonPanel*);
void set_server(Server*);
void set_client(Client*);
+
+ bool is_at (int x, int y) { return true; }
};
#endif
Index: smallmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/smallmap.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- smallmap.cxx 29 Jul 2002 11:57:38 -0000 1.7
+++ smallmap.cxx 2 Aug 2002 11:53:52 -0000 1.8
@@ -242,6 +242,13 @@
SmallMap::on_button_press(int x, int y)
{
scroll_mode = true;
+
+ // set view to the given COs
+ int cx, cy;
+ ColMap* colmap = client->get_server()->get_world()->get_colmap();
+ cx = (x - x_pos) * int(colmap->get_width()) / width;
+ cy = (y - y_pos) * int(colmap->get_height()) / height ;
+ client->get_playfield()->set_viewpoint(cx, cy);
}
void
Index: time_display.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/time_display.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- time_display.hxx 2 Jul 2002 15:46:58 -0000 1.3
+++ time_display.hxx 2 Aug 2002 11:53:52 -0000 1.4
@@ -20,26 +20,21 @@
#ifndef HEADER_PINGUS_TIME_DISPLAY_HXX
#define HEADER_PINGUS_TIME_DISPLAY_HXX
-#include "gui_obj.hxx"
+#include "gui/component.hxx"
class CL_Font;
class Server;
-///
-class TimeDisplay : public GuiObj
+class TimeDisplay : public GUI::Component
{
private:
- ///
Server* server;
- ///
CL_Font* font;
public:
- ///
TimeDisplay();
+ virtual ~TimeDisplay() {}
- ///
void draw();
- ///
void set_server(Server*);
};
Index: view.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/view.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- view.cxx 24 Jun 2002 14:25:03 -0000 1.4
+++ view.cxx 2 Aug 2002 11:53:52 -0000 1.5
@@ -19,7 +19,7 @@
#include <assert.h>
#include <ClanLib/Display/Display/display.h>
-#include "mouse_controller.hxx"
+#include <ClanLib/Core/Math/cl_vector.h>
#include "view.hxx"
#include "world.hxx"
#include "client.hxx"
@@ -29,8 +29,7 @@
View::View(Client* client, int x1, int y1, int x2, int y2, float s)
: cap (client->get_button_panel ()),
- current_pingu (0),
- controller (new MouseController ())
+ current_pingu (0)
{
assert(world);
@@ -52,8 +51,6 @@
View::~View()
{
- //FIXME: This is dangerous and might cause throuble when the code is
reordered
- delete controller;
}
void
@@ -62,7 +59,7 @@
assert(world);
float color;
- if (is_over(controller->get_x(), controller->get_y()))
+ if (is_over(mouse_x, mouse_y))
{
color = 1.0;
mouse_over = true;
@@ -191,6 +188,13 @@
View::get_center ()
{
return CL_Vector (-x_offset + get_width ()/2, -y_offset + get_height ()/2);
+}
+
+void
+View::on_pointer_move (int x, int y)
+{
+ mouse_x = x;
+ mouse_y = y;
}
/* EOF */
Index: view.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/view.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- view.hxx 24 Jun 2002 22:52:57 -0000 1.3
+++ view.hxx 2 Aug 2002 11:53:52 -0000 1.4
@@ -40,6 +40,9 @@
bool mouse_over;
/// The zoom of the View, 1 is default
double size;
+ int mouse_x;
+ int mouse_y;
+
CaptureRectangle cap;
Pingu* current_pingu;
/// Static objects which are equal for all Views
@@ -47,7 +50,7 @@
///
void make_range();
- Controller* controller;
+
public:
/** @name The position of the View.
@@ -89,6 +92,8 @@
double get_zoom();
void set_pingu(Pingu* p);
static void set_world(World*);
+
+ void on_pointer_move (int x, int y);
};
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src client.cxx,1.8,1.9 hurry_up.hxx,1.2,1.3 pingus_counter.hxx,1.4,1.5 playfield.cxx,1.8,1.9 playfield.hxx,1.6,1.7 smallmap.cxx,1.7,1.8 time_display.hxx,1.3,1.4 view.cxx,1.4,1.5 view.hxx,1.3,1.4,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/gui gui_manager.cxx,1.5,1.6
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src client.cxx,1.9,1.10 client.hxx,1.7,1.8 game_session.cxx,1.3,1.4 game_session.hxx,1.4,1.5 gui_screen.cxx,1.1,1.2 gui_screen.hxx,1.1,1.2 playfield.cxx,1.9,1.10 view.cxx,1.5,1.6 view.hxx,1.4,1.5
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/gui gui_manager.cxx,1.5,1.6
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src client.cxx,1.9,1.10 client.hxx,1.7,1.8 game_session.cxx,1.3,1.4 game_session.hxx,1.4,1.5 gui_screen.cxx,1.1,1.2 gui_screen.hxx,1.1,1.2 playfield.cxx,1.9,1.10 view.cxx,1.5,1.6 view.hxx,1.4,1.5
- Index(es):