File VirtualResolution.hpp¶
File List > Core > VirtualResolution.hpp
Go to the documentation of this file
#ifndef ENGINE_CORE_VIRTUALRESOLUTION_HPP_
#define ENGINE_CORE_VIRTUALRESOLUTION_HPP_
#include <raylib.h>
namespace Engine {
class VirtualResolution {
public:
VirtualResolution(int width, int height);
~VirtualResolution();
VirtualResolution(const VirtualResolution&) = delete;
VirtualResolution& operator=(const VirtualResolution&) = delete;
VirtualResolution(VirtualResolution&&) = delete;
VirtualResolution& operator=(VirtualResolution&&) = delete;
static int ResolveAxis(int virtualSize, int windowSize);
void Load();
void Unload();
void EnsureSize(int width, int height);
void Begin();
void End();
void UpdateLetterbox(int screenWidth, int screenHeight);
void Present();
RenderTexture2D& GetTexture() {
return m_Target;
}
const RenderTexture2D& GetTexture() const {
return m_Target;
}
int GetWidth() const {
return m_Width;
}
int GetHeight() const {
return m_Height;
}
float GetScale() const {
return m_Scale;
}
Rectangle GetDestRect() const {
return m_DestRect;
}
Vector2 GetVirtualMouse() const;
void ApplyMouseMapping();
void ClearMouseMapping();
private:
RenderTexture2D m_Target{};
int m_Width = 0;
int m_Height = 0;
float m_Scale = 1.0f;
Rectangle m_DestRect{};
bool m_MouseMapped = false;
};
} // namespace Engine
#endif // ENGINE_CORE_VIRTUALRESOLUTION_HPP_