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.

Window.h 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*!
  2. * \file include/Window.h
  3. * \brief Windowing interface
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _WINDOW_H_
  8. #define _WINDOW_H_
  9. #include <ctime>
  10. typedef struct {
  11. char *text;
  12. unsigned int x;
  13. unsigned int y;
  14. int w;
  15. int h;
  16. float scale;
  17. float color[4];
  18. } WindowString;
  19. /*!
  20. * \brief Windowing interface
  21. */
  22. class Window {
  23. public:
  24. /*!
  25. * \brief Deconstructs an object of Window
  26. */
  27. virtual ~Window();
  28. virtual void setDriver(const char *driver) = 0;
  29. virtual void setSize(unsigned int width, unsigned int height) = 0;
  30. virtual void setFullscreen(bool fullscreen) = 0;
  31. virtual void setMousegrab(bool grab) = 0;
  32. virtual int initialize() = 0;
  33. virtual void eventHandling() = 0;
  34. virtual void setTextInput(bool on) = 0;
  35. virtual void delay(clock_t ms) = 0;
  36. virtual void swapBuffersGL() = 0;
  37. virtual int initializeGL();
  38. virtual void resizeGL();
  39. virtual void glEnter2D();
  40. virtual void glExit2D();
  41. virtual void setFont(const char *font) = 0;
  42. virtual int initializeFont() = 0;
  43. virtual void writeString(WindowString &s) = 0;
  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))) = 0;
  46. //! \fixme should be private
  47. unsigned int mWidth;
  48. unsigned int mHeight;
  49. protected:
  50. bool mInit;
  51. char *mDriver;
  52. bool mFullscreen;
  53. bool mMousegrab;
  54. bool mFontInit;
  55. char *mFontName;
  56. };
  57. Window &getWindow();
  58. #endif