diff options
Diffstat (limited to 'JGUI/main.lua')
| -rw-r--r-- | JGUI/main.lua | 34 | 
1 files changed, 30 insertions, 4 deletions
diff --git a/JGUI/main.lua b/JGUI/main.lua index 93fea92..1cb7b9c 100644 --- a/JGUI/main.lua +++ b/JGUI/main.lua @@ -1,19 +1,45 @@ +io.stdout:setvbuf("no")  local JGUI = require("JGUI") +local panel = JGUI.newPanel("Panel") +panel:setSize(300, 300) +local button = JGUI.newButton("test") +button:setSize(200, 50) +button:setPosition(0, 0) +panel:add(button) +local b1 = jin.graphics.newBitmap("a.png") +local b2 = jin.graphics.newBitmap("b.png") +local bt1 = jin.graphics.newTexture(b1) +local bt2 = jin.graphics.newTexture(b2) +b1 = nil  +b2 = nil +local bt = bt1 +button.onClick = function()  +    print("click") +        bt = bt2 +end  +button.onRelease = function() +    bt = bt1 +end  function jin.core.onLoad()   end  function jin.core.onEvent(e) -    if e.type == "quit" then  +    if e.type == "Quit" then  +        jin.core.stop() +    end +    if e.type == "KeyDown" and e.key == "Escape" then           jin.core.stop()      end +    panel:onEvent(e)  end -function jin.core.onUpdate() - +function jin.core.onUpdate(dt) +    panel:onUpdate(dt)  end  function jin.core.onDraw() - +    -- jin.graphics.unbindCanvas() +    jin.graphics.draw(bt, 0, button.y)  end  | 
