mirror of
https://gitlab.com/MaddoScientisto/cirnofarm.git
synced 2026-06-07 04:55:55 +00:00
Added GUI library
This commit is contained in:
parent
93f95683c5
commit
be12987894
4 changed files with 778 additions and 42 deletions
29
src/game.lua
29
src/game.lua
|
|
@ -58,6 +58,8 @@ local weapons_manager = require(make_path("weapons"))
|
|||
local Barrel = require(make_path("barrel"))
|
||||
local Strawberry = require(make_path("strawberry"))
|
||||
|
||||
include(make_path("pgui" .. ".lua"))
|
||||
|
||||
tile_width = 16
|
||||
tile_height = 16
|
||||
|
||||
|
|
@ -65,10 +67,14 @@ function _init()
|
|||
spawn_objects()
|
||||
cirnoInstance = Cirno.init()
|
||||
add(actors,cirnoInstance)
|
||||
|
||||
|
||||
slidervalue = 10
|
||||
end
|
||||
|
||||
function _update()
|
||||
--cirno.update()
|
||||
pgui:refresh()
|
||||
|
||||
weapons_manager.update()
|
||||
|
||||
|
|
@ -83,6 +89,16 @@ function _update()
|
|||
for p in all(particles) do
|
||||
p:update()
|
||||
end
|
||||
|
||||
--slidervalue = pgui:component("hslider",{pos=vec(190,20),value=slidervalue})
|
||||
|
||||
pgui:component("vstack",{stroke=true,height=0,margin=3,gap=3,contents={
|
||||
{"text_box",{text=string.format("Actors: %d", count(actors)),margin=2,stroke=true,active=false,hover=false}},
|
||||
{"text_box",{text=string.format("%.4f %dfps",stat(1),stat(7)),margin=2,stroke=true,active=false,hover=false}},
|
||||
{"text_box",{text=string.format("Bullets: %d", count(bullets)),margin=2,stroke=true,active=false,hover=false}},
|
||||
}})
|
||||
|
||||
--pgui:component("text_box",{text=string.format("Actors: %d", count(actors)),margin=2,stroke=true,active=false,hover=false})
|
||||
end
|
||||
|
||||
LAYERS = {
|
||||
|
|
@ -114,18 +130,25 @@ function _draw()
|
|||
foreach(LAYERS, render_layer)
|
||||
|
||||
local mx,my = mouse()
|
||||
camera()
|
||||
mouse_debug.draw(mx,my,4, tile_width, tile_height)
|
||||
|
||||
|
||||
|
||||
camera()
|
||||
|
||||
-- Draw UI
|
||||
draw_ui()
|
||||
weapons_manager.debug_draw()
|
||||
|
||||
--circfill(240,140,slidervalue,8)
|
||||
|
||||
end
|
||||
|
||||
function draw_ui()
|
||||
print(string.format("Actors: %d", count(actors)),0,32+8)
|
||||
print(string.format("%.4f %dfps",stat(1),stat(7)),2,16,5)
|
||||
pgui:draw()
|
||||
|
||||
--print(string.format("Actors: %d", count(actors)),0,32+8)
|
||||
--print(string.format("%.4f %dfps",stat(1),stat(7)),2,16,5)
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue