diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..e3eff7fd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "*.h": "c", + "vector": "cpp" + } +} \ No newline at end of file diff --git a/lib/Ray/Gamepad.hpp b/lib/Ray/Controllers/Gamepad.hpp similarity index 100% rename from lib/Ray/Gamepad.hpp rename to lib/Ray/Controllers/Gamepad.hpp diff --git a/lib/Ray/Keyboard.hpp b/lib/Ray/Controllers/Keyboard.hpp similarity index 100% rename from lib/Ray/Keyboard.hpp rename to lib/Ray/Controllers/Keyboard.hpp diff --git a/lib/Ray/Mouse.hpp b/lib/Ray/Controllers/Mouse.hpp similarity index 100% rename from lib/Ray/Mouse.hpp rename to lib/Ray/Controllers/Mouse.hpp diff --git a/lib/Ray/Drawables/Basic/Circle.hpp b/lib/Ray/Drawables/Basic/Circle.hpp new file mode 100644 index 00000000..ca7759a9 --- /dev/null +++ b/lib/Ray/Drawables/Basic/Circle.hpp @@ -0,0 +1,21 @@ +/* +** EPITECH PROJECT, 2021 +** Bomberman +** File description: +** Pixel +*/ + +#ifndef PIXEL_HPP_ +#define PIXEL_HPP_ + +#include +#include "Drawables/Drawable.hpp" + +namespace Ray { + struct Circle: public Drawable + { + int radius; + }; +}; + +#endif /* !PIXEL_HPP_ */ diff --git a/lib/Ray/Drawables/Basic/Line.hpp b/lib/Ray/Drawables/Basic/Line.hpp new file mode 100644 index 00000000..af1438ae --- /dev/null +++ b/lib/Ray/Drawables/Basic/Line.hpp @@ -0,0 +1,21 @@ +/* +** EPITECH PROJECT, 2021 +** Bomberman +** File description: +** Pixel +*/ + +#ifndef PIXEL_HPP_ +#define PIXEL_HPP_ + +#include +#include "Drawables/Drawable.hpp" + +namespace Ray { + struct Line: public Drawable + { + Vector2 dimensions; + }; +}; + +#endif /* !PIXEL_HPP_ */ diff --git a/lib/Ray/Drawables/Basic/Pixel.hpp b/lib/Ray/Drawables/Basic/Pixel.hpp new file mode 100644 index 00000000..de0b3bd7 --- /dev/null +++ b/lib/Ray/Drawables/Basic/Pixel.hpp @@ -0,0 +1,21 @@ +/* +** EPITECH PROJECT, 2021 +** Bomberman +** File description: +** Pixel +*/ + +#ifndef PIXEL_HPP_ +#define PIXEL_HPP_ + +#include +#include "Drawables/Drawable.hpp" + +namespace Ray { + struct Point: public Drawable + { + + }; +}; + +#endif /* !PIXEL_HPP_ */ diff --git a/lib/Ray/Drawables/Drawable.hpp b/lib/Ray/Drawables/Drawable.hpp new file mode 100644 index 00000000..05fad26a --- /dev/null +++ b/lib/Ray/Drawables/Drawable.hpp @@ -0,0 +1,26 @@ +/* +** EPITECH PROJECT, 2021 +** Bomberman +** File description: +** Drawable +*/ + +#ifndef DRAWABLE_HPP_ +#define DRAWABLE_HPP_ + +#include +#include + +namespace Ray { + struct Drawable + { + //top-left position + Vector2 position; + + Color color; + + virtual ~Drawable() = 0; + }; +}; + +#endif /* !DRAWABLE_HPP_ */ diff --git a/lib/Ray/Vector.hpp b/lib/Ray/Vector.hpp index fdaeca4e..53561de2 100644 --- a/lib/Ray/Vector.hpp +++ b/lib/Ray/Vector.hpp @@ -11,8 +11,9 @@ #include namespace Ray { - typedef Vector2 Vector2; - typedef Vector3 Vector3; + typedef ::Vector2 Vector2; + typedef ::Vector3 Vector3; + typedef ::Vector4 Vector4; } #endif /* !VECTOR_HPP_ */ diff --git a/lib/Ray/Window.hpp b/lib/Ray/Window.hpp index efa5ea98..88664105 100644 --- a/lib/Ray/Window.hpp +++ b/lib/Ray/Window.hpp @@ -11,6 +11,7 @@ #include #include #include "Vector.hpp" +#include "Keyboard.hpp" namespace Ray { class Window { @@ -27,6 +28,9 @@ class Window { // Check if KEY_ESCAPE pressed or Close icon pressed bool shouldClose(void) const; + //Set key used to close window (default: ESC) + void setExitKey(Keyboard::Key key); + // Close window and unload OpenGL context bool close(void); @@ -48,6 +52,20 @@ class Window { // Check if cursor is on the current screen. bool cursorIsOnScreen(void) const; + // Set target FPS (maximum) + void setFPS(int fps); + + // Set background color (framebuffer clear color) + void clear(const Color &color); + + // Setup canvas (framebuffer) to start drawing + // Must be called before first draw of iteration + void beginDrawing(void); + + // End canvas drawing and swap buffers (double buffering) + // Must be called after last draw of iteration + void endDrawing(void); + private: Ray::Vector2 _dimensions; std::string _title;