This repository was archived by the owner on Feb 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathScaleSystem.h
More file actions
executable file
·66 lines (60 loc) · 1.97 KB
/
ScaleSystem.h
File metadata and controls
executable file
·66 lines (60 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include <memory>
#include "../defines.h"
#include "../Helpers/Singleton.h"
namespace star
{
/// <summary>
/// Provides a resolution independant system.
/// Set your target resolution to the value you specify
/// and code everything as if your window would be that resolution.
/// </summary>
class ScaleSystem final : public Singleton<ScaleSystem>
{
public:
friend Singleton<ScaleSystem>;
/// <summary>
/// Sets the working resolution of the game.
/// </summary>
/// <param name="xPixels">The amount of pixels horizontally.</param>
/// <param name="yPixels">The amount of pixels vertically.</param>
void SetWorkingResolution(int32 xPixels, int32 yPixels);
/// <summary>
/// Sets the working resolution of the game.
/// </summary>
/// <param name="pixels">The amount of pixels.</param>
void SetWorkingResolution(const vec2& pixels);
/// <summary>
/// Gets the working resolution of the game.
/// </summary>
/// <returns>The working resolution</returns>
const vec2& GetWorkingResolution() const;
/// <summary>
/// Gets the actual resolution of the game.
/// </summary>
/// <returns>The actual resolution</returns>
const vec2& GetActualResolution() const;
/// <summary>
/// Gets the scale of the window, expressed as the window resolution / the target resolution.
/// </summary>
/// <returns>The scale of the window.</returns>
float32 GetScale() const;
/// <summary>
/// Calculates the scale of the window, expressed as the window resolution / the target resolution.
/// </summary>
void CalculateScale();
private:
/// <summary>
/// Creates a new instance of the <see cref="ScaleSystem"/>
/// Private because of Singleton design pattern.
/// </summary>
ScaleSystem();
/// <summary>
/// Finalizes an instance of the <see cref="ScaleSystem"/> class.
/// </summary>
~ScaleSystem();
vec2 m_WorkingRes;
float32 m_Scale;
bool m_bIninitialized;
};
}