|
|
@ -6,11 +6,40 @@ |
|
|
|
;; (add-cakelisp-search-directory "Dependencies/gamelib/Dependencies/cakelisp/runtime") |
|
|
|
(add-cakelisp-search-directory "src") |
|
|
|
|
|
|
|
(c-import "<stdio.h>") |
|
|
|
|
|
|
|
(import "SDL.cake") |
|
|
|
|
|
|
|
(c-import "<stdio.h>" |
|
|
|
"SDL.h" "SDL_syswm.h" "SDL_timer.h") |
|
|
|
|
|
|
|
(var g-window-width int 1080) |
|
|
|
(var g-window-height int 2340) |
|
|
|
|
|
|
|
(defun main (&return int) |
|
|
|
(printf "Hello, Kitty Gridlock!\n") |
|
|
|
(test--sdl-main) |
|
|
|
(printf "Kitty Gridlock\n |
|
|
|
Created by Macoy Madson <macoy@macoy.me>.\n |
|
|
|
https://macoy.me/code/macoy/kitty-gridlock\n |
|
|
|
Copyright (c) 2021 Macoy Madson.\n |
|
|
|
Licensed under GPL-3.0-or-later.\n") |
|
|
|
|
|
|
|
(var window (* SDL_Window) null) |
|
|
|
(unless (sdl-initialize-for-2d (addr window) "Kitty Gridlock" |
|
|
|
g-window-width g-window-height) (return 1)) |
|
|
|
|
|
|
|
(var exit-reason (* (const char)) null) |
|
|
|
(while (not exit-reason) |
|
|
|
(var event SDL_Event) |
|
|
|
(while (SDL_PollEvent (addr event)) |
|
|
|
(when (= (field event type) SDL_QUIT) |
|
|
|
(set exit-reason "Window event"))) |
|
|
|
(var currentKeyStates (* (const Uint8)) (SDL_GetKeyboardState null)) |
|
|
|
(when (at SDL_SCANCODE_ESCAPE currentKeyStates) |
|
|
|
(set exit-reason "Escape pressed")) |
|
|
|
(SDL_UpdateWindowSurface window)) |
|
|
|
|
|
|
|
(when exit-reason |
|
|
|
(printf "Exiting. Reason: %s\n" exit-reason)) |
|
|
|
|
|
|
|
(sdl-shutdown window) |
|
|
|
(return 0)) |
|
|
|
|
|
|
|
(module-use-sdl-build-options) |
|
|
|