2012-07-19 01:14:17 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <SDL/SDL.h>
|
2012-07-20 01:08:29 +00:00
|
|
|
#include <SDL/SDL_ttf.h>
|
2012-07-19 01:14:17 +00:00
|
|
|
#include "Renderer.h"
|
2012-07-19 16:13:27 +00:00
|
|
|
#include "components/GuiTitleScreen.h"
|
2012-07-19 01:14:17 +00:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2012-07-19 16:13:27 +00:00
|
|
|
if(SDL_Init(SDL_INIT_EVERYTHING) != 0)
|
2012-07-19 01:14:17 +00:00
|
|
|
{
|
|
|
|
std::cerr << "Error - could not initialize SDL!\n";
|
|
|
|
return 1;
|
|
|
|
}
|
2012-07-20 01:08:29 +00:00
|
|
|
if(TTF_Init() != 0)
|
|
|
|
{
|
|
|
|
std::cerr << "Error - could not initialize SDL_ttf!\n";
|
|
|
|
return 1;
|
|
|
|
}
|
2012-07-19 01:14:17 +00:00
|
|
|
|
2012-07-19 16:13:27 +00:00
|
|
|
Renderer::screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE);
|
|
|
|
if(Renderer::screen == NULL)
|
|
|
|
{
|
|
|
|
std::cerr << "Error - could not set video mode!\n";
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-07-20 01:08:29 +00:00
|
|
|
SDL_ShowCursor(false);
|
2012-07-19 16:13:27 +00:00
|
|
|
|
|
|
|
GuiTitleScreen* testGui = new GuiTitleScreen();
|
|
|
|
|
2012-07-20 01:08:29 +00:00
|
|
|
|
2012-07-19 16:13:27 +00:00
|
|
|
bool running = true;
|
|
|
|
while(running)
|
|
|
|
{
|
|
|
|
SDL_Event event;
|
|
|
|
while(SDL_PollEvent(&event))
|
|
|
|
{
|
|
|
|
switch(event.type)
|
|
|
|
{
|
|
|
|
case SDL_KEYDOWN:
|
2012-07-20 01:08:29 +00:00
|
|
|
InputManager::processEvent(&event);
|
|
|
|
break;
|
|
|
|
case SDL_KEYUP:
|
|
|
|
InputManager::processEvent(&event);
|
2012-07-19 16:13:27 +00:00
|
|
|
break;
|
2012-07-20 01:08:29 +00:00
|
|
|
|
2012-07-19 16:13:27 +00:00
|
|
|
case SDL_QUIT:
|
|
|
|
running = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Renderer::render();
|
|
|
|
SDL_Flip(Renderer::screen);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete testGui;
|
2012-07-19 01:14:17 +00:00
|
|
|
|
2012-07-20 01:08:29 +00:00
|
|
|
std::cout << "EmulationStation cleanly shutting down...\n";
|
|
|
|
|
|
|
|
TTF_Quit();
|
2012-07-19 01:14:17 +00:00
|
|
|
SDL_Quit();
|
|
|
|
return 0;
|
|
|
|
}
|