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.

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