refactor: reorganize pxl8 into client/src/ module structure
- core/: main entry, types, logging, I/O, RNG - asset/: ase loader, cart, save, embed - gfx/: graphics, animation, atlas, fonts, tilemap, transitions - sfx/: audio - script/: lua/fennel runtime, REPL - hal/: platform abstraction (SDL3) - world/: BSP, world, procedural gen - math/: math utilities - game/: GUI, replay - lua/: Lua API modules
This commit is contained in:
parent
272e0bc615
commit
39b604b333
106 changed files with 6078 additions and 3715 deletions
|
|
@ -1,6 +1,10 @@
|
|||
(local pxl8 (require :pxl8))
|
||||
|
||||
(var paused false)
|
||||
(var gui nil)
|
||||
|
||||
(fn init []
|
||||
(set gui (pxl8.create_gui)))
|
||||
|
||||
(fn show []
|
||||
(set paused true)
|
||||
|
|
@ -12,36 +16,39 @@
|
|||
(pxl8.set_relative_mouse_mode true))
|
||||
|
||||
(fn toggle []
|
||||
(when (not gui) (init))
|
||||
(if paused
|
||||
(hide)
|
||||
(show)))
|
||||
|
||||
(fn update []
|
||||
(let [(mx my) (pxl8.get_mouse_pos)]
|
||||
(pxl8.gui_cursor_move mx my))
|
||||
(when gui
|
||||
(let [(mx my) (pxl8.get_mouse_pos)]
|
||||
(gui:cursor_move mx my))
|
||||
|
||||
(when (pxl8.mouse_pressed 1)
|
||||
(pxl8.gui_cursor_down))
|
||||
(when (pxl8.mouse_pressed 1)
|
||||
(gui:cursor_down))
|
||||
|
||||
(when (pxl8.mouse_released 1)
|
||||
(pxl8.gui_cursor_up)))
|
||||
(when (pxl8.mouse_released 1)
|
||||
(gui:cursor_up))))
|
||||
|
||||
(fn draw []
|
||||
(pxl8.gui_begin_frame)
|
||||
(when gui
|
||||
(gui:begin_frame)
|
||||
|
||||
(pxl8.gui_window 200 100 240 140 "pxl8 demo")
|
||||
(pxl8.gui_window 200 100 240 140 "pxl8 demo")
|
||||
|
||||
(when (pxl8.gui_button 1 215 145 210 32 "Resume")
|
||||
(hide))
|
||||
(when (gui:button 1 215 145 210 32 "Resume")
|
||||
(hide))
|
||||
|
||||
(when (pxl8.gui_button 2 215 185 210 32 "Quit")
|
||||
(pxl8.quit))
|
||||
(when (gui:button 2 215 185 210 32 "Quit")
|
||||
(pxl8.quit))
|
||||
|
||||
(if (pxl8.gui_is_hovering)
|
||||
(pxl8.set_cursor :hand)
|
||||
(pxl8.set_cursor :arrow))
|
||||
(if (gui:is_hovering)
|
||||
(pxl8.set_cursor :hand)
|
||||
(pxl8.set_cursor :arrow))
|
||||
|
||||
(pxl8.gui_end_frame))
|
||||
(gui:end_frame)))
|
||||
|
||||
{:is-paused (fn [] paused)
|
||||
:toggle toggle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue