41 lines
760 B
C++
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;
|
|
}
|