00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Mike Polan * 00003 * kanadakid@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 // glcontext.h: the SDLContext class 00021 00022 #ifndef SDLCONTEXT_H 00023 #define SDLCONTEXT_H 00024 00025 #include <iostream> 00026 #include "SDL.h" 00027 00028 #include "case.h" 00029 #include "game.h" 00030 00037 class SDLContext { 00038 public: 00040 static std::auto_ptr<SDLContext> create(); 00041 00043 ~SDLContext(); 00044 00048 int getWidth() const { return m_Width; } 00049 00053 int getHeight() const { return m_Height; } 00054 00058 bool init(); 00059 00066 bool initVideo(int width, int height, bool fullscreen); 00067 00071 bool initAudio(); 00072 00077 bool initGame(const ustring &pathToCase); 00078 00080 void render(); 00081 00085 void onKeyboardEvent(SDL_KeyboardEvent *e); 00086 00090 void onMouseEvent(SDL_MouseButtonEvent *e); 00091 00092 private: 00094 SDLContext(); 00095 00097 00098 static int m_Width, m_Height; 00100 00102 int m_VFlags; 00103 00105 Game *m_Game; 00106 00108 SDL_Surface *m_Screen; 00109 }; 00110 00111 #endif