|
gui_cpp
#include "gui.h"
#include "debug.h"
#include <iostream>
#include <string>
SDL::SDL(){
screen = NULL;
running = true;
#ifdef DEBUG
DEBUG << "SDL Constructed." << std::endl;
#endif
}
SDL::~SDL(){
running = false;
SDL_Quit();
#ifdef DEBUG
DEBUG << "SDL Destroyed." << std::endl;
#endif
}
void SDL::setupScreen(int tWidth, int tHeight, int tBpp, Uint32 tFlags){
width = tWidth;
height = tHeight;
bpp = tBpp;
flags = tFlags;
screen = SDL_SetVideoMode(width, height, bpp, flags);
#ifdef DEBUG
DEBUG << "SDL Video Mode Was Changed." << std::endl;
#endif
}
void SDL::setupExtra(const char* title, const char* icon){
SDL_WM_SetCaption(title, icon);
#ifdef DEBUG
DEBUG << "Title And/Or Icon Was Changed." << std::endl;
#endif
}
/*void SDL::setIcon(char* tFile, Uint8* tMask){
SDL_Surface* tIcon = NULL;
//tIcon = SDL_LoadBMP(tFile.c_str());
SDL_WM_SetIcon(tIcon, tMask);
}*/
void SDL::supportScreen(){
if (SDL_VideoModeOK (width, height, bpp, flags) == 0){
#ifdef DEBUG
DEBUG << "Unsupported Screen Mode." << std::endl;
#endif
SDL_Quit();
}
}
void SDL::setRunning(bool OPrunning){
running = OPrunning;
#ifdef DEBUG
DEBUG << "SDL Running Determined." << std::endl;
#endif
}
bool SDL::getRunning(){
return running;
}
void SDL::initVideo(){
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0){
SDL_InitSubSystem(SDL_INIT_VIDEO);
#ifdef DEBUG
DEBUG << "SDL Video Inited." << std::endl;
#endif
}
}
void SDL::initTimer(){
if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0){
SDL_InitSubSystem(SDL_INIT_TIMER);
#ifdef DEBUG
DEBUG << "SDL Time Inited." << std::endl;
#endif
}
}
/*void SDL::quitVideo(){
if (SDL_QuitSubSystem(SDL_INIT_VIDEO) < 0){
SDL_QuitSubSystem(SDL_INIT_VIDEO);
#ifdef DEBUG
DEBUG << "SDL Quit Video." << std::endl;
#endif
}
}
void SDL::quitTimer(){
if (SDL_QuitSubSystem(SDL_INIT_TIMER) == 0){
SDL_QuitSubSystem(SDL_INIT_TIMER);
#ifdef DEBUG
DEBUG << "SDL Quit Time." << std::endl;
#endif
}
}*/
void SDL::delay(Uint32 ms){
SDL_Delay(ms);
#ifdef DEBUG
DEBUG << "SDL Delayed." << std::endl;
#endif
}
void SDL::quit(){
SDL_Quit();
#ifdef DEBUG
DEBUG << "SDL Quit." << std::endl;
#endif
}
|