mirror of
https://github.com/zhenyan121/SporeBG-Conid.git
synced 2026-04-10 06:14:08 +08:00
Added fullscreen funtion
This commit is contained in:
@@ -34,6 +34,7 @@ bool WindowManager::Initialize(GameConfig& config) {
|
||||
"创建渲染器失败: %s", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
// 关键设置:启用像素模式
|
||||
|
||||
// 设置逻辑呈现模式,实现分辨率自适应[3](@ref)
|
||||
SDL_SetRenderLogicalPresentation(m_renderer,
|
||||
@@ -66,4 +67,14 @@ SDL_Renderer* WindowManager::GetRenderer() {
|
||||
|
||||
SDL_Window* WindowManager::GetWindow() {
|
||||
return m_window;
|
||||
}
|
||||
|
||||
bool WindowManager::setFullscreen(bool isFullscreen) {
|
||||
if (isFullscreen == m_isFullscreen) {
|
||||
return true; // 状态未改变,直接返回
|
||||
}
|
||||
SDL_SetWindowFullscreen(m_window, isFullscreen);
|
||||
m_isFullscreen = isFullscreen;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
void Clear();
|
||||
//呈现窗口
|
||||
void Present();
|
||||
|
||||
bool setFullscreen(bool isFullscreen);
|
||||
|
||||
SDL_Renderer* GetRenderer();
|
||||
SDL_Window* GetWindow();
|
||||
@@ -25,5 +25,5 @@ private:
|
||||
SDL_Renderer* m_renderer;
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
bool m_isFullscreen = false;
|
||||
};
|
||||
Reference in New Issue
Block a user