You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 2, 2025. It is now read-only.
In this tutorial, we will be using GLFW to create and manage our window. Since this is not part of the core tutorial, we will only provide a small rundown of the header file without going into further detail. If you are new to GLFW, we recommend you check out [this tutorial on learnopengl.com](https://learnopengl.com/Getting-started/Hello-Window)
3
+
The first thing when developing a graphics application is to open a blank window.
4
4
5
-
The code below will open a small window which we will use in the next sections.
5
+
## Creating a header file
6
6
7
-
## window.hpp
7
+
In this tutorial, we will create a new header file `window.hpp` that is responsible for interfacing and abstracting the windowing library of our choice GLFW.
8
8
9
9
```cpp
10
10
#pragma once
11
11
12
+
structWindow{
13
+
};
14
+
```
15
+
16
+
Next, we need to include the libraries. Since we need the native window handle later, we also need the native GLFW headers. Since those libraries are platform dependant though, we need some extra preprocessor magic.
17
+
18
+
```cpp
12
19
#include<daxa/daxa.hpp>
13
20
usingnamespacedaxa::types;
14
21
@@ -17,105 +24,123 @@ using namespace daxa::types;
We now need to add some properties to our window struct. This includes the GLFW window pointer, the current width and height, whether the window is minimized and whether the swapchain is out of date due to the resizing of the window.
57
35
58
-
~Window() {
59
-
glfwDestroyWindow(glfw_window_ptr);
60
-
glfwTerminate();
61
-
}
36
+
```cpp
37
+
GLFWwindow * glfw_window_ptr;
38
+
u32 width, height;
39
+
bool minimized = false;
40
+
bool swapchain_out_of_date = false;
41
+
```
62
42
63
-
auto get_native_handle() const -> daxa::NativeWindowHandle
64
-
{
43
+
We can now create a constructor and a destructor for the window.
0 commit comments