mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-29 15:04:23 +01:00
Added dialogue box implementation
This commit is contained in:
parent
1989da1069
commit
dc9418ab4c
4
Makefile
4
Makefile
@ -1,4 +1,4 @@
|
||||
OBJS=menu.oo main.oo utils.oo frodo_menu.oo
|
||||
OBJS=menu.oo main.oo utils.oo frodo_menu.oo dialogue_box.oo
|
||||
|
||||
all: menu
|
||||
|
||||
@ -11,6 +11,8 @@ frodo_menu.oo: frodo_menu.cpp frodo_menu.hh font.hh menu.hh Makefile
|
||||
|
||||
utils.oo: utils.cpp utils.hh Makefile
|
||||
|
||||
dialogue_box.oo: dialogue_box.cpp dialogue_box.hh menu.hh Makefile
|
||||
|
||||
main.oo: menu.hh utils.hh sdl_ttf_font.hh Makefile
|
||||
|
||||
menu: $(OBJS)
|
||||
|
19
dialogue_box.cpp
Normal file
19
dialogue_box.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "dialogue_box.hh"
|
||||
|
||||
DialogueBox::DialogueBox(Font *font, const char *msgs[], int cancel) : Menu(font)
|
||||
{
|
||||
this->m_selected = -1;
|
||||
this->m_cancel = cancel;
|
||||
|
||||
this->setText(msgs, NULL);
|
||||
}
|
||||
|
||||
void DialogueBox::selectCallback(int which)
|
||||
{
|
||||
this->m_selected = this->p_submenus[0].sel;
|
||||
}
|
||||
|
||||
void DialogueBox::escapeCallback(int which)
|
||||
{
|
||||
this->m_selected = this->m_cancel;
|
||||
}
|
24
dialogue_box.hh
Normal file
24
dialogue_box.hh
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef __DIALOGUE_BOX_HH__
|
||||
#define __DIALOGUE_BOX_HH__
|
||||
|
||||
#include "menu.hh"
|
||||
|
||||
class DialogueBox : public Menu
|
||||
{
|
||||
DialogueBox(Font *font, const char *msgs[], int cancel = 1);
|
||||
|
||||
virtual void selectCallback(int which);
|
||||
|
||||
virtual void escapeCallback(int which);
|
||||
|
||||
int selected()
|
||||
{
|
||||
return this->m_selected;
|
||||
}
|
||||
|
||||
private:
|
||||
int m_selected;
|
||||
int m_cancel;
|
||||
};
|
||||
|
||||
#endif /* __DIALOGUE_BOX_HH__ */
|
Loading…
Reference in New Issue
Block a user