mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-04 02:36:31 +00:00
Encapsulation: basic functiosn for window handling + typedef VectorX in Ray namespace
This commit is contained in:
@@ -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_ */
|
||||
@@ -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_ */
|
||||
Reference in New Issue
Block a user