diff --git a/.gitignore b/.gitignore index c4ad399..498b041 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ a.out +.vscode/ diff --git a/src/Arrow.cpp b/src/Arrow.cpp index 9151c38..afa58b5 100644 --- a/src/Arrow.cpp +++ b/src/Arrow.cpp @@ -1,4 +1,6 @@ #include "Arrow.hpp" +#include +#include Arrow::Arrow(GameRenderer *renderer, const double x, const double y, const double angle) : renderer(renderer), x(x), y(y), angle(angle) @@ -12,7 +14,7 @@ void Arrow::draw(const double player_x, const double player_y) const sprite, (int)(x - sprite.width / 2 + renderer->screen_width / 2 - player_x), (int)(y - sprite.height / 2 + renderer->screen_height / 2 - player_y), - angle * 180 / M_PI + angle * 180 / std::numbers::pi ); } diff --git a/src/Game.cpp b/src/Game.cpp index da85a17..a840c15 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -3,6 +3,7 @@ #include "GameRenderer.hpp" #include "Player.hpp" #include "Game.hpp" +#include using namespace std::literals::chrono_literals; diff --git a/src/Game.hpp b/src/Game.hpp index 2a6523f..b8ac967 100644 --- a/src/Game.hpp +++ b/src/Game.hpp @@ -3,6 +3,7 @@ #include #include +#include #include "Arrow.hpp" #include "GameRenderer.hpp" #include "Player.hpp" diff --git a/src/GameRenderer.hpp b/src/GameRenderer.hpp index 3a43613..e85c859 100644 --- a/src/GameRenderer.hpp +++ b/src/GameRenderer.hpp @@ -2,7 +2,7 @@ #define GAME_RENDERER_HPP #include -#include +// #include #include "Sprite.hpp" class GameRenderer diff --git a/src/Player.cpp b/src/Player.cpp index 9fcc1f4..b9bc131 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -1,5 +1,7 @@ #include "GameRenderer.hpp" #include "Player.hpp" +#include +#include Player::Player(GameRenderer *renderer) : renderer(renderer) { @@ -19,7 +21,7 @@ void Player::draw() const bow_sprite, (int)(renderer->screen_width / 2 - bow_sprite.width / 2 + std::cos(angle) * 30), (int)(renderer->screen_height / 2 - bow_sprite.height / 2 + std::sin(angle) * 30), - angle * 180 / M_PI + angle * 180 / std::numbers::pi ); } diff --git a/src/Sprite.hpp b/src/Sprite.hpp index 4b65b2b..cdd2ec6 100644 --- a/src/Sprite.hpp +++ b/src/Sprite.hpp @@ -1,7 +1,8 @@ #ifndef SPRITE_HPP #define SPRITE_HPP -#include +#include "Whatever.hpp" +// #include typedef struct { SDL_Texture *texture; diff --git a/src/Whatever.hpp b/src/Whatever.hpp new file mode 100644 index 0000000..3092cfe --- /dev/null +++ b/src/Whatever.hpp @@ -0,0 +1,42 @@ +#ifndef WHATEVER_HPP +#define WHATEVER_HPP + +using SDL_Texture = void; +using SDL_Renderer = void; +using SDL_Window = void; + +enum SDL_Event_type { + SDL_QUIT, + SDL_KEYDOWN, + SDL_KEYUP, + SDL_MOUSEBUTTONDOWN, +}; + +enum SDL_Event_keysym_sym { + SDLK_RIGHT, + SDLK_d, + SDLK_LEFT, + SDLK_a, + SDLK_DOWN, + SDLK_s, + SDLK_UP, + SDLK_w, +}; + +struct SDL_Event { + SDL_Event_type type; + struct { + struct { + SDL_Event_keysym_sym sym; + } keysym; + } key; + struct { + int button; + } button; +}; + + +void SDL_WaitEvent(SDL_Event*); +void SDL_GetMouseState(int*, int*); + +#endif