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.

70 lines
1.2 KiB

5 years ago
5 years ago
5 years ago
  1. #ifndef __BETACORE_GAME_HPP__
  2. #define __BETACORE_GAME_HPP__
  3. #ifdef _WIN32
  4. #define SDL_MAIN_HANDLED
  5. #include <Windows.h>
  6. #include <GLU.h>
  7. #include <GL/gl.h>
  8. #elif linux
  9. #include <GL/glu.h>
  10. #endif
  11. #include <SDL2/SDL.h>
  12. #include <SDL2/SDL_opengl.h>
  13. #include <stdio.h>
  14. #include <string.h>
  15. #include <string>
  16. #include <math.h>
  17. #define PI 3.14159265359
  18. namespace betacore
  19. {
  20. enum SHAPE{
  21. NONE,
  22. TRIANGLE,
  23. CIRCLE,
  24. SQUARE,
  25. PENTAGON
  26. };
  27. class Game
  28. {
  29. private:
  30. SDL_Window *WINDOW = NULL;
  31. SDL_GLContext glContext;
  32. const int SCREEN_WIDTH = 800;
  33. const int SCREEN_HEIGHT = 600;
  34. const char *TITLE = "Lesson 01";
  35. bool KEEP_ALIVE = true;
  36. bool SHOW_GRID = false;
  37. SHAPE USER_CURRENT = TRIANGLE;
  38. public:
  39. Game();
  40. ~Game();
  41. int init();
  42. int initGL();
  43. void box();
  44. void close();
  45. void grid();
  46. void paint();
  47. void events( SDL_Event &event );
  48. void key_down(SDL_Keycode key_code);
  49. void resize ( int width, int height );
  50. void triangle();
  51. void square();
  52. void circle();
  53. void pentagon();
  54. void rectangle();
  55. void on_key_up_arrow();
  56. void on_key_down_arrow();
  57. void on_key_left_arrow();
  58. void on_key_right_arrow();
  59. void on_key_space();
  60. void on_key_enter();
  61. void top_screen();
  62. void user_screen();
  63. void guest_screen();
  64. };
  65. } // namespace betacore
  66. #endif