Encapsulation: basic functiosn for window handling + typedef VectorX in Ray namespace

This commit is contained in:
arthur.jamet
2021-05-14 09:14:05 +02:00
parent dd8dbb7249
commit 28ebf88bb5
2 changed files with 76 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
/*
** EPITECH PROJECT, 2021
** Bomberman
** File description:
** Vector
*/
#ifndef VECTOR_HPP_
#define VECTOR_HPP_
#include <raylib.h>
namespace Ray {
typedef Vector2 Vector2;
typedef Vector3 Vector3;
}
#endif /* !VECTOR_HPP_ */
+58
View File
@@ -0,0 +1,58 @@
/*
** EPITECH PROJECT, 2021
** Bomberman
** File description:
** Window
*/
#ifndef WINDOW_HPP_
#define WINDOW_HPP_
#include <raylib.h>
#include <string>
#include "Vector.hpp"
namespace Ray {
class Window {
public:
// Creates window, and opens it if openNow is set to true
Window(int width, int height, const std::string title, bool openNow = false);
//Closes window if still open
~Window() = default;
// Initialize window and OpenGL context
bool open(void);
// Check if KEY_ESCAPE pressed or Close icon pressed
bool shouldClose(void) const;
// Close window and unload OpenGL context
bool close(void);
// Check if window is currently focused
bool isFocused(void);
// Set window dimensions
const Ray::Vector2 &getDimensions(void) const;
// Shows cursor
void showCursor(void);
// Hides cursor
void hideCursor(void);
// Check if cursor is not visible
bool cursorIsHidden(void) const;
// Check if cursor is on the current screen.
bool cursorIsOnScreen(void) const;
private:
Ray::Vector2 _dimensions;
std::string _title;
bool _isOpen;
};
}
#endif /* !WINDOW_HPP_ */