Add device name to input config files.

Properly init/deinit renderer stuff in Renderer_init_rpi.cpp. Probably.
This commit is contained in:
Aloshi 2013-04-11 21:59:19 -05:00
parent a5f4749d5d
commit 1007821ca3
6 changed files with 34 additions and 14 deletions

View file

@ -157,9 +157,12 @@ void InputConfig::writeToXML(pugi::xml_node parent)
pugi::xml_node cfg = parent.append_child("inputConfig"); pugi::xml_node cfg = parent.append_child("inputConfig");
if(mDeviceId == DEVICE_KEYBOARD) if(mDeviceId == DEVICE_KEYBOARD)
{
cfg.append_attribute("type") = "keyboard"; cfg.append_attribute("type") = "keyboard";
else }else{
cfg.append_attribute("type") = "joystick"; cfg.append_attribute("type") = "joystick";
cfg.append_attribute("deviceName") = SDL_JoystickName(mDeviceId);
}
typedef std::map<std::string, Input>::iterator it_type; typedef std::map<std::string, Input>::iterator it_type;
for(it_type iterator = mNameMap.begin(); iterator != mNameMap.end(); iterator++) for(it_type iterator = mNameMap.begin(); iterator != mNameMap.end(); iterator++)

View file

@ -196,7 +196,7 @@ void InputManager::loadConfig()
}else if(type == "joystick") }else if(type == "joystick")
{ {
bool found = false; 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++) for(int i = 0; i < mNumJoysticks; i++)
{ {
if(SDL_JoystickName(i) == devName) if(SDL_JoystickName(i) == devName)

View file

@ -17,6 +17,10 @@ namespace Renderer
bool init(int w, int h); bool init(int w, int h);
void deinit(); void deinit();
//just takes care of default font init/deinit right now
void onInit();
void onDeinit();
unsigned int getScreenWidth(); unsigned int getScreenWidth();
unsigned int getScreenHeight(); unsigned int getScreenHeight();

View file

@ -7,3 +7,22 @@
#ifdef _DESKTOP_ #ifdef _DESKTOP_
#include "Renderer_init_sdlgl.cpp" #include "Renderer_init_sdlgl.cpp"
#endif #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();
}
}
};

View file

@ -32,7 +32,7 @@ namespace Renderer
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 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) if(sdlScreen == NULL)
{ {
@ -80,22 +80,14 @@ namespace Renderer
glOrtho(0, display_width, display_height, 0, -1.0, 1.0); glOrtho(0, display_width, display_height, 0, -1.0, 1.0);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f); glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
//initialize fonts onInit();
for(int i = 0; i < (int)FONT_SIZE_COUNT; i++)
{
getDefaultFont((FontSize)i)->init();
}
return true; return true;
} }
void deinit() void deinit()
{ {
//deinitialize fonts onDeinit();
for(int i = 0; i < (int)FONT_SIZE_COUNT; i++)
{
getDefaultFont((FontSize)i)->deinit();
}
destroySurface(); destroySurface();
} }

View file

@ -320,6 +320,8 @@ GuiGameList* GuiGameList::create(Window* window)
void GuiGameList::update(int deltaTime) void GuiGameList::update(int deltaTime)
{ {
if(mDetailed)
mImageAnimation->update(deltaTime); mImageAnimation->update(deltaTime);
mList->update(deltaTime); mList->update(deltaTime);
} }