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