[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.123,1.124 action_button
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.123,1.124 action_button.cxx,1.21,1.22 action_button.hxx,1.15,1.16 button_panel.hxx,1.15,1.16 anim_counter.cxx,1.1,NONE anim_counter.hxx,1.4,NONE |
Date: |
1 Dec 2002 17:45:24 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv15977
Modified Files:
Makefile.am action_button.cxx action_button.hxx
button_panel.hxx
Removed Files:
anim_counter.cxx anim_counter.hxx
Log Message:
- more old cruft removed
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Makefile.am,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- Makefile.am 1 Dec 2002 17:08:47 -0000 1.123
+++ Makefile.am 1 Dec 2002 17:45:21 -0000 1.124
@@ -72,8 +72,6 @@
input/scrollers/libpingus_input_scrollers.a
pingus_SOURCES = \
-anim_counter.hxx \
-anim_counter.cxx \
action_button.cxx \
action_button.hxx \
action_data.hxx \
Index: action_button.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_button.cxx,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- action_button.cxx 8 Nov 2002 01:38:27 -0000 1.21
+++ action_button.cxx 1 Dec 2002 17:45:21 -0000 1.22
@@ -27,6 +27,8 @@
#include "action_button.hxx"
#include "true_server.hxx"
#include "world.hxx"
+#include "vector.hxx"
+#include "graphic_context.hxx"
#include "string_converter.hxx"
using namespace Actions;
@@ -43,37 +45,20 @@
x_pos = x;
y_pos = y;
name = name_;
-
- if ( name == Digger || name == Bomber
- || name == Floater || name == Blocker)
- {
- is_multi_direct = false;
- }
- else
- {
- is_multi_direct = true;
- }
- /*
- font = PingusResource::load_font("Fonts/courier_small", "fonts");
- font_h = PingusResource::load_font("Fonts/smallfont","fonts");
- font_b = PingusResource::load_font("Fonts/pingus","fonts");
- */
font = PingusResource::load_font("Fonts/pingus_small", "fonts");
font_b = PingusResource::load_font("Fonts/pingus", "fonts");
- surface = PingusResource::load_surface("Pingus/" + action_to_string(name) +
to_string(owner_id), "pingus");
- if (is_multi_direct)
- {
- action_c.set_size(surface.get_num_frames()/2);
- }
- else
+ sprite = Sprite("Pingus/" + action_to_string(name) + to_string(owner_id),
"pingus", 20.0f);
+ sprite.set_align_center_bottom();
+
+ // FIXME: Big fat hack
+ if ( name == Digger || name == Bomber
+ || name == Floater || name == Blocker)
{
- action_c.set_size(surface.get_num_frames());
+ sprite.set_direction(Sprite::LEFT);
}
-
- action_c.set_speed(50);
}
bool
@@ -85,8 +70,7 @@
void
ActionButton::update(float delta)
{
- ++action_c;
- UNUSED_ARG(delta);
+ sprite.update(delta);
}
ActionName
@@ -138,8 +122,8 @@
}
else
{
- action_c = 0;
-
+ sprite.set_frame(0);
+
if (fast_mode) {
// do nothing
} else {
@@ -148,9 +132,7 @@
}
- surface.put_screen(x_pos + 20 - surface.get_width ()/2,
- y_pos + 17 - surface.get_height()/2,
- action_c);
+ gc.draw(sprite, Vector(x_pos, y_pos));
// print the action name next to the button, when mouse pointer is on
// the button.
@@ -182,9 +164,7 @@
backgroundhl(PingusResource::load_surface("buttons/hbuttonbg", "core"))
{
pressed = false;
- surface = PingusResource::load_surface("buttons/armageddon_anim",
"core");
- counter.set_size(surface.get_num_frames());
- counter = 0;
+ sprite = Sprite("buttons/armageddon_anim", "core");
}
ArmageddonButton::~ArmageddonButton () { }
@@ -195,21 +175,22 @@
if (server->get_world()->check_armageddon ())
{
backgroundhl.put_screen (x_pos, y_pos);
- surface.put_screen(x_pos, y_pos, ++counter);
+ gc.draw(sprite, Vector(x_pos, y_pos));
}
else
{
if (!fast_mode)
background.put_screen (x_pos, y_pos);
- surface.put_screen(x_pos, y_pos, 7);
+ sprite.set_frame(7);
+ gc.draw(sprite, Vector(x_pos, y_pos));
}
-
- UNUSED_ARG(gc);
}
void
ArmageddonButton::update (float delta)
{
+ sprite.update(delta);
+
if (pressed)
{
press_time += delta;
@@ -229,8 +210,8 @@
bool
ArmageddonButton::is_at(int x, int y)
{
- if (x > x_pos && x < x_pos + int(surface.get_width())
- && y > y_pos && y < y_pos + int(surface.get_height()))
+ if (x > x_pos && x < x_pos + sprite.get_width()
+ && y > y_pos && y < y_pos + sprite.get_height())
{
return true;
} else {
Index: action_button.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_button.hxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- action_button.hxx 8 Nov 2002 01:38:27 -0000 1.15
+++ action_button.hxx 1 Dec 2002 17:45:21 -0000 1.16
@@ -22,8 +22,8 @@
#include <ClanLib/Display/Display/surface.h>
#include <string>
-#include "anim_counter.hxx"
#include "pingu_enums.hxx"
+#include "sprite.hxx"
#include "gui/component.hxx"
using Actions::ActionName;
@@ -41,15 +41,14 @@
{
private:
TrueServer* server;
- int x_pos;
- int y_pos;
- bool pressed;
+ int x_pos;
+ int y_pos;
+ bool pressed;
float press_time;
- CL_Surface surface;
+ Sprite sprite;
CL_Surface background;
CL_Surface backgroundhl;
- AnimCounter counter;
friend class ButtonPanel;
public:
ArmageddonButton(TrueServer*, int x, int y);
@@ -130,7 +129,7 @@
class ActionButton : public GUI::Component
{
protected:
- CL_Surface surface;
+ Sprite sprite;
int x_pos;
int y_pos;
CL_Font* font;
@@ -141,7 +140,7 @@
bool is_multi_direct;
ActionHolder* action_holder;
- AnimCounter action_c;
+
public:
bool pressed;
Index: button_panel.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/button_panel.hxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- button_panel.hxx 8 Nov 2002 01:38:27 -0000 1.15
+++ button_panel.hxx 1 Dec 2002 17:45:22 -0000 1.16
@@ -41,7 +41,6 @@
int pressed_button;
int armageddon_pressed;
- AnimCounter arma_counter;
bool left_pressed;
unsigned int last_press;
--- anim_counter.cxx DELETED ---
--- anim_counter.hxx DELETED ---
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.123,1.124 action_button.cxx,1.21,1.22 action_button.hxx,1.15,1.16 button_panel.hxx,1.15,1.16 anim_counter.cxx,1.1,NONE anim_counter.hxx,1.4,NONE,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,1.4,1.5 liquid.hxx,1.3,1.4
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs entrance_obj.cxx,1.3,1.4 entrance_obj.hxx,1.2,1.3
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,1.4,1.5 liquid.hxx,1.3,1.4
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs entrance_obj.cxx,1.3,1.4 entrance_obj.hxx,1.2,1.3
- Index(es):