GameLib is my library for making games
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.

49 lines
1.5 KiB

(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src")
(import "../src/OgreCore.cake"
(c-import "SDL.h" "SDL_syswm.h")
(defun main (&return int)
(var window (* SDL_Window) nullptr)
(unless (sdl-initialize (addr window))
(return 1))
;; Ogre uses exceptions for error handling, so we can't gracefully close without getting all that
;; stuff set up (which I don't really want to do; it belongs in Gamelib)
(var monkey-mesh mesh-handle (ogre-load-mesh "Suzanne.mesh"))
(var monkey-node scene-node (ogre-node-from-item monkey-mesh))
(var exit-reason (* (const char)) nullptr)
(var x float 0.f)
(var y float 0.f)
(var z float 0.f)
;; Main loop
(while true
(unless (ogre-handle-window-events)
(set exit-reason "Window closed")
(ogre-node-set-position (addr monkey-node) x y z)
(set x (+ x 0.01f))
(unless (ogre-render-frame)
(set exit-reason "Failed to render frame")
(when exit-reason
(printf "Exit reason: %s\n" exit-reason))
(return 0))
(set-cakelisp-option executable-output "test/ogreSDLApp")
;; TODO: Somehow inherit this from SDL.cake?
(set-module-option build-time-compiler "/usr/bin/clang++")
;; Include cakelisp source for DynamicLoader.hpp
(set-module-option build-time-compile-arguments
"-Wall" "-Wextra" "-Wno-unused-parameter"
"-g" "-c" 'source-input "-o" 'object-output "-fPIC"