[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3614 - trunk/pingus/src/components
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3614 - trunk/pingus/src/components |
Date: |
Tue, 1 Jul 2008 16:12:47 +0200 |
Author: grumbel
Date: 2008-07-01 16:12:46 +0200 (Tue, 01 Jul 2008)
New Revision: 3614
Modified:
trunk/pingus/src/components/action_button.cpp
trunk/pingus/src/components/action_button.hpp
trunk/pingus/src/components/button_panel.cpp
Log:
Merged VerticalActionButton and ActionButton
Modified: trunk/pingus/src/components/action_button.cpp
===================================================================
--- trunk/pingus/src/components/action_button.cpp 2008-07-01 03:54:56 UTC
(rev 3613)
+++ trunk/pingus/src/components/action_button.cpp 2008-07-01 14:12:46 UTC
(rev 3614)
@@ -32,10 +32,16 @@
using namespace Actions;
+
+ActionButton::ActionButton(ActionHolder* h,
+ int x, int y, ActionName name_, int owner_id)
+ : action_holder(h),
+ background (Resource::load_sprite("core/buttons/buttonbackground")),
+ backgroundhl (Resource::load_sprite("core/buttons/buttonbackgroundhl"))
+{
+ init(x, y, name_, owner_id);
+}
-ActionButton::ActionButton(ActionHolder* h)
-: action_holder(h){}
-
ActionButton::~ActionButton() {}
void
@@ -65,19 +71,8 @@
return name;
}
-VerticalActionButton::VerticalActionButton(ActionHolder* h,
- int x, int y, ActionName name_, int
owner_id)
- : ActionButton(h),
- background (Resource::load_sprite("core/buttons/buttonbackground")),
- backgroundhl (Resource::load_sprite("core/buttons/buttonbackgroundhl"))
-{
- init(x, y, name_, owner_id);
-}
-
-VerticalActionButton::~VerticalActionButton () {}
-
bool
-VerticalActionButton::is_at (int x, int y)
+ActionButton::is_at (int x, int y)
{
if (x > x_pos && x < x_pos + 60
&& y > y_pos && y <= y_pos + 35)
@@ -91,7 +86,7 @@
}
void
-VerticalActionButton::draw (DrawingContext& gc)
+ActionButton::draw (DrawingContext& gc)
{
if (pressed)
{
@@ -150,7 +145,7 @@
gc.print_center(myfont, x_pos + 46, y_pos + 5, str);
}
}
-
+
ArmageddonButton::ArmageddonButton(Server* s, int x, int y)
: server (s),
x_pos (x),
@@ -326,6 +321,5 @@
UNUSED_ARG(x);
UNUSED_ARG(y);
}
-
-
+
/* EOF */
Modified: trunk/pingus/src/components/action_button.hpp
===================================================================
--- trunk/pingus/src/components/action_button.hpp 2008-07-01 03:54:56 UTC
(rev 3613)
+++ trunk/pingus/src/components/action_button.hpp 2008-07-01 14:12:46 UTC
(rev 3614)
@@ -60,9 +60,7 @@
ArmageddonButton (const ArmageddonButton&);
ArmageddonButton& operator= (const ArmageddonButton&);
};
-
-// ----------------- snip --------------------
-
+
/** Fast Forward button, press it to let the game run faster, press it
again to return to normal speed
@@ -89,9 +87,7 @@
ForwardButton (const ForwardButton&);
ForwardButton& operator= (const ForwardButton&);
};
-
-// ----------------- snip --------------------
-
+
/** Pause button, press it to pause the game, press it again to
continue
@@ -118,15 +114,17 @@
PauseButton (const PauseButton&);
PauseButton& operator= (const PauseButton&);
};
-
-// ----------------- snip --------------------
-
+
/** The button class manage a simple button for the button_panel. It
keeps his position, his surfaces and his font. */
class ActionButton : public GUI::Component
{
protected:
+ ActionHolder* action_holder;
Sprite sprite;
+ Sprite background;
+ Sprite backgroundhl;
+
int x_pos;
int y_pos;
Font font;
@@ -136,54 +134,27 @@
Actions::ActionName name;
bool is_multi_direct;
- ActionHolder* action_holder;
-
public:
bool pressed;
- ActionButton(ActionHolder*);
+ ActionButton(ActionHolder* h, int x, int y, Actions::ActionName name_, int
owner_id);
virtual ~ActionButton();
void init(int x, int y, Actions::ActionName name_, int owner_id);
- /// Not used.
+ void draw(DrawingContext& gc);
void update(float delta);
/// Returns the name of the action the button represents.
Actions::ActionName get_action_name();
- virtual bool is_at(int x, int y) = 0;
+ bool is_at(int x, int y);
private:
ActionButton (const ActionButton&);
ActionButton& operator= (const ActionButton&);
};
-// ----------------- snip --------------------
-
-/** Button which represents an action, one you click it the current
- action will be set to the action represented by the button.
-
- \sa Client */
-class VerticalActionButton : public ActionButton
-{
-private:
- Sprite background;
- Sprite backgroundhl;
-
-public:
- VerticalActionButton(ActionHolder* h, int x, int y, Actions::ActionName
name, int owner_id);
- virtual ~VerticalActionButton();
-
- void draw(DrawingContext& gc);
- bool is_at (int x, int y);
-
-private:
- VerticalActionButton (const VerticalActionButton&);
- VerticalActionButton& operator= (const VerticalActionButton&);
-};
-
-
#endif /* ACTIONBUTTON */
/* EOF */
Modified: trunk/pingus/src/components/button_panel.cpp
===================================================================
--- trunk/pingus/src/components/button_panel.cpp 2008-07-01 03:54:56 UTC
(rev 3613)
+++ trunk/pingus/src/components/button_panel.cpp 2008-07-01 14:12:46 UTC
(rev 3614)
@@ -53,10 +53,10 @@
for(std::vector<ActionName>::iterator i = actions.begin();
i != actions.end(); ++i)
{
- a_buttons.push_back(new VerticalActionButton (aholder,
- x_pos, int(i -
actions.begin()) * 38 + y_pos,
- *i,
- 0));
//FIXMEcontroller->get_owner ()));
+ a_buttons.push_back(new ActionButton (aholder,
+ x_pos, int(i - actions.begin()) *
38 + y_pos,
+ *i,
+ 0)); //FIXMEcontroller->get_owner
()));
}
if (a_buttons.empty())
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3614 - trunk/pingus/src/components,
grumbel at BerliOS <=