CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
GLFWWindow.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
11
13
16
17using GLFWwindow = struct GLFWwindow;
18
19namespace CeresEngine {
20
22 public:
23 enum class API {
24 OpenGL,
25 None
26 };
27
28 private:
31
34
37
38 struct DragState {
39 bool active = false;
41 };
43
45
48
49 public:
55 explicit GLFWWindow(double width = 800.0, double height = 600.0, const String& title = "Game Engine", API api = API::None);
56
57 GLFWWindow(const GLFWWindow&) = delete;
58 GLFWWindow& operator=(const GLFWWindow&) = delete;
59
62
63 public:
66
69
70 public:
73
75 void setTitle(const String& title) final;
76
79
81 void resize(double width, double height) final;
82
84 void close() final;
85
88
90 void setFullscreen(bool fullscreen) final;
91
94
95 public:
98
99 public:
102
103 public:
108
109 private:
115 void keyboardCallback(int key, int scancode, int action, int modifiers);
116
120
125 void mouseButtonCallback(int button, int action, int modifiers);
126
130 void mousePositionCallback(double x, double y);
131
136 void mouseScrollCallback(double x, double y);
137 };
138
139} // namespace CeresEngine
GLFWwindow GLFWwindow
Definition GLFWWindow.hpp:17
Definition GLFWWindow.hpp:21
GLFWWindow & operator=(const GLFWWindow &)=delete
void mousePositionCallback(double x, double y)
A callback method called by GLFW when the mouse changes position.
API
Definition GLFWWindow.hpp:23
~GLFWWindow() final
Destroys the GLFW window.
PlatformWindowProperties mProperties
Definition GLFWWindow.hpp:33
void resize(double width, double height) final
double getScalingFactor() const final
ModifierButton mModifierButtons
Definition GLFWWindow.hpp:44
void setFullscreen(bool fullscreen) final
void mouseButtonCallback(int button, int action, int modifiers)
A callback method called by GLFW when a mouse button is pressed.
void charCallback(int unicodeChar)
A callback method called by GLFW when a keyboard button is pressed and inputs text.
HashMap< Button, DragState > mDragStates
Definition GLFWWindow.hpp:42
GLFWwindow * mWindow
The GLFW window handle.
Definition GLFWWindow.hpp:30
static Vector< const char * > getVulkanInstanceExtensions()
static GLFWWindow * fromHandle(GLFWwindow *handle)
Gets the GLFWWindow from the given GLFW handle.
bool isFullscreen() const final
String mTitle
The window title.
Definition GLFWWindow.hpp:36
Vector2 getSize() const final
void setTitle(const String &title) final
GLFWWindow(double width=800.0, double height=600.0, const String &title="Game Engine", API api=API::None)
Create a new GLFW window.
InputState mState
The.
Definition GLFWWindow.hpp:47
void mouseScrollCallback(double x, double y)
A callback method called by GLFW when the mouse scroll wheel position changes.
String getTitle() const final
GLFWWindow(const GLFWWindow &)=delete
void keyboardCallback(int key, int scancode, int action, int modifiers)
A callback method called by GLFW when a keyboard button is pressed.
GLFWwindow * getHandle() const
Definition InputState.hpp:20
Definition PlatformWindow.hpp:44
Definition Application.hpp:19
ModifierButton
A enumeration of possible modifier buttons.
Definition Input.hpp:298
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
std::unordered_map< Key, T, Hash, KeyEqual, ScopedAllocatorAdaptor< StdAllocator< Pair< const Key, T >, RawAllocator > > > HashMap
HashMap is an associative container that contains key-value pairs with unique keys.
Definition Map.hpp:33
Button button(const StringView &str) noexcept
Returns the Button constant that is represented by str.
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition GLFWWindow.hpp:38
bool active
Definition GLFWWindow.hpp:39
Vector2 lastPosition
Definition GLFWWindow.hpp:40
A structure that contains the state and settings for the window.
Definition PlatformWindow.hpp:33