Argentum Online - Cliente
option_button.h
1 #ifndef __OPTION_BUTTON_H
2 #define __OPTION_BUTTON_H
3 
4 #include "../../engine/UI/button.h"
5 #include "../../engine/sound_system.h"
6 
12 template <typename T>
13 class OptionButton : public Button {
14  private:
15  T this_button_option;
16  T& selected_option;
17 
18  public:
29  OptionButton(SDL_Rect button_area, SDL_Rect viewport,
30  SDL_Renderer* renderer, T this_button_option,
31  T& selected_option)
32  : Button(button_area, viewport, renderer),
33  this_button_option(this_button_option),
34  selected_option(selected_option) {}
35 
40  void on_click() override {
41  selected_option = this_button_option;
42  SoundSystem::get_instance().play_ui_sfx(3);
43  }
44 };
45 
46 #endif
OptionButton::OptionButton
OptionButton(SDL_Rect button_area, SDL_Rect viewport, SDL_Renderer *renderer, T this_button_option, T &selected_option)
Boton perteneciente a opciones multiples.
Definition: option_button.h:29
Button
Boton abstracto. Todos los botones heredan de esta clase.
Definition: button.h:10
OptionButton
Boton de seleccion de opcion.
Definition: option_button.h:13
OptionButton::on_click
void on_click() override
Setea la seleccion a la opcion representada por este boton.
Definition: option_button.h:40
SoundSystem::play_ui_sfx
void play_ui_sfx(int id)
Reproduce un efecto de sonido.
Definition: sound_system.cpp:23