123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- /*!
- * \file include/SDLSystem.h
- * \brief SDL System interface implementation
- *
- * \author Mongoose
- */
-
- #ifndef _SDLSYSTEM_H_
- #define _SDLSYSTEM_H_
-
- #include <SDL2/SDL.h>
- #include <System.h>
-
- /*!
- * \brief SDL System interface implementation
- */
- class SDLSystem : public System {
- public:
-
- /*!
- * \brief Constructs an object of SDLSystem
- */
- SDLSystem();
-
- /*!
- * \brief Deconstructs an object of SDLSystem
- */
- virtual ~SDLSystem();
-
- /*!
- * \brief Get ticks
- * \returns number of milliseconds since start of program
- */
- virtual unsigned int getTicks();
-
- /*
- * \brief Sets Event binding Cmd to Key press
- * \param cmd valid command string
- * \param key valid keyboard code
- * \param event valid game event id
- */
- //! \fixme void bindKeyCommand(const char *cmd, int key, int event);
-
- /*!
- * \brief Renders string in OpenGL (2D projection).
- *
- * Requires Texture::glEnterMode2d() call before entry.
- *
- * System::bufferString(..) can cache printf() style calls
- * for use with this method.
- *
- * Call Texture::glExitMode2d after finishing calls to this method
- * and other 2D rendering.
- *
- * \param x valid X world coordinate
- * \param y valid Y world coordinate
- * \param string valid string
- *
- * \sa System::bufferString()
- * \sa Texture::glEnterMode2d()
- * \sa Texture::glExitMode2d()
- */
- void glPrintf2d(float x, float y, char *string);
-
- /*!
- * \brief Renders string in OpenGL (3D projection).
- *
- * System::bufferString(..) can cache printf() style calls
- * for use with this method.
- *
- * \param x valid X world coordinate
- * \param y valid Y world coordinate
- * \param z valid Z world coordinate
- * \param string valid string
- *
- * \sa System::bufferString()
- */
- void glPrintf3d(float x, float y, float z, char *string);
-
- /*!
- * \brief Start up video subsystem
- * \param width valid video mode width
- * \param height valid video mode height
- * \param fullscreen enables fullscreen rendering
- */
- void initVideo(unsigned int width, unsigned int height, bool fullscreen);
-
- /*!
- * \brief Resizes game window
- * \param width new width
- * \param height new height
- */
- void resize(unsigned int width, unsigned int height);
-
- /*!
- * \brief Start game loop
- */
- void runGame();
-
- void setGrabMouse(bool on);
-
- /*!
- * \brief Shuts down the game subsystems, exits game loop
- * \param i exit code
- */
- void shutdown(int i);
-
- /*!
- * \brief Swaps OpenGL buffers.
- * Call at end of frame.
- */
- void swapBuffersGL();
-
- /*!
- * \brief Toggle fullscreen windowing mode
- */
- void toggleFullscreen();
-
- protected:
- bool mFullscreen; //!< Current Fullscreen/Windowed mode
-
- private:
- SDL_Window *mWindow; //!< This is the pointer to the SDL surface
- SDL_GLContext mGLContext; //!< The OpenGL Context
- };
-
- #endif
|