Browse Source

Toggle fake fullscreen key

master
Macoy Madson 5 months ago
parent
commit
1491f29386
  1. 17
      src/Presentation.cake

17
src/Presentation.cake

@ -38,6 +38,7 @@
(define-keybind s-toggle-kerning-keybind (array SDL_SCANCODE_F2))
(define-keybind s-toggle-debug-overlay-keybind (array SDL_SCANCODE_F1))
(define-keybind s-toggle-fullscreen-keybind (array SDL_SCANCODE_F11))
(define-keybind s-attack-keybind (array SDL_SCANCODE_1))
(define-keybind s-attack-2-keybind (array SDL_SCANCODE_2))
@ -1063,6 +1064,8 @@
(var c-cycle-rate-ticks Uint64 (* 4 (SDL_GetPerformanceFrequency)))
(var last-power-cycle-ticks Uint64 0)
(var enable-fullscreen bool false)
(var exit-reason (* (const char)) null)
(while true
(var event SDL_Event)
@ -1070,15 +1073,17 @@
(when (= (field event type) SDL_QUIT)
(set exit-reason "Window event")))
(var window-width int 0)
(var window-height int 0)
(SDL_GetWindowSize window (addr window-width) (addr window-height))
(var num-keys int 0)
(set (field s-key-states this-frame-states) (SDL_GetKeyboardState (addr num-keys)))
(when (keybind-tapped (addr s-quit-keybind) (addr s-key-states))
(set exit-reason "Quit keybind pressed"))
(when (keybind-tapped (addr s-toggle-fullscreen-keybind) (addr s-key-states))
(set enable-fullscreen (not enable-fullscreen))
(if enable-fullscreen
(SDL_SetWindowFullscreen window SDL_WINDOW_FULLSCREEN_DESKTOP)
(SDL_SetWindowFullscreen window 0)))
;; Slide motion
(var start-frame-slide-index int current-slide-index)
(when (keybind-tapped (addr s-next-slide-keybind) (addr s-key-states))
@ -1118,6 +1123,10 @@
(when (keybind-tapped (addr s-toggle-debug-overlay-keybind) (addr s-key-states))
(set s-enable-debug-overlay (not s-enable-debug-overlay)))
(var window-width int 0)
(var window-height int 0)
(SDL_GetWindowSize window (addr window-width) (addr window-height))
(set (field g-wizard-hero x) (type-cast (* window-width 0.08f) int))
(set (field g-wizard-hero y) (- window-height (/ ground-height 2) wizard-ground-height))

Loading…
Cancel
Save