VulkanEngine 0.1
Graphics engine using Vulkan
Loading...
Searching...
No Matches
GLFWWindow.h
1// Copyright (c) 2024 Michael Carlie. All Rights Reserved.
2//
3// This software is released under the MIT License.
4// https://opensource.org/licenses/MIT
5
6#ifndef INCLUDE_VULKANENGINE_GLFWWINDOW_H_
7#define INCLUDE_VULKANENGINE_GLFWWINDOW_H_
8
9#define GLFW_INCLUDE_VULKAN
10#include <GLFW/glfw3.h>
11#include <VulkanEngine/Window.h>
12
13#include <string>
14#include <vector>
15
16namespace VulkanEngine {
17
19class GLFWWindow : public Window {
20 public:
26 GLFWWindow(int _width, int _height, const std::string& _title,
27 bool _full_screen);
28
30 virtual ~GLFWWindow();
31
35 virtual bool initialize(bool invisible = false);
36
38 virtual void update();
39
41 virtual const std::vector<const char*> getRequiredVulkanInstanceExtensions()
42 const;
43
45 virtual bool shouldClose();
46
49 virtual void setWidth(uint32_t _width);
50
53 virtual void setHeight(uint32_t _height);
54
57 virtual void setTitle(const std::string& new_title);
58
61 virtual vk::SurfaceKHR getVkSurface();
62
63 private:
65 GLFWwindow* glfw_window;
66
68 VkSurfaceKHR vk_surface;
69
74 static void errorCallback(int error, const char* description);
75
80 static void windowResizeCallback(GLFWwindow* _glfw_window, int _width,
81 int _height);
82
87 static void framebufferResizeCallback(GLFWwindow* _glfw_window, int _width,
88 int _height);
89
94 static void cursorPositionCallback(GLFWwindow* _glfw_window, double xpos,
95 double ypos);
96
101 static void scrollCallback(GLFWwindow* _glfw_window, double xoffset,
102 double yoffset);
103
109 static void mouseButtonCallback(GLFWwindow* _glfw_window, int button,
110 int action, int mods);
111
118 static void keyCallback(GLFWwindow* _glfw_window, int key, int scancode,
119 int action, int mods);
120};
121
122} // namespace VulkanEngine
123
124#endif // INCLUDE_VULKANENGINE_GLFWWINDOW_H_
An implementation of VulkanEngine::Window which uses the GLFW library.
Definition: GLFWWindow.h:19
virtual void update()
Do anything needed to update the window.
Definition: GLFWWindow.cpp:47
virtual const std::vector< const char * > getRequiredVulkanInstanceExtensions() const
Definition: GLFWWindow.cpp:99
virtual ~GLFWWindow()
Desctructor.
Definition: GLFWWindow.cpp:37
virtual void setTitle(const std::string &new_title)
Definition: GLFWWindow.cpp:130
virtual void setHeight(uint32_t _height)
Definition: GLFWWindow.cpp:122
virtual bool shouldClose()
Definition: GLFWWindow.cpp:110
virtual void setWidth(uint32_t _width)
Definition: GLFWWindow.cpp:114
virtual bool initialize(bool invisible=false)
Definition: GLFWWindow.cpp:53
virtual vk::SurfaceKHR getVkSurface()
Definition: GLFWWindow.cpp:240
Provides an abstract interface for window implementations.
Definition: Window.h:20
TODO development of this class is in progress.
Definition: Attribute.h:13