Improved InGameMessage dialog

This commit is contained in:
Dimitris Panokostas 2017-03-07 00:20:02 +01:00
parent fdb4b9681b
commit 0c45576be1
3 changed files with 16 additions and 18 deletions

View file

@ -82,7 +82,7 @@ bool isModeAspectRatioExact(SDL_DisplayMode* mode, int width, int height)
return false; return false;
} }
void updateScreen() void updatedisplayarea()
{ {
// Update the texture from the surface // Update the texture from the surface
SDL_UpdateTexture(texture, nullptr, screen->pixels, screen->pitch); SDL_UpdateTexture(texture, nullptr, screen->pixels, screen->pitch);
@ -143,7 +143,7 @@ static void open_screen(struct uae_prefs* p)
height); height);
check_error_sdl(texture == nullptr, "Unable to create texture"); check_error_sdl(texture == nullptr, "Unable to create texture");
updateScreen(); updatedisplayarea();
if (screen != nullptr) if (screen != nullptr)
{ {
@ -226,7 +226,7 @@ void flush_screen()
} }
} }
updateScreen(); updatedisplayarea();
init_row_map(); init_row_map();
} }

View file

@ -10,4 +10,4 @@ extern SDL_Texture* gui_texture;
extern SDL_DisplayMode sdlMode; extern SDL_DisplayMode sdlMode;
extern void check_error_sdl(bool check, const char* message); extern void check_error_sdl(bool check, const char* message);
extern void updateScreen(); extern void updatedisplayarea();

View file

@ -61,7 +61,7 @@ enum
*/ */
SDL_Surface* gui_screen; SDL_Surface* gui_screen;
SDL_Texture* gui_texture; SDL_Texture* gui_texture;
SDL_Event event; SDL_Event gui_event;
/* /*
* Guisan SDL stuff we need * Guisan SDL stuff we need
@ -183,7 +183,6 @@ namespace sdl
// Note, any surface will do, it doesn't have to be the screen. // Note, any surface will do, it doesn't have to be the screen.
gui_graphics->setTarget(gui_screen); gui_graphics->setTarget(gui_screen);
gui_input = new gcn::SDLInput(); gui_input = new gcn::SDLInput();
uae_gui = new gcn::Gui(); uae_gui = new gcn::Gui();
uae_gui->setGraphics(gui_graphics); uae_gui->setGraphics(gui_graphics);
uae_gui->setInput(gui_input); uae_gui->setInput(gui_input);
@ -203,14 +202,14 @@ namespace sdl
void checkInput() void checkInput()
{ {
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&gui_event))
{ {
if (event.type == SDL_KEYDOWN) if (gui_event.type == SDL_KEYDOWN)
{ {
gcn::FocusHandler* focusHdl; gcn::FocusHandler* focusHdl;
gcn::Widget* activeWidget; gcn::Widget* activeWidget;
if (event.key.keysym.sym == currprefs.key_for_menu) if (gui_event.key.keysym.sym == currprefs.key_for_menu)
{ {
if (emulating && widgets::cmdStart->isEnabled()) if (emulating && widgets::cmdStart->isEnabled())
{ {
@ -229,7 +228,7 @@ namespace sdl
} }
} }
else else
switch (event.key.keysym.scancode) switch (gui_event.key.keysym.scancode)
{ {
case SDL_SCANCODE_Q: case SDL_SCANCODE_Q:
//------------------------------------------------- //-------------------------------------------------
@ -254,9 +253,9 @@ namespace sdl
//------------------------------------------------ //------------------------------------------------
// Simulate press of enter when 'X' pressed // Simulate press of enter when 'X' pressed
//------------------------------------------------ //------------------------------------------------
event.key.keysym.scancode = SDL_SCANCODE_RETURN; gui_event.key.keysym.scancode = SDL_SCANCODE_RETURN;
gui_input->pushInput(event); // Fire key down gui_input->pushInput(gui_event); // Fire key down
event.type = SDL_KEYUP; // and the key up gui_event.type = SDL_KEYUP; // and the key up
break; break;
case VK_UP: case VK_UP:
@ -282,7 +281,7 @@ namespace sdl
break; break;
} }
} }
else if (event.type == SDL_QUIT) else if (gui_event.type == SDL_QUIT)
{ {
//------------------------------------------------- //-------------------------------------------------
// Quit entire program via SQL-Quit // Quit entire program via SQL-Quit
@ -293,7 +292,7 @@ namespace sdl
//------------------------------------------------- //-------------------------------------------------
// Send event to guichan-controls // Send event to guichan-controls
//------------------------------------------------- //-------------------------------------------------
gui_input->pushInput(event); gui_input->pushInput(gui_event);
} }
} }
@ -334,7 +333,7 @@ namespace widgets
class MainButtonActionListener : public gcn::ActionListener class MainButtonActionListener : public gcn::ActionListener
{ {
public: public:
void action(const gcn::ActionEvent& actionEvent) void action(const gcn::ActionEvent& actionEvent) override
{ {
if (actionEvent.getSource() == cmdShutdown) if (actionEvent.getSource() == cmdShutdown)
{ {
@ -406,7 +405,7 @@ namespace widgets
class PanelFocusListener : public gcn::FocusListener class PanelFocusListener : public gcn::FocusListener
{ {
public: public:
void focusGained(const gcn::Event& event) void focusGained(const gcn::Event& event) override
{ {
int i; int i;
for (i = 0; categories[i].category != nullptr; ++i) for (i = 0; categories[i].category != nullptr; ++i)
@ -456,7 +455,6 @@ namespace widgets
//------------------------------------------------- //-------------------------------------------------
gui_top = new gcn::Container(); gui_top = new gcn::Container();
gui_top->setDimension(gcn::Rectangle(0, 0, GUI_WIDTH, GUI_HEIGHT)); gui_top->setDimension(gcn::Rectangle(0, 0, GUI_WIDTH, GUI_HEIGHT));
// gui_top->setDimension(gcn::Rectangle((gui_screen->w - GUI_WIDTH) / 2, (gui_screen->h - GUI_HEIGHT) / 2, GUI_WIDTH, GUI_HEIGHT));
gui_top->setBaseColor(gui_baseCol); gui_top->setBaseColor(gui_baseCol);
uae_gui->setTop(gui_top); uae_gui->setTop(gui_top);