RavEngine
Loading...
Searching...
No Matches
Window.hpp
1#pragma once
2#if !RVE_SERVER
3#include <RGL/Types.hpp>
4#include <RGL/Swapchain.hpp>
5#include <string_view>
6#include "mathtypes.hpp"
7
8struct SDL_Window;
9
10namespace RavEngine {
11 struct Window {
12 SDL_Window* window;
13 RGLSwapchainPtr swapchain;
14 RGLSurfacePtr surface;
15 RGLFencePtr swapchainFence;
16 void* metalLayer;
17 Window(int width, int height, const std::string_view title);
18
19 void NotifySizeChanged(int width, int height);
20
21 void SetSize(int width, int height);
22
24 RGL::ITexture* texture;
25 RGL::SwapchainPresentConfig presentConfig;
26 };
27 void QueueGetNextSwapchainImage(RGL::SwapchainPresentConfig&);
28 SwapchainResult BlockGetNextSwapchainImage(const RGL::SwapchainPresentConfig& );
29
30 dim_t<int> windowdims;
31
32 dim_t<int> GetSizeInPixels() const;
33
34 constexpr static float win_scalefactor = 1;
35 float currentScaleFactor = win_scalefactor;
36
40 float GetDPIScale() const{
41 return currentScaleFactor;
42 }
43
44 void InitSwapchain(RGLDevicePtr device, RGLCommandQueuePtr mainCommandQueue);
45
46
47 enum class WindowMode {
48 Windowed,
49 BorderlessFullscreen,
50 Fullscreen
51 };
56 void SetWindowMode(WindowMode mode);
57
62 void SetRelativeMouseMode(bool mode);
63
68 private:
69 float QueryScaleFactor() const;
70 };
71
72
73}
74#endif
Definition Texture.hpp:168
Definition concurrentqueue.h:747
Definition Animation.hpp:6
Definition Swapchain.hpp:8
Definition Window.hpp:23
Definition Window.hpp:11
bool GetRelativeMouseMode()
Definition Window.cpp:159
float GetDPIScale() const
Definition Window.hpp:40
void SetWindowMode(WindowMode mode)
Definition Window.cpp:137
void SetRelativeMouseMode(bool mode)
Definition Window.cpp:155