Smartphone UI (finger-scrolling of level menu, bigger buttons, ...), several bugs fixed. Ignoring volume keys.Updated enigma-data32.zip included (modified some lua script).
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <SDL/SDL_mixer.h>
|
||||
#endif
|
||||
|
||||
using namespace ecl;
|
||||
using namespace std;
|
||||
@@ -34,6 +37,28 @@ using namespace std;
|
||||
#define SCREEN ecl::Screen::get_instance()
|
||||
|
||||
namespace enigma { namespace gui {
|
||||
|
||||
#ifdef ANDROID
|
||||
static bool playingMenuMusic = false;
|
||||
|
||||
static void appPutToBackgroundCallbackMenu(void) {
|
||||
playingMenuMusic = false;
|
||||
|
||||
if(Mix_PlayingMusic()) {
|
||||
playingMenuMusic = true;
|
||||
Mix_PauseMusic();
|
||||
}
|
||||
}
|
||||
|
||||
static void appRestoredCallbackMenu(void) {
|
||||
if(playingMenuMusic) {
|
||||
playingMenuMusic = false;
|
||||
Mix_ResumeMusic();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* -------------------- Menu -------------------- */
|
||||
|
||||
Menu::Menu()
|
||||
@@ -65,6 +90,12 @@ namespace enigma { namespace gui {
|
||||
Uint32 enterTickTime = SDL_GetTicks(); // protection against ESC D.o.S. attacks
|
||||
while (SDL_PollEvent(&e)) {} // clear event queue
|
||||
draw_all();
|
||||
#ifdef ANDROID
|
||||
int repaintCounter = 0;
|
||||
playingMenuMusic = false;
|
||||
SDL_ANDROID_SetApplicationPutToBackgroundCallback(appPutToBackgroundCallbackMenu, appRestoredCallbackMenu);
|
||||
#endif
|
||||
|
||||
while (!(quitp || abortp)) {
|
||||
SCREEN->flush_updates();
|
||||
while (SDL_PollEvent(&e)) {
|
||||
@@ -73,6 +104,12 @@ namespace enigma { namespace gui {
|
||||
SDL_Delay(10);
|
||||
if(active_widget) active_widget->tick(0.01);
|
||||
tick (0.01);
|
||||
#ifdef ANDROID
|
||||
// repaint, needed if the app was restored
|
||||
if(repaintCounter++ > 20) {
|
||||
invalidate_all(); repaintCounter = 0;
|
||||
}
|
||||
#endif
|
||||
refresh();
|
||||
}
|
||||
sound::EmitSoundEvent ("menuexit");
|
||||
@@ -112,6 +149,7 @@ namespace enigma { namespace gui {
|
||||
|
||||
void Menu::handle_event(const SDL_Event &e)
|
||||
{
|
||||
|
||||
if (e.type == SDL_KEYDOWN &&
|
||||
e.key.keysym.sym == SDLK_RETURN &&
|
||||
e.key.keysym.mod & KMOD_ALT)
|
||||
|
||||
Reference in New Issue
Block a user