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

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