obtaining default video dimensions
git-svn-id: svn://anubis/anaglym/trunk@17 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
0de689e6cb
commit
ad3c1c6fde
26
video.cc
26
video.cc
@ -4,6 +4,9 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
static int default_width = 0;
|
||||||
|
static int default_height = 0;
|
||||||
|
|
||||||
void video_init()
|
void video_init()
|
||||||
{
|
{
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER))
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER))
|
||||||
@ -11,4 +14,27 @@ void video_init()
|
|||||||
cerr << "SDL_Init() returned error!" << endl;
|
cerr << "SDL_Init() returned error!" << endl;
|
||||||
exit(3);
|
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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user