anaglym/video.cc
Josh Holtrop ad3c1c6fde obtaining default video dimensions
git-svn-id: svn://anubis/anaglym/trunk@17 99a6e188-d820-4881-8870-2d33a10e2619
2009-09-19 17:02:48 +00:00

41 lines
760 B
C++

#include "video.h"
#include <SDL/SDL.h>
#include <iostream>
using namespace std;
static int default_width = 0;
static int default_height = 0;
void video_init()
{
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER))
{
cerr << "SDL_Init() returned error!" << endl;
exit(3);
}
const SDL_VideoInfo * vidInfo = SDL_GetVideoInfo();
if (vidInfo != NULL)
{
default_width = vidInfo->current_w;
default_height = vidInfo->current_h;
}
else
{
cerr << "Warning: SDL_GetVideoInfo() returned NULL!" << endl;
default_width = 1024;
default_height = 768;
}
}
int getDefaultWidth()
{
return default_width;
}
int getDefaultHeight()
{
return default_height;
}