VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
ResolutionManager.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include <glm/glm.hpp>
10#include <algorithm>
11#include <iomanip>
12#include <iostream>
13#include <string>
14#include <array>
15#include <vector>
16#include <map>
17#include <unordered_map>
18#include <set>
19#include <unordered_set>
20#include <algorithm>
21#include <iostream>
22#include <fstream>
23#include <sstream>
24#include <cstdint>
25
26#define SDL_MAIN_HANDLED
27#include <SDL3/SDL.h>
28
29namespace vex {
30
31class Window;
32
44
47public:
50 ResolutionManager(SDL_Window *p_window);
51
54 void setMode(ResolutionMode mode);
55
57 ResolutionMode getCurrentMode() const { return m_currentMode; }
58
61 glm::uvec2 getRenderResolution() const { return m_renderResolution; }
62
65 glm::uvec2 getWindowResolution() const { return m_windowResolution; }
66
69 float getUpscaleRatio() const { return m_upscaleRatio; }
70
76 void update();
77
82
83private:
88
89 SDL_Window *m_p_window;
91 glm::uvec2 m_windowResolution;
92 glm::uvec2 m_renderResolution;
93 float m_upscaleRatio = 1.0f;
94};
95
96} // namespace vex
void setMode(ResolutionMode mode)
Function to set the resolution mode. It is called by engine method.
ResolutionManager(SDL_Window *p_window)
Constructor.
float getUpscaleRatio() const
Function to get the current upscale ratio. Read window resolution divided by render resolution.
void calculatePS1SharpResolution()
Internal helper to calculate integer-scaled resolutions for the PS1_SHARP mode.
glm::uvec2 getWindowResolution() const
Function to get the current window resolution.
ResolutionMode getCurrentMode() const
Function to get the current resolution mode.
float getPotencialUpscaleRatio()
Calculates the potential upscale ratio for a given height. @description allows you to create consista...
glm::uvec2 getRenderResolution() const
Function to get the current render resolution.
void update()
Updates the internal resolution state based on the current window size and mode.
This class esentially abstracts SDL_Window.
Definition Window.hpp:18
ResolutionMode
Enumeration representing different resolution modes.
@ PS1_SHARP
Integer-scaled resolution closest to PS1.
@ RES_240P
240p (426x240 for 16:9).
@ NATIVE
Use window resolution.
@ RES_480P
480p (854x480 for 16:9).