1 /***************************************************************************
2 button.h - graphical buttons
5 copyright : (C) 2004 by Ricardo Cruz
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #ifndef SUPERTUX_BUTTON_H
19 #define SUPERTUX_BUTTON_H
24 #include "../math/vector.h"
25 #include "../video/drawing_context.h"
42 Button(Surface* image_, std::string info_, SDLKey binding_);
45 void draw(DrawingContext& context, bool selected);
46 int event(SDL_Event& event, int x_offset = 0, int y_offset = 0);
48 static Font* info_font;
51 friend class ButtonGroup;
66 ButtonGroup(Vector pos_, Vector size_, Vector button_box_);
69 void draw(DrawingContext& context);
70 bool event(SDL_Event& event);
72 void add_button(Button button, int id, bool select = false);
73 void add_pair_of_buttons(Button button1, int id1, Button button2, int id2);
76 void set_unselected();
80 Vector pos, buttons_size, buttons_box;
81 typedef std::vector <Button> Buttons;
84 int button_selected, row;
85 bool mouse_hover, mouse_left_button;
90 } //namespace SuperTux