fix build
This commit is contained in:
parent
79a678f162
commit
db0e47b6ad
2 changed files with 1 additions and 53 deletions
|
|
@ -1,53 +0,0 @@
|
|||
(local pxl8 (require :pxl8))
|
||||
|
||||
(var camera-angle 0)
|
||||
(local camera-height 0)
|
||||
(local camera-distance 450)
|
||||
(var fps 0)
|
||||
(var world nil)
|
||||
|
||||
(fn init []
|
||||
(set world (pxl8.world_new))
|
||||
(let [result (pxl8.world_load world "res/maps/test.bsp")]
|
||||
(if (< result 0)
|
||||
(pxl8.error (.. "Failed to load test.bsp - result: " result))
|
||||
(pxl8.info "Loaded world successfully!"))))
|
||||
|
||||
(fn update [dt]
|
||||
(when (> dt 0)
|
||||
(set fps (math.floor (/ 1.0 dt))))
|
||||
(when (pxl8.world_is_loaded world)
|
||||
(set camera-angle (+ camera-angle (* dt 0.5)))))
|
||||
|
||||
(fn frame []
|
||||
(pxl8.clr 0)
|
||||
(pxl8.text (.. "FPS: " fps) 10 40 14)
|
||||
|
||||
(if (pxl8.world_is_loaded world)
|
||||
(let [cam-x (* camera-distance (math.cos camera-angle))
|
||||
cam-z (* camera-distance (math.sin camera-angle))]
|
||||
|
||||
(pxl8.text (.. "Camera: " (string.format "%.0f" cam-x) ","
|
||||
(string.format "%.0f" camera-height) ","
|
||||
(string.format "%.0f" cam-z)) 10 55 12)
|
||||
|
||||
(pxl8.clear_zbuffer)
|
||||
(pxl8.set_backface_culling true)
|
||||
(pxl8.set_wireframe true)
|
||||
|
||||
(let [aspect (/ (pxl8.get_width) (pxl8.get_height))
|
||||
fov 1.047]
|
||||
(pxl8.set_projection (pxl8.mat4_perspective fov aspect 1.0 4096.0)))
|
||||
|
||||
(pxl8.set_view (pxl8.mat4_lookat
|
||||
[cam-x camera-height cam-z]
|
||||
[0 0 0]
|
||||
[0 1 0]))
|
||||
|
||||
(pxl8.set_model (pxl8.mat4_identity))
|
||||
|
||||
(pxl8.world_render world [cam-x camera-height cam-z]))))
|
||||
|
||||
{:init init
|
||||
:update update
|
||||
:frame frame}
|
||||
1
pxl8.sh
1
pxl8.sh
|
|
@ -389,6 +389,7 @@ case "$COMMAND" in
|
|||
src/pxl8_gfx.c
|
||||
src/pxl8_io.c
|
||||
src/pxl8_math.c
|
||||
src/pxl8_procgen.c
|
||||
src/pxl8_script.c
|
||||
src/pxl8_sdl3.c
|
||||
src/pxl8_tilemap.c
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue