Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Window.h 1.6KB

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