Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WindowSDL.h 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*!
  2. * \file include/WindowSDL.h
  3. * \brief SDL windowing implementation
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _WINDOW_SDL_H_
  8. #define _WINDOW_SDL_H_
  9. #include "SDL.h"
  10. #include "SDL_ttf.h"
  11. #ifdef __APPLE__
  12. #include <OpenGL/gl.h>
  13. #include <OpenGL/glu.h>
  14. #else
  15. #include <GL/gl.h>
  16. #include <GL/glu.h>
  17. #endif
  18. #include "Window.h"
  19. /*!
  20. * \brief SDL windowing implementation
  21. */
  22. class WindowSDL : public Window {
  23. public:
  24. /*!
  25. * \brief Constructs an object of WindowSDL
  26. */
  27. WindowSDL();
  28. /*!
  29. * \brief Deconstructs an object of WindowSDL
  30. */
  31. virtual ~WindowSDL();
  32. virtual void setDriver(const char *driver);
  33. virtual void setSize(unsigned int width, unsigned int height);
  34. virtual void setFullscreen(bool fullscreen);
  35. virtual void setMousegrab(bool grab);
  36. virtual int initialize();
  37. virtual void eventHandling();
  38. virtual void setTextInput(bool on);
  39. virtual void delay(clock_t ms);
  40. virtual void swapBuffersGL();
  41. virtual void setFont(const char *font);
  42. virtual int initializeFont();
  43. virtual void writeString(WindowString *s);
  44. virtual void drawText(unsigned int x, unsigned int y, float scale, const float color[4], const char *s, ...)
  45. __attribute__((format(printf, 6, 0)));
  46. private:
  47. SDL_Window *mWindow; //!< This is the pointer to the SDL surface
  48. SDL_GLContext mGLContext; //!< The OpenGL Context
  49. TTF_Font *mFont;
  50. GLuint mFontTexture;
  51. bool mTextInput;
  52. WindowString tempText;
  53. };
  54. #endif