From 1007821ca3cdca0f98d56bb51538c1352b382e77 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Thu, 11 Apr 2013 21:59:19 -0500 Subject: [PATCH] Add device name to input config files. Properly init/deinit renderer stuff in Renderer_init_rpi.cpp. Probably. --- src/InputConfig.cpp | 5 ++++- src/InputManager.cpp | 2 +- src/Renderer.h | 4 ++++ src/Renderer_init.cpp | 19 +++++++++++++++++++ src/Renderer_init_sdlgl.cpp | 14 +++----------- src/components/GuiGameList.cpp | 4 +++- 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/InputConfig.cpp b/src/InputConfig.cpp index 84bb9737a..2e6d8319b 100644 --- a/src/InputConfig.cpp +++ b/src/InputConfig.cpp @@ -157,9 +157,12 @@ void InputConfig::writeToXML(pugi::xml_node parent) pugi::xml_node cfg = parent.append_child("inputConfig"); if(mDeviceId == DEVICE_KEYBOARD) + { cfg.append_attribute("type") = "keyboard"; - else + }else{ cfg.append_attribute("type") = "joystick"; + cfg.append_attribute("deviceName") = SDL_JoystickName(mDeviceId); + } typedef std::map::iterator it_type; for(it_type iterator = mNameMap.begin(); iterator != mNameMap.end(); iterator++) diff --git a/src/InputManager.cpp b/src/InputManager.cpp index c06156faf..70679dfa3 100644 --- a/src/InputManager.cpp +++ b/src/InputManager.cpp @@ -196,7 +196,7 @@ void InputManager::loadConfig() }else if(type == "joystick") { bool found = false; - std::string devName = node.child("deviceName").text().get(); + std::string devName = node.attribute("deviceName").as_string(); for(int i = 0; i < mNumJoysticks; i++) { if(SDL_JoystickName(i) == devName) diff --git a/src/Renderer.h b/src/Renderer.h index c9f9093ab..7cbce0b39 100644 --- a/src/Renderer.h +++ b/src/Renderer.h @@ -17,6 +17,10 @@ namespace Renderer bool init(int w, int h); void deinit(); + //just takes care of default font init/deinit right now + void onInit(); + void onDeinit(); + unsigned int getScreenWidth(); unsigned int getScreenHeight(); diff --git a/src/Renderer_init.cpp b/src/Renderer_init.cpp index 4fa90d4fc..1cc641acc 100644 --- a/src/Renderer_init.cpp +++ b/src/Renderer_init.cpp @@ -7,3 +7,22 @@ #ifdef _DESKTOP_ #include "Renderer_init_sdlgl.cpp" #endif + +namespace Renderer +{ + void onInit() + { + for(int i = 0; i < (int)FONT_SIZE_COUNT; i++) + { + getDefaultFont((FontSize)i)->init(); + } + } + + void onDeinit() + { + for(int i = 0; i < (int)FONT_SIZE_COUNT; i++) + { + getDefaultFont((FontSize)i)->deinit(); + } + } +}; diff --git a/src/Renderer_init_sdlgl.cpp b/src/Renderer_init_sdlgl.cpp index b765391e6..ac76d92c1 100644 --- a/src/Renderer_init_sdlgl.cpp +++ b/src/Renderer_init_sdlgl.cpp @@ -32,7 +32,7 @@ namespace Renderer SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - sdlScreen = SDL_SetVideoMode(display_width, display_height, 16, SDL_OPENGL /*| SDL_FULLSCREEN*/ | SDL_DOUBLEBUF); + sdlScreen = SDL_SetVideoMode(display_width, display_height, 16, SDL_OPENGL | SDL_FULLSCREEN | SDL_DOUBLEBUF); if(sdlScreen == NULL) { @@ -80,22 +80,14 @@ namespace Renderer glOrtho(0, display_width, display_height, 0, -1.0, 1.0); glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - //initialize fonts - for(int i = 0; i < (int)FONT_SIZE_COUNT; i++) - { - getDefaultFont((FontSize)i)->init(); - } + onInit(); return true; } void deinit() { - //deinitialize fonts - for(int i = 0; i < (int)FONT_SIZE_COUNT; i++) - { - getDefaultFont((FontSize)i)->deinit(); - } + onDeinit(); destroySurface(); } diff --git a/src/components/GuiGameList.cpp b/src/components/GuiGameList.cpp index 9711e4e3e..ffa0b3e81 100644 --- a/src/components/GuiGameList.cpp +++ b/src/components/GuiGameList.cpp @@ -320,6 +320,8 @@ GuiGameList* GuiGameList::create(Window* window) void GuiGameList::update(int deltaTime) { - mImageAnimation->update(deltaTime); + if(mDetailed) + mImageAnimation->update(deltaTime); + mList->update(deltaTime); }