readme clarifications
This commit is contained in:
29
README.md
29
README.md
@@ -38,15 +38,20 @@ likely.
|
|||||||
```lua
|
```lua
|
||||||
local FlexLove = require("FlexLove")
|
local FlexLove = require("FlexLove")
|
||||||
|
|
||||||
-- Initialize with base scaling and theme
|
-- (Optional) Initialize with a theme and immediate mode
|
||||||
FlexLove.init({
|
FlexLove.init({
|
||||||
baseScale = { width = 1920, height = 1080 },
|
|
||||||
theme = "space"
|
theme = "space"
|
||||||
immediateMode = true -- Optional: enable immediate mode (default: false)
|
immediateMode = true
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Create a button with flexbox layout
|
function love.update(dt)
|
||||||
local button = FlexLove.new({
|
FlexLove.update(dt)
|
||||||
|
end
|
||||||
|
|
||||||
|
function love.draw()
|
||||||
|
FlexLove.draw(function()
|
||||||
|
-- Game content (will be blurred by backdrop blur)
|
||||||
|
local button = FlexLove.new({
|
||||||
width = "20vw",
|
width = "20vw",
|
||||||
height = "10vh",
|
height = "10vh",
|
||||||
backgroundColor = Color.new(0.2, 0.2, 0.8, 1),
|
backgroundColor = Color.new(0.2, 0.2, 0.8, 1),
|
||||||
@@ -56,15 +61,11 @@ local button = FlexLove.new({
|
|||||||
onEvent = function(element, event)
|
onEvent = function(element, event)
|
||||||
print("Button clicked!")
|
print("Button clicked!")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
end, function()
|
||||||
-- In your love.update and love.draw:
|
-- This is drawn AFTER all GUI elements - no backdrop blur
|
||||||
function love.update(dt)
|
SomeMetaComponent:draw()
|
||||||
FlexLove.update(dt)
|
end)
|
||||||
end
|
|
||||||
|
|
||||||
function love.draw()
|
|
||||||
FlexLove.draw()
|
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user