修复窗口创建时的fullscreen错误

This commit is contained in:
Nanako 2025-02-09 19:45:44 +08:00
parent ee9055ceef
commit 278390564d
3 changed files with 3 additions and 7 deletions

View File

@ -6,7 +6,5 @@ int main(int argc, char* argv[]) {
init.size = {800, 600};
init.resizable = true;
init.centered = true;
init.visible = true;
init.fullscreen = true;
return run(init);
}

View File

@ -23,12 +23,12 @@ namespace mirage {
if (swap_chain) {
get_renderer()->Release(*swap_chain);
}
surface.reset();
}
bool window::create_swap_chain(const LLGL::SwapChainDescriptor& desc) {
auto temp = desc;
temp.resolution = get_size();
temp.fullscreen = is_fullscreen();
swap_chain = get_renderer()->CreateSwapChain(desc, surface);
if (swap_chain == nullptr) {
spdlog::error("无法创建交换链");

View File

@ -12,7 +12,6 @@ namespace mirage {
bool resizable = true;
bool centered = false;
bool accept_drop_files = false;
bool fullscreen = false;
bool disable_clear_on_resize = false;
bool disable_size_scaling = false;
@ -37,9 +36,6 @@ namespace mirage {
if (accept_drop_files) {
desc.flags |= LLGL::WindowFlags::AcceptDropFiles;
}
if (fullscreen) {
desc.flags |= LLGL::WindowFlags::Borderless;
}
if (disable_clear_on_resize) {
desc.flags |= LLGL::WindowFlags::DisableClearOnResize;
}
@ -55,6 +51,7 @@ namespace mirage {
int stencil_bits = 8;
std::uint32_t samples = 1;
std::uint32_t swap_buffers = 2;
bool fullscreen = false;
operator LLGL::SwapChainDescriptor() const {
LLGL::SwapChainDescriptor desc{};
@ -63,6 +60,7 @@ namespace mirage {
desc.stencilBits = stencil_bits;
desc.samples = samples;
desc.swapBuffers = swap_buffers;
desc.fullscreen = fullscreen;
return desc;
}
};