00001 /* 00002 SDL の Window クラス 00003 Satofumi KAMIMURA 00004 $Id$ 00005 */ 00006 00007 #include "sdlWindow.h" 00008 00009 00010 SDL_Window::SDL_Window(bool fullscreen_mode) : SDL_Video() { 00011 w = ScreenWidth; 00012 h = ScreenHeight; 00013 fullscreen = fullscreen_mode; 00014 } 00015 00016 00017 SDL_Window::~SDL_Window(void) { 00018 clear(All); 00019 activate(false); 00020 } 00021 00022 00023 void SDL_Window::setTitle(const char *title, const char *icon) { 00024 SDL_Video::setTitle(title, icon); 00025 } 00026 00027 00028 void SDL_Window::autoHideCursor(int waitMsec) { 00029 SDL_Video::autoHideCursor(waitMsec); 00030 } 00031 00032 00033 void SDL_Window::activate(bool on) { 00034 SDL_Video::activate(on); 00035 } 00036 00037 00038 unsigned long SDL_Window::getTicks(void) { 00039 return SDL_Video::getTicks(); 00040 } 00041 00042 00043 void SDL_Window::delay(unsigned long ticks) { 00044 SDL_Delay(ticks); 00045 } 00046 00047 00048 void SDL_Window::lock(void) { 00049 SDL_Video::lock(); 00050 } 00051 00052 00053 void SDL_Window::unlock(void) { 00054 SDL_Video::unlock(); 00055 } 00056 00057 00058 void SDL_Window::add(ComponentInterface* component, char depth) { 00059 if (!component) { 00060 return; 00061 } 00062 draws[depth].push_back(component); 00063 } 00064 00065 00066 void SDL_Window::del(ComponentInterface* component, char depth) { 00067 if (!component) { 00068 return; 00069 } 00070 delInputComponent(component); 00071 00072 draws[depth].remove(component); 00073 delete component; 00074 component = NULL; 00075 } 00076 00077 00078 void SDL_Window::clear(char depth) { 00079 if (depth != All) { 00080 for (std::list<ComponentInterface*>::iterator it = draws[depth].begin(); 00081 it != draws[depth].end();) { 00082 std::list<ComponentInterface*>::iterator it_next = it; 00083 ++it_next; 00084 00085 del(*it, depth); 00086 it = it_next; 00087 } 00088 draws[depth].clear(); 00089 00090 } else { 00091 for (std::map<char,drawList>::iterator it = draws.begin(); 00092 it != draws.end(); ++it) { 00093 clear(it->first); 00094 } 00095 } 00096 } 00097 00098 00099 void SDL_Window::addInputComponent(FocusComponentInterface* component, 00100 char depth) { 00101 inputList.push_back(component); 00102 add(component, depth); 00103 } 00104 00105 00106 void SDL_Window::toggleFocus(void) { 00107 SDL_Video::toggleFocus(); 00108 } 00109 00110 00111 void SDL_Window::setFocus(FocusComponentInterface* component) { 00112 SDL_Video::setFocus(component); 00113 } 00114 00115 00116 void SDL_Window::setFullscreen(bool on) { 00117 if (fullscreen != on) { 00118 fullscreen = on; 00119 fullscreen_trigger = true; 00120 } 00121 } 00122 00123 00124 bool SDL_Window::getNowFullscreen(void) { 00125 return fullscreen; 00126 } 00127