love_minimal.lua 808 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. UI2D = require "ui2d..ui2d"
  2. function love.load()
  3. -- Initialize the library. You can optionally pass a font size. Default is 14.
  4. UI2D.Init( "love" )
  5. end
  6. function love.keypressed( key, scancode, isrepeat )
  7. UI2D.KeyPressed( key, isrepeat )
  8. end
  9. function love.textinput( text )
  10. UI2D.TextInput( text )
  11. end
  12. function love.keyreleased( key, scancode )
  13. UI2D.KeyReleased()
  14. end
  15. function love.wheelmoved( x, y )
  16. UI2D.WheelMoved( x, y )
  17. end
  18. function love.update( dt )
  19. -- This gets input information for the library.
  20. UI2D.InputInfo()
  21. end
  22. function love.draw( )
  23. love.graphics.clear( 0.2, 0.2, 0.7 )
  24. -- Every window should be contained in a Begin/End block.
  25. UI2D.Begin( "My Window", 200, 200 )
  26. UI2D.Button( "My First Button" )
  27. UI2D.End( pass )
  28. -- This marks the end of the GUI.
  29. UI2D.RenderFrame()
  30. end