Let UI render on the physical screen rather than the logical screen

This commit is contained in:
2025-12-23 16:05:34 +08:00
parent e1245997ae
commit 903fdc37d1
7 changed files with 221 additions and 91 deletions

View File

@@ -6,16 +6,26 @@ public:
WindowManager();
~WindowManager();
// 初始化
bool Initialize(GameConfig& config);
bool Initialize(WindowConfig& config);
//关闭
void Shutdown();
//清理上一帧窗口
void beginWorld();
void endWorld();
void beginUI();
void endUI();
void Clear();
//呈现窗口
void Present();
bool setFullscreen(bool isFullscreen);
const Viewport& getViewport() const;
SDL_Renderer* GetRenderer();
SDL_Window* GetWindow();
@@ -23,13 +33,15 @@ public:
private:
SDL_Window* m_window;
SDL_Renderer* m_renderer;
int m_logicalWidth;
int m_logicalHeight;
int m_windowWidth;
int m_windowHeight;
Viewport m_viewport;
//int m_logicalWidth;
//int m_logicalHeight;
//int m_windowWidth;
//int m_windowHeight;
bool m_isFullscreen = false;
SDL_Texture* m_logicalTexture = nullptr;
// 计算缩放后的目标矩形
void calculateDstRect(SDL_FRect& dstRect);
//void calculateDstRect(SDL_FRect& dstRect);
void onWindowResize();
};