diff options
author | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
commit | 2ec55fd974a63b705a4777c256d2222c874fa043 (patch) | |
tree | 48f1fea59ee9fc713a28a9aac3f05b98dc5ae66f /Source/3rdParty/SDL2/src/test/SDL_test_common.c | |
parent | c581dfbf1e849f393861d15e82aa6446c0c1c310 (diff) |
*SDL project
Diffstat (limited to 'Source/3rdParty/SDL2/src/test/SDL_test_common.c')
-rw-r--r-- | Source/3rdParty/SDL2/src/test/SDL_test_common.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/Source/3rdParty/SDL2/src/test/SDL_test_common.c b/Source/3rdParty/SDL2/src/test/SDL_test_common.c index b7e294a..81dd39e 100644 --- a/Source/3rdParty/SDL2/src/test/SDL_test_common.c +++ b/Source/3rdParty/SDL2/src/test/SDL_test_common.c @@ -1049,6 +1049,22 @@ SDLTest_CommonInit(SDLTest_CommonState * state) } static const char * +DisplayOrientationName(int orientation) +{ + switch (orientation) + { +#define CASE(X) case SDL_ORIENTATION_##X: return #X + CASE(UNKNOWN); + CASE(LANDSCAPE); + CASE(LANDSCAPE_FLIPPED); + CASE(PORTRAIT); + CASE(PORTRAIT_FLIPPED); +#undef CASE +default: return "???"; + } +} + +static const char * ControllerAxisName(const SDL_GameControllerAxis axis) { switch (axis) @@ -1102,6 +1118,17 @@ SDLTest_PrintEvent(SDL_Event * event) } switch (event->type) { + case SDL_DISPLAYEVENT: + switch (event->display.event) { + case SDL_DISPLAYEVENT_ORIENTATION: + SDL_Log("SDL EVENT: Display %d changed orientation to %s", event->display.display, DisplayOrientationName(event->display.data1)); + break; + default: + SDL_Log("SDL EVENT: Display %d got unknown event 0x%4.4x", + event->display.display, event->display.event); + break; + } + break; case SDL_WINDOWEVENT: switch (event->window.event) { case SDL_WINDOWEVENT_SHOWN: @@ -1349,7 +1376,18 @@ SDLTest_PrintEvent(SDL_Event * event) case SDL_APP_DIDENTERFOREGROUND: SDL_Log("SDL EVENT: App entered the foreground"); break; - + case SDL_DROPBEGIN: + SDL_Log("SDL EVENT: Drag and drop beginning"); + break; + case SDL_DROPFILE: + SDL_Log("SDL EVENT: Drag and drop file: '%s'", event->drop.file); + break; + case SDL_DROPTEXT: + SDL_Log("SDL EVENT: Drag and drop text: '%s'", event->drop.file); + break; + case SDL_DROPCOMPLETE: + SDL_Log("SDL EVENT: Drag and drop ending"); + break; case SDL_QUIT: SDL_Log("SDL EVENT: Quit requested"); break; @@ -1744,6 +1782,11 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) case SDL_MOUSEMOTION: lastEvent = event->motion; break; + + case SDL_DROPFILE: + case SDL_DROPTEXT: + SDL_free(event->drop.file); + break; } } |