Fixed issues with fullscreen. Replaced it with borderless window

This commit is contained in:
Nefrace 2024-10-13 19:17:47 +03:00
parent 4990a0c1bc
commit 4f0b5dace4
3 changed files with 22 additions and 7 deletions

Binary file not shown.

View File

@ -3,9 +3,12 @@ package main
import rl "vendor:raylib"
import "core:path/filepath"
import "core:strings"
import "core:fmt"
vec3 :: [3]f32
vec3i :: [3]i32
vec2 :: [2]f32
vec2i :: [2]i32
vec3right := vec3{1, 0, 0}
vec3left := vec3{-1, 0, 0}
vec3up := vec3{0, 1, 0}
@ -17,6 +20,8 @@ vec3backward := vec3{0, 0, -1}
WSize := [2]f32{}
WSizei := [2]i32{}
WSizeLast := vec2i{}
WindowShouldExit := false
NeedTutorial := true
@ -131,14 +136,13 @@ load_resources :: proc() {
Res.Music.Second = load_music("alexander-nakarada-the-northern-path.mp3", 0.7)
}
Fullscreen := true
main :: proc() {
rl.SetConfigFlags(rl.ConfigFlags{.MSAA_4X_HINT, .FULLSCREEN_MODE, .VSYNC_HINT, .WINDOW_RESIZABLE})
// rl.SetConfigFlags(rl.ConfigFlags{.MSAA_4X_HINT, .FULLSCREEN_MODE, .VSYNC_HINT, .WINDOW_RESIZABLE})
rl.SetConfigFlags(rl.ConfigFlags{.VSYNC_HINT, .WINDOW_RESIZABLE})
rl.InitWindow(0, 0, "Ragnarøkkr")
rl.InitWindow(800, 600, "Ragnarøkkr")
rl.InitAudioDevice()
rl.SetWindowMinSize(800, 480)
rl.SetWindowMinSize(800, 600)
rl.HideCursor()
Cursor = rl.LoadTexture("./assets/gfx/crosshair.png")
@ -176,3 +180,14 @@ main :: proc() {
rl.EndDrawing()
}
}
Fullscreen := false
toggle_fullscreen :: proc() {
monitor := rl.GetCurrentMonitor()
rl.ToggleBorderlessWindowed()
Fullscreen = !Fullscreen
// rl.ToggleFullscreen()
}

View File

@ -75,8 +75,8 @@ menu_button_pressed :: proc(state: ^GameState, el: Menu_Buttons) {
KeyboardOnly = !KeyboardOnly
NeedTutorial = true
case .FULLSCREEN:
rl.ToggleFullscreen()
Fullscreen = rl.IsWindowFullscreen()
toggle_fullscreen()
// Fullscreen = rl.IsWindowFullscreen()
case .EXIT:
WindowShouldExit = true