Resolution now uses whatever the system was before.

A custom resolution can be used with the -w and -h switches.
For the old resolution, use "emulationstation -w 1024 -h 768".
This commit is contained in:
Aloshi 2012-07-27 17:35:45 -05:00
parent 82c244d451
commit fbfa0d436c
2 changed files with 27 additions and 4 deletions

View file

@ -3,8 +3,8 @@
std::vector<GuiComponent*> renderVector;
unsigned int Renderer::getScreenWidth() { return 1024; }
unsigned int Renderer::getScreenHeight() { return 768; }
unsigned int Renderer::getScreenWidth() { return Renderer::screen ? Renderer::screen->w : 640; } //1024; }
unsigned int Renderer::getScreenHeight() { return Renderer::screen ? Renderer::screen->h : 480; }
void Renderer::registerComponent(GuiComponent* comp)
{

View file

@ -7,7 +7,7 @@
#include <boost/filesystem.hpp>
#include "components/GuiInputConfig.h"
int main()
int main(int argc, char* argv[])
{
bool running = true;
@ -25,12 +25,35 @@ int main()
return 1;
}
Renderer::screen = SDL_SetVideoMode(Renderer::getScreenWidth(), Renderer::getScreenHeight(), 16, SDL_SWSURFACE);
int width = 0;
int height = 0;
if(argc > 1)
{
for(int i = 1; i < argc; i++)
{
if(strcmp(argv[i], "-w") == 0)
{
width = atoi(argv[i + 1]);
i++;
}else if(strcmp(argv[i], "-h") == 0)
{
height = atoi(argv[i + 1]);
i++;
}
}
}
Renderer::screen = SDL_SetVideoMode(width, height, 16, SDL_SWSURFACE | SDL_FULLSCREEN);
if(Renderer::screen == NULL)
{
std::cerr << "Error - could not set video mode!\n";
std::cerr << " " << SDL_GetError() << "\n";
std::cerr << "\nYou may want to try using -w and -h to specify a resolution.\n";
return 1;
}else{
std::cout << "Video mode is " << Renderer::screen->w << "x" << Renderer::screen->h << "\n";
}
SDL_ShowCursor(false);