Class responsible for managing resolution settings, calculating render resolution based on selected mode. More...
#include <ResolutionManager.hpp>
Public Member Functions | |
| ResolutionManager (SDL_Window *p_window) | |
| Constructor. | |
| void | setMode (ResolutionMode mode) |
| Function to set the resolution mode. It is called by engine method. | |
| ResolutionMode | getCurrentMode () const |
| Function to get the current resolution mode. | |
| glm::uvec2 | getRenderResolution () const |
| Function to get the current render resolution. | |
| glm::uvec2 | getWindowResolution () const |
| Function to get the current window resolution. | |
| float | getUpscaleRatio () const |
| Function to get the current upscale ratio. Read window resolution divided by render resolution. | |
| void | update () |
| Updates the internal resolution state based on the current window size and mode. | |
| float | getPotencialUpscaleRatio () |
| Calculates the potential upscale ratio for a given height. @description allows you to create consistant sizing in both native and ps1 sharp modes. | |
Private Member Functions | |
| void | calculatePS1SharpResolution () |
| Internal helper to calculate integer-scaled resolutions for the PS1_SHARP mode. | |
Private Attributes | |
| SDL_Window * | m_p_window |
| ResolutionMode | m_currentMode = ResolutionMode::PS1_SHARP |
| glm::uvec2 | m_windowResolution |
| glm::uvec2 | m_renderResolution |
| float | m_upscaleRatio = 1.0f |
Class responsible for managing resolution settings, calculating render resolution based on selected mode.
Definition at line 46 of file ResolutionManager.hpp.
| vex::ResolutionManager::ResolutionManager | ( | SDL_Window * | p_window | ) |
Constructor.
| SDL_Window* | p_window - Pointer to the SDL window. |
Definition at line 7 of file ResolutionManager.cpp.
|
private |
Internal helper to calculate integer-scaled resolutions for the PS1_SHARP mode.
Determines the maximum integer scale factor (clamped between 1 and 4) that fits within the current window height. Ensures the render height does not drop below 240p.
Definition at line 107 of file ResolutionManager.cpp.
|
inline |
Function to get the current resolution mode.
Definition at line 57 of file ResolutionManager.hpp.
| float vex::ResolutionManager::getPotencialUpscaleRatio | ( | ) |
Calculates the potential upscale ratio for a given height. @description allows you to create consistant sizing in both native and ps1 sharp modes.
Definition at line 92 of file ResolutionManager.cpp.
|
inline |
Function to get the current render resolution.
Definition at line 61 of file ResolutionManager.hpp.
|
inline |
Function to get the current upscale ratio. Read window resolution divided by render resolution.
Definition at line 69 of file ResolutionManager.hpp.
|
inline |
Function to get the current window resolution.
Definition at line 65 of file ResolutionManager.hpp.
| void vex::ResolutionManager::setMode | ( | ResolutionMode | mode | ) |
Function to set the resolution mode. It is called by engine method.
| ResolutionMode | mode - The resolution mode to set. |
Definition at line 11 of file ResolutionManager.cpp.
| void vex::ResolutionManager::update | ( | ) |
Updates the internal resolution state based on the current window size and mode.
Queries the actual window size from SDL (SDL_GetWindowSizeInPixels). Depending on m_currentMode:
Definition at line 16 of file ResolutionManager.cpp.
|
private |
Definition at line 90 of file ResolutionManager.hpp.
|
private |
Definition at line 89 of file ResolutionManager.hpp.
|
private |
Definition at line 92 of file ResolutionManager.hpp.
|
private |
Definition at line 93 of file ResolutionManager.hpp.
|
private |
Definition at line 91 of file ResolutionManager.hpp.