You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
40 lines
1.3 KiB
(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src")
|
|
(add-cakelisp-search-directory "Dependencies/gamelib/src")
|
|
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime")
|
|
|
|
(import "SDL.cake")
|
|
(c-import "SDL.h" "SDL_syswm.h" "SDL_timer.h")
|
|
;; TODO: Somehow inherit this from SDL.cake?
|
|
(module-use-sdl-build-options)
|
|
|
|
(defun main (&return int)
|
|
(SDL_Log "File Helper\n\n
|
|
Created by Macoy Madson <macoy@macoy.me>.\n
|
|
https://macoy.me/code/macoy/file-helper\n
|
|
Copyright (c) 2021 Macoy Madson.\n
|
|
Licensed under GPL-3.0-or-later.\n\n")
|
|
(var window (* SDL_Window) null)
|
|
(unless (sdl-initialize-for-2d (addr window) "File Helper" 1920 1080) (return 1))
|
|
(sdl-list-2d-render-drivers)
|
|
|
|
;; (var window-surface (* SDL_Surface) (SDL_GetWindowSurface window))
|
|
|
|
(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))
|
|
|
|
(set-cakelisp-option executable-output "file-helper")
|
|
|