Some drastic refactoring to reduce complexity for buttons, but now all the primary buttons always look selected...

This commit is contained in:
2011-07-06 17:25:12 -04:00
parent 8a4ed42ab1
commit 825a3f8e4a
6 changed files with 78 additions and 74 deletions

View File

@ -14,17 +14,23 @@
using std::string;
// fixme: there's probably a better way to do this, but SDL's event model
// has me hard-pressed to figure out what it is.
enum ButtonAction {BUTTON_BUILD=0x1, BUTTON_ATTACK=0x2, BUTTON_MOVE=0x4,
BUTTON_BUILD_ATTACKER=0x8, BUTTON_BUILD_DEFENDER=0x10,
BUTTON_BUILD_PRODUCER=0x20, BUTTON_END_TURN=0x40};
enum CustomButtonAction {BUTTON_NONE=0x0, BUTTON_END_TURN=0x1};
class ButtonAction
{
public:
ButtonAction();
Mode mode;
VertexType type;
CustomButtonAction action;
};
class MenuButton : public Entity
{
public:
MenuButton(string text = "", TTF_Font* font = NULL, int x = 0, int y = 0,
ButtonAction action = BUTTON_BUILD, int colour=0x000000,
MenuButton(ButtonAction action, string text = "", TTF_Font* font = NULL,
int x = 0, int y = 0, int colour=0x000000,
int hover_colour=0xff0000, int selected_colour=0x0000ff,
int background_colour=0x888888);