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 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 enum {
  11. zero = '0', one = '1',
  12. two = '2', three = '3',
  13. four = '4', five = '5',
  14. six = '6', seven = '7',
  15. eight = '8', nine = '9',
  16. a = 'a', b = 'b',
  17. c = 'c', d = 'd',
  18. e = 'e', f = 'f',
  19. g = 'g', h = 'h',
  20. i = 'i', j = 'j',
  21. k = 'k', l = 'l',
  22. m = 'm', n = 'n',
  23. o = 'o', p = 'p',
  24. q = 'q', r = 'r',
  25. s = 's', t = 't',
  26. u = 'u', v = 'v',
  27. w = 'w', x = 'x',
  28. y = 'y', z = 'z',
  29. quote, backslash, backspace, capslock,
  30. comma, del, up, down, left, right,
  31. end, equals, escape, f1, f2, f3, f4, f5,
  32. f6, f7, f8, f9, f10, f11, f12, backquote,
  33. home, insert, leftalt, leftctrl, leftbracket,
  34. leftgui, leftshift, minus, numlock, pagedown,
  35. pageup, pause, dot, rightalt, rightctrl, enter,
  36. rightgui, rightbracket, rightshift, scrolllock,
  37. semicolon, slash, space, tab,
  38. leftmouse, middlemouse, rightmouse,
  39. unknown
  40. } KeyboardButton;
  41. typedef struct {
  42. char *text;
  43. unsigned int x;
  44. unsigned int y;
  45. int w;
  46. int h;
  47. float scale;
  48. unsigned char color[4];
  49. } WindowString;
  50. /*!
  51. * \brief Windowing interface
  52. */
  53. class Window {
  54. public:
  55. /*!
  56. * \brief Deconstructs an object of Window
  57. */
  58. virtual ~Window();
  59. virtual void setDriver(const char *driver) = 0;
  60. virtual void setSize(unsigned int width, unsigned int height) = 0;
  61. virtual void setFullscreen(bool fullscreen) = 0;
  62. virtual void setMousegrab(bool grab) = 0;
  63. virtual int initialize() = 0;
  64. virtual void eventHandling() = 0;
  65. virtual void setTextInput(bool on) = 0;
  66. virtual void delay(clock_t ms) = 0;
  67. virtual void swapBuffersGL() = 0;
  68. virtual int initializeGL();
  69. virtual void resizeGL();
  70. virtual void glEnter2D();
  71. virtual void glExit2D();
  72. virtual void setFont(const char *font) = 0;
  73. virtual int initializeFont() = 0;
  74. virtual void writeString(WindowString *s) = 0;
  75. virtual void drawText(unsigned int x, unsigned int y, float scale, unsigned char *color, const char *s, ...)
  76. __attribute__((format(printf, 6, 0))) = 0;
  77. unsigned int mWidth;
  78. unsigned int mHeight;
  79. protected:
  80. bool mInit;
  81. char *mDriver;
  82. bool mFullscreen;
  83. bool mMousegrab;
  84. bool mFontInit;
  85. char *mFontName;
  86. };
  87. #endif