mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-29 15:04:23 +01:00
Add highlighted key
This commit is contained in:
parent
2e768d0c67
commit
b94df096f0
10
gui.cpp
10
gui.cpp
@ -67,6 +67,7 @@ Gui::Gui()
|
|||||||
/* Create the views */
|
/* Create the views */
|
||||||
this->mv = new MainView();
|
this->mv = new MainView();
|
||||||
this->dv = new DiscView();
|
this->dv = new DiscView();
|
||||||
|
this->kv = VirtualKeyboard::kbd;
|
||||||
this->pushView(mv);
|
this->pushView(mv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +88,9 @@ bool Gui::setTheme(const char *path)
|
|||||||
this->dialogue_bg = this->loadThemeImage(path, "dialogue_box.png");
|
this->dialogue_bg = this->loadThemeImage(path, "dialogue_box.png");
|
||||||
this->disc_info = this->loadThemeImage(path, "disc_info.png");
|
this->disc_info = this->loadThemeImage(path, "disc_info.png");
|
||||||
|
|
||||||
|
this->highlighted_key = this->loadThemeImage(path, "highlighted_key.png");
|
||||||
|
this->selected_key = this->loadThemeImage(path, "selected_key.png");
|
||||||
|
|
||||||
this->default_font = this->loadThemeFont(path, "font.ttf", 18);
|
this->default_font = this->loadThemeFont(path, "font.ttf", 18);
|
||||||
this->small_font = this->loadThemeFont(path, "font.ttf", 16);
|
this->small_font = this->loadThemeFont(path, "font.ttf", 16);
|
||||||
|
|
||||||
@ -95,6 +99,8 @@ bool Gui::setTheme(const char *path)
|
|||||||
!this->bg_submenu_middle ||
|
!this->bg_submenu_middle ||
|
||||||
!this->dialogue_bg ||
|
!this->dialogue_bg ||
|
||||||
!this->disc_info ||
|
!this->disc_info ||
|
||||||
|
!this->selected_key ||
|
||||||
|
!this->highlighted_key ||
|
||||||
!this->default_font ||
|
!this->default_font ||
|
||||||
!this->small_font)
|
!this->small_font)
|
||||||
{
|
{
|
||||||
@ -110,6 +116,8 @@ bool Gui::setTheme(const char *path)
|
|||||||
SDL_FreeSurface(this->dialogue_bg);
|
SDL_FreeSurface(this->dialogue_bg);
|
||||||
SDL_FreeSurface(this->disc_info);
|
SDL_FreeSurface(this->disc_info);
|
||||||
SDL_FreeSurface(this->textbox);
|
SDL_FreeSurface(this->textbox);
|
||||||
|
SDL_FreeSurface(this->selected_key);
|
||||||
|
SDL_FreeSurface(this->highlighted_key);
|
||||||
|
|
||||||
if (this->default_font)
|
if (this->default_font)
|
||||||
delete this->default_font;
|
delete this->default_font;
|
||||||
@ -119,9 +127,9 @@ bool Gui::setTheme(const char *path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualKeyboard::kbd->setFont(this->default_font);
|
|
||||||
this->mv->updateTheme();
|
this->mv->updateTheme();
|
||||||
this->dv->updateTheme();
|
this->dv->updateTheme();
|
||||||
|
this->kv->updateTheme();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
6
gui.hh
6
gui.hh
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
class MainView;
|
class MainView;
|
||||||
class DiscView;
|
class DiscView;
|
||||||
class KeyboardView;
|
class VirtualKeyboard;
|
||||||
|
|
||||||
class Gui
|
class Gui
|
||||||
{
|
{
|
||||||
@ -63,6 +63,8 @@ public:
|
|||||||
SDL_Surface *disc_info;
|
SDL_Surface *disc_info;
|
||||||
SDL_Surface *bg_left, *bg_right, *bg_middle,
|
SDL_Surface *bg_left, *bg_right, *bg_middle,
|
||||||
*bg_submenu_left, *bg_submenu_right, *bg_submenu_middle;
|
*bg_submenu_left, *bg_submenu_right, *bg_submenu_middle;
|
||||||
|
SDL_Surface *highlighted_key;
|
||||||
|
SDL_Surface *selected_key;
|
||||||
|
|
||||||
Font *default_font;
|
Font *default_font;
|
||||||
Font *small_font;
|
Font *small_font;
|
||||||
@ -70,7 +72,7 @@ public:
|
|||||||
|
|
||||||
MainView *mv;
|
MainView *mv;
|
||||||
DiscView *dv;
|
DiscView *dv;
|
||||||
KeyboardView *kv;
|
VirtualKeyboard *kv;
|
||||||
GuiView **views;
|
GuiView **views;
|
||||||
int n_views;
|
int n_views;
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
Gui::gui->pushView(Gui::gui->kv);
|
||||||
|
Gui::gui->kv->activate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "virtual_keyboard.hh"
|
#include "virtual_keyboard.hh"
|
||||||
#include "utils.hh"
|
#include "utils.hh"
|
||||||
|
#include "gui.hh"
|
||||||
|
|
||||||
typedef struct virtkey
|
typedef struct virtkey
|
||||||
{
|
{
|
||||||
@ -113,6 +114,13 @@ void VirtualKeyboard::draw(SDL_Surface *where, int x, int y, int w, int h)
|
|||||||
if (this->shift_on && shifted_names[which])
|
if (this->shift_on && shifted_names[which])
|
||||||
what = shifted_names[which];
|
what = shifted_names[which];
|
||||||
|
|
||||||
|
if (this->sel_x == x && this->sel_y == y)
|
||||||
|
{
|
||||||
|
SDL_Rect dst = (SDL_Rect){x * key_w + border_x - 8,
|
||||||
|
y * key_h + border_y - 4, 0,0};
|
||||||
|
|
||||||
|
SDL_BlitSurface(Gui::gui->selected_key, NULL, where, &dst);
|
||||||
|
}
|
||||||
this->font->draw(where, what,
|
this->font->draw(where, what,
|
||||||
x * key_w + border_x, y * key_h + border_y, w, h);
|
x * key_w + border_x, y * key_h + border_y, w, h);
|
||||||
}
|
}
|
||||||
@ -351,10 +359,12 @@ void VirtualKeyboard::runLogic()
|
|||||||
|
|
||||||
void VirtualKeyboard::draw(SDL_Surface *where)
|
void VirtualKeyboard::draw(SDL_Surface *where)
|
||||||
{
|
{
|
||||||
|
this->draw(where, 20, 240, 600, 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboard::updateTheme()
|
void VirtualKeyboard::updateTheme()
|
||||||
{
|
{
|
||||||
|
this->setFont(Gui::gui->small_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The singleton */
|
/* The singleton */
|
||||||
|
Loading…
Reference in New Issue
Block a user