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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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, unknown
  38. } KeyboardButton;
  39. typedef struct {
  40. char *text;
  41. unsigned int x;
  42. unsigned int y;
  43. int w;
  44. int h;
  45. float scale;
  46. unsigned char color[4];
  47. } WindowString;
  48. /*!
  49. * \brief Windowing interface
  50. */
  51. class Window {
  52. public:
  53. /*!
  54. * \brief Deconstructs an object of Window
  55. */
  56. virtual ~Window();
  57. virtual void setDriver(const char *driver) = 0;
  58. virtual void setSize(unsigned int width, unsigned int height) = 0;
  59. virtual void setFullscreen(bool fullscreen) = 0;
  60. virtual void setMousegrab(bool grab) = 0;
  61. virtual int initialize() = 0;
  62. virtual void eventHandling() = 0;
  63. virtual void setTextInput(bool on) = 0;
  64. virtual void delay(clock_t ms) = 0;
  65. virtual void swapBuffersGL() = 0;
  66. virtual int initializeGL();
  67. virtual void resizeGL();
  68. virtual void glEnter2D();
  69. virtual void glExit2D();
  70. virtual void setFont(const char *font) = 0;
  71. virtual int initializeFont() = 0;
  72. virtual void writeString(WindowString *s) = 0;
  73. unsigned int mWidth;
  74. unsigned int mHeight;
  75. protected:
  76. bool mInit;
  77. char *mDriver;
  78. bool mFullscreen;
  79. bool mMousegrab;
  80. bool mFontInit;
  81. char *mFontName;
  82. };
  83. #endif