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.

88 lines
1.7 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
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. UNKOWN
  27. };
  28. class Game
  29. {
  30. private:
  31. SDL_Window *WINDOW = NULL;
  32. SDL_GLContext glContext;
  33. const int SCREEN_WIDTH = 800;
  34. const int SCREEN_HEIGHT = 600;
  35. int MONITOR_WIDTH=1920;
  36. int MONITOR_HEIGHT=1080;
  37. const char *TITLE = "Lesson 01";
  38. bool KEEP_ALIVE = true;
  39. bool SHOW_GRID = false;
  40. SHAPE USER_CURRENT = TRIANGLE;
  41. SHAPE GUST_CURRENT = UNKOWN;
  42. bool KEY_UP_ARROW_ACTIVE = false;
  43. bool KEY_DOWN_ARROW_ACTIVE = false;
  44. bool KEY_LEFT_ARROW_ACTIVE = false;
  45. bool KEY_RIGHT_ARROW_ACTIVE = false;
  46. bool KEY_SPACE_ACTIVE = false;
  47. bool KEY_RETURN_ACTIVE = false;
  48. bool FULL_SCREEN = false;
  49. public:
  50. Game();
  51. ~Game();
  52. int init();
  53. int initGL();
  54. void box();
  55. void close();
  56. void grid();
  57. void paint();
  58. void events( SDL_Event &event );
  59. void key_down(SDL_Keycode key_code);
  60. void key_up(SDL_Keycode key_code);
  61. void resize ( int width, int height );
  62. void triangle();
  63. void triangle(bool filled);
  64. void square();
  65. void square(bool filled);
  66. void circle();
  67. void circle(bool filled);
  68. void pentagon();
  69. void pentagon(bool filled);
  70. void rectangle();
  71. void cross(bool filled);
  72. void compass();
  73. void on_key_up_arrow();
  74. void on_key_down_arrow();
  75. void on_key_left_arrow();
  76. void on_key_right_arrow();
  77. void on_key_space();
  78. void on_key_enter();
  79. void top_screen();
  80. void user_screen();
  81. void guest_screen();
  82. };
  83. } // namespace betacore
  84. #endif