Examples: SDL: Gamepad support minor amend. Fixes ImGuiBackendFlags_HasGamepad not being set. Enable in Emscripten demo. Tweaks. (#2509, #2484).

This commit is contained in:
omar
2019-04-23 12:26:14 +02:00
parent 994a92d79d
commit 6789ea3482
9 changed files with 46 additions and 42 deletions

View File

@ -25,7 +25,7 @@ void main_loop(void*);
int main(int, char**)
{
// Setup SDL
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) != 0)
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
{
printf("Error: %s\n", SDL_GetError());
return -1;
@ -62,6 +62,7 @@ int main(int, char**)
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
// For an Emscripten build we are disabling file-system access, so let's not attempt to do a fopen() of the imgui.ini file.
// You may manually call LoadIniSettingsFromMemory() to load settings from your own storage.