remove subpar tests, update examples

This commit is contained in:
Michael Freno
2025-11-13 09:23:31 -05:00
parent b173ab7354
commit 07278aac96
52 changed files with 269 additions and 27943 deletions

View File

@@ -1,12 +1,12 @@
--[[
FlexLove Example 01: Flex Positioning
This example demonstrates flexbox layouts in FlexLove:
- Flex direction (horizontal/vertical)
- Justify content (main axis alignment)
- Align items (cross axis alignment)
- Flex wrap behavior
Run with: love /path/to/libs/examples/01_flex_positioning.lua
]]
@@ -15,18 +15,17 @@ local Lv = love
-- Load FlexLove from parent directory
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
-- Initialize FlexLove with base scaling
Gui.init({
baseScale = { width = 1920, height = 1080 }
FlexLove.init({
baseScale = { width = 1920, height = 1080 },
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -36,15 +35,15 @@ function Lv.load()
textColor = Color.new(1, 1, 1, 1),
textAlign = enums.TextAlign.CENTER,
})
-- ========================================
-- Section 1: Horizontal Flex with Different JustifyContent Values
-- ========================================
local yOffset = 10
-- Label for justify-content section
Gui.new({
FlexLove.new({
x = "2vw",
y = yOffset .. "vh",
width = "96vw",
@@ -53,9 +52,9 @@ function Lv.load()
textSize = "2.5vh",
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
yOffset = yOffset + 4
-- Demonstrate each justify-content option
local justifyOptions = {
{ name = "flex-start", value = enums.JustifyContent.FLEX_START },
@@ -65,10 +64,10 @@ function Lv.load()
{ name = "space-around", value = enums.JustifyContent.SPACE_AROUND },
{ name = "space-evenly", value = enums.JustifyContent.SPACE_EVENLY },
}
for _, option in ipairs(justifyOptions) do
-- Label for this justify option
Gui.new({
FlexLove.new({
x = "2vw",
y = yOffset .. "vh",
width = "15vw",
@@ -78,9 +77,9 @@ function Lv.load()
textColor = Color.new(0.8, 0.8, 1, 1),
textAlign = enums.TextAlign.START,
})
-- Container demonstrating this justify-content value
local container = Gui.new({
local container = FlexLove.new({
x = "18vw",
y = yOffset .. "vh",
width = "78vw",
@@ -93,7 +92,7 @@ function Lv.load()
border = { top = true, right = true, bottom = true, left = true },
borderColor = Color.new(0.3, 0.3, 0.4, 1),
})
-- Add child elements
local colors = {
Color.new(0.8, 0.3, 0.3, 1),
@@ -101,9 +100,9 @@ function Lv.load()
Color.new(0.3, 0.3, 0.8, 1),
Color.new(0.8, 0.8, 0.3, 1),
}
for j = 1, 4 do
Gui.new({
FlexLove.new({
parent = container,
width = "8vw",
height = "5vh",
@@ -114,18 +113,18 @@ function Lv.load()
textAlign = enums.TextAlign.CENTER,
})
end
yOffset = yOffset + 9
end
-- ========================================
-- Section 2: Vertical Flex with Different AlignItems Values
-- ========================================
yOffset = yOffset + 2
-- Label for align-items section
Gui.new({
FlexLove.new({
x = "2vw",
y = yOffset .. "vh",
width = "96vw",
@@ -134,9 +133,9 @@ function Lv.load()
textSize = "2.5vh",
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
yOffset = yOffset + 4
-- Note: Due to space constraints, we'll show a subset in a horizontal layout
local alignOptions = {
{ name = "stretch", value = enums.AlignItems.STRETCH },
@@ -144,13 +143,13 @@ function Lv.load()
{ name = "center", value = enums.AlignItems.CENTER },
{ name = "flex-end", value = enums.AlignItems.FLEX_END },
}
local xOffset = 2
local containerWidth = 22
for _, option in ipairs(alignOptions) do
-- Label for this align option
Gui.new({
FlexLove.new({
x = xOffset .. "vw",
y = yOffset .. "vh",
width = containerWidth .. "vw",
@@ -160,9 +159,9 @@ function Lv.load()
textColor = Color.new(0.8, 1, 0.8, 1),
textAlign = enums.TextAlign.CENTER,
})
-- Container demonstrating this align-items value
local container = Gui.new({
local container = FlexLove.new({
x = xOffset .. "vw",
y = (yOffset + 3) .. "vh",
width = containerWidth .. "vw",
@@ -176,7 +175,7 @@ function Lv.load()
border = { top = true, right = true, bottom = true, left = true },
borderColor = Color.new(0.3, 0.4, 0.3, 1),
})
-- Add child elements with varying widths
local widths = { "8vw", "12vw", "6vw" }
local colors = {
@@ -184,9 +183,9 @@ function Lv.load()
Color.new(0.4, 0.9, 0.4, 1),
Color.new(0.4, 0.4, 0.9, 1),
}
for j = 1, 3 do
Gui.new({
FlexLove.new({
parent = container,
width = option.value == enums.AlignItems.STRETCH and "auto" or widths[j],
height = "4vh",
@@ -197,23 +196,20 @@ function Lv.load()
textAlign = enums.TextAlign.CENTER,
})
end
xOffset = xOffset + containerWidth + 2
end
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
-- Dark background
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end
-- Note: Mouse event handlers would be added here if needed for interactivity

View File

@@ -13,17 +13,16 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -38,7 +37,7 @@ function Lv.load()
-- Section 1: 2x2 Grid with Gaps
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "10vh",
width = "30vw",
@@ -48,7 +47,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local grid2x2 = Gui.new({
local grid2x2 = FlexLove.new({
x = "2vw",
y = "14vh",
width = "30vw",
@@ -72,7 +71,7 @@ function Lv.load()
}
for j = 1, 4 do
Gui.new({
FlexLove.new({
parent = grid2x2,
backgroundColor = colors2x2[j],
text = "Cell " .. j,
@@ -86,7 +85,7 @@ function Lv.load()
-- Section 2: 3x3 Grid with Different Gap Sizes
-- ========================================
Gui.new({
FlexLove.new({
x = "34vw",
y = "10vh",
width = "30vw",
@@ -96,7 +95,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local grid3x3 = Gui.new({
local grid3x3 = FlexLove.new({
x = "34vw",
y = "14vh",
width = "30vw",
@@ -114,7 +113,7 @@ function Lv.load()
-- Add 9 cells to 3x3 grid
for j = 1, 9 do
local hue = (j - 1) / 9
Gui.new({
FlexLove.new({
parent = grid3x3,
backgroundColor = Color.new(0.3 + hue * 0.5, 0.5, 0.7 - hue * 0.4, 1),
text = tostring(j),
@@ -128,7 +127,7 @@ function Lv.load()
-- Section 3: 4x2 Grid with AlignItems
-- ========================================
Gui.new({
FlexLove.new({
x = "66vw",
y = "10vh",
width = "32vw",
@@ -138,7 +137,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local grid4x2 = Gui.new({
local grid4x2 = FlexLove.new({
x = "66vw",
y = "14vh",
width = "32vw",
@@ -156,7 +155,7 @@ function Lv.load()
-- Add 8 cells with varying content
for j = 1, 8 do
Gui.new({
FlexLove.new({
parent = grid4x2,
backgroundColor = Color.new(0.6, 0.4 + j * 0.05, 0.7 - j * 0.05, 1),
text = "Item " .. j,
@@ -170,7 +169,7 @@ function Lv.load()
-- Section 4: Grid with Responsive Units (vw/vh gaps)
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "46vh",
width = "96vw",
@@ -180,7 +179,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local gridResponsive = Gui.new({
local gridResponsive = FlexLove.new({
x = "2vw",
y = "50vh",
width = "96vw",
@@ -198,7 +197,7 @@ function Lv.load()
-- Add 10 cells with gradient colors
for j = 1, 10 do
local progress = (j - 1) / 9
Gui.new({
FlexLove.new({
parent = gridResponsive,
backgroundColor = Color.new(
0.2 + progress * 0.6,
@@ -216,14 +215,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -13,20 +13,19 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Load the space theme
Gui.loadTheme("space", "../themes/space")
FlexLove.loadTheme("space", "../themes/space")
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -41,7 +40,7 @@ function Lv.load()
-- Section 1: Theme Components
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "10vh",
width = "96vw",
@@ -52,7 +51,7 @@ function Lv.load()
})
-- Card component
Gui.new({
FlexLove.new({
x = "2vw",
y = "14vh",
width = "30vw",
@@ -66,7 +65,7 @@ function Lv.load()
})
-- Panel component
Gui.new({
FlexLove.new({
x = "34vw",
y = "14vh",
width = "30vw",
@@ -80,7 +79,7 @@ function Lv.load()
})
-- Panel red component
Gui.new({
FlexLove.new({
x = "66vw",
y = "14vh",
width = "32vw",
@@ -97,7 +96,7 @@ function Lv.load()
-- Section 2: Button States
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "36vh",
width = "96vw",
@@ -108,7 +107,7 @@ function Lv.load()
})
-- Normal button (hover to see hover state, click to see pressed state)
Gui.new({
FlexLove.new({
x = "2vw",
y = "40vh",
width = "22vw",
@@ -127,7 +126,7 @@ function Lv.load()
})
-- Active button (simulating active state)
local activeButton = Gui.new({
local activeButton = FlexLove.new({
x = "26vw",
y = "40vh",
width = "22vw",
@@ -148,7 +147,7 @@ function Lv.load()
})
-- Disabled button
Gui.new({
FlexLove.new({
x = "50vw",
y = "40vh",
width = "22vw",
@@ -168,7 +167,7 @@ function Lv.load()
-- Button with callback feedback
local clickCount = 0
local counterButton = Gui.new({
local counterButton = FlexLove.new({
x = "74vw",
y = "40vh",
width = "24vw",
@@ -191,7 +190,7 @@ function Lv.load()
-- Section 3: Theme Colors and Fonts
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "50vh",
width = "96vw",
@@ -202,7 +201,7 @@ function Lv.load()
})
-- Container showing theme colors
local colorContainer = Gui.new({
local colorContainer = FlexLove.new({
x = "2vw",
y = "54vh",
width = "96vw",
@@ -217,7 +216,7 @@ function Lv.load()
})
-- Primary color swatch
Gui.new({
FlexLove.new({
parent = colorContainer,
width = "20vw",
height = "15vh",
@@ -230,7 +229,7 @@ function Lv.load()
})
-- Secondary color swatch
Gui.new({
FlexLove.new({
parent = colorContainer,
width = "20vw",
height = "15vh",
@@ -243,7 +242,7 @@ function Lv.load()
})
-- Text color swatch
Gui.new({
FlexLove.new({
parent = colorContainer,
width = "20vw",
height = "15vh",
@@ -256,7 +255,7 @@ function Lv.load()
})
-- Text dark color swatch
Gui.new({
FlexLove.new({
parent = colorContainer,
width = "20vw",
height = "15vh",
@@ -272,7 +271,7 @@ function Lv.load()
-- Section 4: Font Family from Theme
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "76vh",
width = "96vw",
@@ -288,14 +287,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -14,17 +14,16 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -39,7 +38,7 @@ function Lv.load()
-- Section 1: Viewport Width Units (vw)
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "10vh",
width = "96vw",
@@ -49,7 +48,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local vwContainer = Gui.new({
local vwContainer = FlexLove.new({
x = "2vw",
y = "14vh",
width = "96vw",
@@ -73,7 +72,7 @@ function Lv.load()
}
for i, width in ipairs(vwWidths) do
Gui.new({
FlexLove.new({
parent = vwContainer,
width = width,
height = "8vh",
@@ -89,7 +88,7 @@ function Lv.load()
-- Section 2: Viewport Height Units (vh)
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "28vh",
width = "96vw",
@@ -99,7 +98,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local vhContainer = Gui.new({
local vhContainer = FlexLove.new({
x = "2vw",
y = "32vh",
width = "96vw",
@@ -118,7 +117,7 @@ function Lv.load()
for i, height in ipairs(vhHeights) do
local hue = (i - 1) / 4
Gui.new({
FlexLove.new({
parent = vhContainer,
width = "16vw",
height = height,
@@ -134,7 +133,7 @@ function Lv.load()
-- Section 3: Percentage Units (%)
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "64vh",
width = "46vw",
@@ -144,7 +143,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local percentContainer = Gui.new({
local percentContainer = FlexLove.new({
x = "2vw",
y = "68vh",
width = "46vw",
@@ -164,7 +163,7 @@ function Lv.load()
for i, width in ipairs(percentWidths) do
local progress = (i - 1) / 3
Gui.new({
FlexLove.new({
parent = percentContainer,
width = width,
height = "5vh",
@@ -180,7 +179,7 @@ function Lv.load()
-- Section 4: Pixel Units (px) - Fixed Size
-- ========================================
Gui.new({
FlexLove.new({
x = "50vw",
y = "64vh",
width = "48vw",
@@ -190,7 +189,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local pxContainer = Gui.new({
local pxContainer = FlexLove.new({
x = "50vw",
y = "68vh",
width = "48vw",
@@ -213,7 +212,7 @@ function Lv.load()
}
for i, size in ipairs(pxSizes) do
Gui.new({
FlexLove.new({
parent = pxContainer,
width = size.w,
height = size.h,
@@ -228,14 +227,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -13,7 +13,6 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local Animation = FlexLove.Animation
local enums = FlexLove.enums
@@ -22,12 +21,12 @@ local enums = FlexLove.enums
local fadeBox, scaleBox, easingBoxes
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -42,7 +41,7 @@ function Lv.load()
-- Section 1: Fade Animation
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "10vh",
width = "46vw",
@@ -52,7 +51,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
fadeBox = Gui.new({
fadeBox = FlexLove.new({
x = "2vw",
y = "14vh",
width = "46vw",
@@ -88,7 +87,7 @@ function Lv.load()
-- Section 2: Scale Animation
-- ========================================
Gui.new({
FlexLove.new({
x = "50vw",
y = "10vh",
width = "48vw",
@@ -98,7 +97,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
scaleBox = Gui.new({
scaleBox = FlexLove.new({
x = "50vw",
y = "14vh",
width = 400,
@@ -142,7 +141,7 @@ function Lv.load()
-- Section 3: Easing Functions Comparison
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "36vh",
width = "96vw",
@@ -152,7 +151,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local easingContainer = Gui.new({
local easingContainer = FlexLove.new({
x = "2vw",
y = "40vh",
width = "96vw",
@@ -185,7 +184,7 @@ function Lv.load()
for i, easing in ipairs(easings) do
local hue = (i - 1) / 8
local box = Gui.new({
local box = FlexLove.new({
parent = easingContainer,
backgroundColor = Color.new(0.2 + hue * 0.6, 0.4 + math.sin(hue * 3.14) * 0.4, 0.8 - hue * 0.4, 1),
text = easing.name,
@@ -234,14 +233,14 @@ function Lv.update(dt)
end
end
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -14,7 +14,6 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
@@ -30,12 +29,12 @@ local function addLogEntry(text)
end
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -50,7 +49,7 @@ function Lv.load()
-- Section 1: Click Events
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "10vh",
width = "46vw",
@@ -60,7 +59,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local clickBox = Gui.new({
local clickBox = FlexLove.new({
x = "2vw",
y = "14vh",
width = "46vw",
@@ -92,7 +91,7 @@ function Lv.load()
-- Section 2: Keyboard Modifiers
-- ========================================
Gui.new({
FlexLove.new({
x = "50vw",
y = "10vh",
width = "48vw",
@@ -102,7 +101,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local modifierBox = Gui.new({
local modifierBox = FlexLove.new({
x = "50vw",
y = "14vh",
width = "48vw",
@@ -131,7 +130,7 @@ function Lv.load()
-- Section 3: Double-Click Detection
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "36vh",
width = "46vw",
@@ -141,7 +140,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local doubleClickBox = Gui.new({
local doubleClickBox = FlexLove.new({
x = "2vw",
y = "40vh",
width = "46vw",
@@ -175,7 +174,7 @@ function Lv.load()
-- Section 4: Event Log Display
-- ========================================
Gui.new({
FlexLove.new({
x = "50vw",
y = "36vh",
width = "48vw",
@@ -186,7 +185,7 @@ function Lv.load()
})
-- Event log container
local logContainer = Gui.new({
local logContainer = FlexLove.new({
x = "50vw",
y = "40vh",
width = "48vw",
@@ -201,7 +200,7 @@ function Lv.load()
-- Section 5: Interactive Buttons
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "57vh",
width = "46vw",
@@ -211,7 +210,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local buttonContainer = Gui.new({
local buttonContainer = FlexLove.new({
x = "2vw",
y = "61vh",
width = "46vw",
@@ -228,7 +227,7 @@ function Lv.load()
})
-- Button 1: Press/Release events
Gui.new({
FlexLove.new({
parent = buttonContainer,
height = "8vh",
backgroundColor = Color.new(0.4, 0.5, 0.8, 1),
@@ -250,7 +249,7 @@ function Lv.load()
-- Button 2: Click counter
local clickCounter = 0
Gui.new({
FlexLove.new({
parent = buttonContainer,
height = "8vh",
backgroundColor = Color.new(0.8, 0.5, 0.4, 1),
@@ -269,7 +268,7 @@ function Lv.load()
})
-- Button 3: Clear log
Gui.new({
FlexLove.new({
parent = buttonContainer,
height = "8vh",
backgroundColor = Color.new(0.6, 0.4, 0.6, 1),
@@ -294,12 +293,12 @@ function Lv.update(dt)
doubleClickBox._resetTime = nil
end
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
-- Draw event log
Lv.graphics.setColor(0.8, 0.9, 1, 1)
@@ -315,5 +314,5 @@ function Lv.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -13,17 +13,16 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -38,7 +37,7 @@ function Lv.load()
-- Section 1: Text Alignment
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "10vh",
width = "96vw",
@@ -57,7 +56,7 @@ function Lv.load()
local yOffset = 14
for _, align in ipairs(alignments) do
Gui.new({
FlexLove.new({
x = "2vw",
y = yOffset .. "vh",
width = "30vw",
@@ -78,7 +77,7 @@ function Lv.load()
-- Section 2: Text Size Presets
-- ========================================
Gui.new({
FlexLove.new({
x = "34vw",
y = "10vh",
width = "64vw",
@@ -100,7 +99,7 @@ function Lv.load()
{ name = "4XL", value = "4xl" },
}
local sizeContainer = Gui.new({
local sizeContainer = FlexLove.new({
x = "34vw",
y = "14vh",
width = "64vw",
@@ -118,7 +117,7 @@ function Lv.load()
for i, size in ipairs(textSizes) do
local hue = (i - 1) / 8
Gui.new({
FlexLove.new({
parent = sizeContainer,
height = "7vh",
backgroundColor = Color.new(0.2 + hue * 0.3, 0.3 + hue * 0.2, 0.5 - hue * 0.2, 1),
@@ -134,7 +133,7 @@ function Lv.load()
-- Section 3: Custom Font Sizes (vh units)
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "41vh",
width = "30vw",
@@ -146,7 +145,7 @@ function Lv.load()
local customSizes = { "1vh", "2vh", "3vh", "4vh", "5vh" }
local customContainer = Gui.new({
local customContainer = FlexLove.new({
x = "2vw",
y = "45vh",
width = "30vw",
@@ -162,7 +161,7 @@ function Lv.load()
})
for i, size in ipairs(customSizes) do
Gui.new({
FlexLove.new({
parent = customContainer,
backgroundColor = Color.new(0.3, 0.4 + i * 0.08, 0.6 - i * 0.08, 1),
text = size .. " text",
@@ -176,14 +175,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -13,17 +13,16 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -38,7 +37,7 @@ function Lv.load()
-- Section 1: Absolute Positioning
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "10vh",
width = "46vw",
@@ -48,7 +47,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local absoluteContainer = Gui.new({
local absoluteContainer = FlexLove.new({
x = "2vw",
y = "14vh",
width = "46vw",
@@ -60,7 +59,7 @@ function Lv.load()
})
-- Absolute positioned children
Gui.new({
FlexLove.new({
parent = absoluteContainer,
x = 20,
y = 20,
@@ -75,7 +74,7 @@ function Lv.load()
cornerRadius = 5,
})
Gui.new({
FlexLove.new({
parent = absoluteContainer,
x = 200,
y = 50,
@@ -90,7 +89,7 @@ function Lv.load()
cornerRadius = 5,
})
Gui.new({
FlexLove.new({
parent = absoluteContainer,
x = 100,
y = 150,
@@ -105,7 +104,7 @@ function Lv.load()
cornerRadius = 5,
})
Gui.new({
FlexLove.new({
parent = absoluteContainer,
x = 280,
y = 180,
@@ -124,7 +123,7 @@ function Lv.load()
-- Section 2: Relative Positioning
-- ========================================
Gui.new({
FlexLove.new({
x = "50vw",
y = "10vh",
width = "48vw",
@@ -134,7 +133,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local relativeContainer = Gui.new({
local relativeContainer = FlexLove.new({
x = "50vw",
y = "14vh",
width = "48vw",
@@ -155,7 +154,7 @@ function Lv.load()
}
for i = 1, 4 do
Gui.new({
FlexLove.new({
parent = relativeContainer,
width = "45%",
height = "8vh",
@@ -174,7 +173,7 @@ function Lv.load()
-- Section 3: Comparison with Overlapping
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "56vh",
width = "96vw",
@@ -184,7 +183,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local overlapContainer = Gui.new({
local overlapContainer = FlexLove.new({
x = "2vw",
y = "60vh",
width = "96vw",
@@ -204,7 +203,7 @@ function Lv.load()
}
for i = 1, 4 do
Gui.new({
FlexLove.new({
parent = overlapContainer,
x = 50 + (i - 1) * 60,
y = 30 + (i - 1) * 40,
@@ -223,14 +222,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -14,17 +14,16 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -39,7 +38,7 @@ function Lv.load()
-- Section 1: Corner Radius
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "9vh",
width = "46vw",
@@ -50,7 +49,7 @@ function Lv.load()
})
-- Uniform corner radius
Gui.new({
FlexLove.new({
x = "2vw",
y = "13vh",
width = "14vw",
@@ -63,7 +62,7 @@ function Lv.load()
textAlign = enums.TextAlign.CENTER,
})
Gui.new({
FlexLove.new({
x = "17vw",
y = "13vh",
width = "14vw",
@@ -77,7 +76,7 @@ function Lv.load()
})
-- Individual corner radius
Gui.new({
FlexLove.new({
x = "32vw",
y = "13vh",
width = "16vw",
@@ -99,7 +98,7 @@ function Lv.load()
-- Section 2: Borders
-- ========================================
Gui.new({
FlexLove.new({
x = "50vw",
y = "9vh",
width = "48vw",
@@ -110,7 +109,7 @@ function Lv.load()
})
-- All borders
Gui.new({
FlexLove.new({
x = "50vw",
y = "13vh",
width = "14vw",
@@ -125,7 +124,7 @@ function Lv.load()
})
-- Top and bottom borders
Gui.new({
FlexLove.new({
x = "65vw",
y = "13vh",
width = "14vw",
@@ -140,7 +139,7 @@ function Lv.load()
})
-- Left border only
Gui.new({
FlexLove.new({
x = "80vw",
y = "13vh",
width = "16vw",
@@ -158,7 +157,7 @@ function Lv.load()
-- Section 3: Opacity
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "27vh",
width = "96vw",
@@ -171,7 +170,7 @@ function Lv.load()
local opacityLevels = { 1.0, 0.75, 0.5, 0.25 }
for i, opacity in ipairs(opacityLevels) do
Gui.new({
FlexLove.new({
x = (2 + (i - 1) * 24) .. "vw",
y = "31vh",
width = "22vw",
@@ -190,7 +189,7 @@ function Lv.load()
-- Section 4: Background Colors
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "45vh",
width = "96vw",
@@ -203,7 +202,7 @@ function Lv.load()
-- Gradient-like colors
for i = 1, 8 do
local hue = (i - 1) / 7
Gui.new({
FlexLove.new({
x = (2 + (i - 1) * 12) .. "vw",
y = "49vh",
width = "11vw",
@@ -226,7 +225,7 @@ function Lv.load()
-- Section 5: Blur Effects (if supported)
-- ========================================
Gui.new({
FlexLove.new({
x = "2vw",
y = "69vh",
width = "96vw",
@@ -237,7 +236,7 @@ function Lv.load()
})
-- Content blur example
Gui.new({
FlexLove.new({
x = "2vw",
y = "73vh",
width = "46vw",
@@ -252,7 +251,7 @@ function Lv.load()
})
-- Backdrop blur example
Gui.new({
FlexLove.new({
x = "50vw",
y = "73vh",
width = "46vw",
@@ -268,14 +267,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -14,17 +14,16 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -36,7 +35,7 @@ function Lv.load()
})
-- Section 1: Padding Examples
Gui.new({
FlexLove.new({
x = "2vw",
y = "9vh",
width = "46vw",
@@ -47,7 +46,7 @@ function Lv.load()
})
-- Uniform padding
local container1 = Gui.new({
local container1 = FlexLove.new({
x = "2vw",
y = "13vh",
width = "22vw",
@@ -56,7 +55,7 @@ function Lv.load()
padding = { top = 20, right = 20, bottom = 20, left = 20 },
})
Gui.new({
FlexLove.new({
parent = container1,
width = "auto",
height = "auto",
@@ -68,7 +67,7 @@ function Lv.load()
})
-- Individual padding sides
local container2 = Gui.new({
local container2 = FlexLove.new({
x = "26vw",
y = "13vh",
width = "22vw",
@@ -77,7 +76,7 @@ function Lv.load()
padding = { top = 30, right = 10, bottom = 30, left = 10 },
})
Gui.new({
FlexLove.new({
parent = container2,
width = "auto",
height = "auto",
@@ -89,7 +88,7 @@ function Lv.load()
})
-- Section 2: Margin Examples
Gui.new({
FlexLove.new({
x = "50vw",
y = "9vh",
width = "48vw",
@@ -100,7 +99,7 @@ function Lv.load()
})
-- Container to show margins
local marginContainer = Gui.new({
local marginContainer = FlexLove.new({
x = "50vw",
y = "13vh",
width = "46vw",
@@ -111,7 +110,7 @@ function Lv.load()
})
-- Elements with different margins
Gui.new({
FlexLove.new({
parent = marginContainer,
width = "40vw",
height = "6vh",
@@ -123,7 +122,7 @@ function Lv.load()
textAlign = enums.TextAlign.CENTER,
})
Gui.new({
FlexLove.new({
parent = marginContainer,
width = "40vw",
height = "6vh",
@@ -135,7 +134,7 @@ function Lv.load()
textAlign = enums.TextAlign.CENTER,
})
Gui.new({
FlexLove.new({
parent = marginContainer,
width = "40vw",
height = "6vh",
@@ -148,7 +147,7 @@ function Lv.load()
})
-- Section 3: Combined Padding and Margins
Gui.new({
FlexLove.new({
x = "2vw",
y = "33vh",
width = "46vw",
@@ -158,7 +157,7 @@ function Lv.load()
textColor = Color.new(0.9, 0.9, 0.9, 1),
})
local combinedContainer = Gui.new({
local combinedContainer = FlexLove.new({
x = "2vw",
y = "37vh",
width = "46vw",
@@ -170,7 +169,7 @@ function Lv.load()
})
for i = 1, 3 do
local box = Gui.new({
local box = FlexLove.new({
parent = combinedContainer,
width = "auto",
height = "14vh",
@@ -179,7 +178,7 @@ function Lv.load()
padding = { top = 15, right = 15, bottom = 15, left = 15 },
})
Gui.new({
FlexLove.new({
parent = box,
width = "auto",
height = "auto",
@@ -193,14 +192,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -12,17 +12,16 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -34,7 +33,7 @@ function Lv.load()
})
-- Note: Input controls may require additional setup in FlexLove
Gui.new({
FlexLove.new({
x = "2vw",
y = "10vh",
width = "96vw",
@@ -47,7 +46,7 @@ function Lv.load()
-- Interactive buttons
local counter = 0
local counterDisplay = Gui.new({
local counterDisplay = FlexLove.new({
x = "35vw",
y = "20vh",
width = "30vw",
@@ -61,7 +60,7 @@ function Lv.load()
})
-- Increment button
Gui.new({
FlexLove.new({
x = "20vw",
y = "35vh",
width = "20vw",
@@ -79,7 +78,7 @@ function Lv.load()
})
-- Decrement button
Gui.new({
FlexLove.new({
x = "60vw",
y = "35vh",
width = "20vw",
@@ -97,7 +96,7 @@ function Lv.load()
})
-- Reset button
Gui.new({
FlexLove.new({
x = "40vw",
y = "46vh",
width = "20vw",
@@ -115,7 +114,7 @@ function Lv.load()
})
-- Keyboard input info
Gui.new({
FlexLove.new({
x = "2vw",
y = "60vh",
width = "96vw",
@@ -136,14 +135,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -12,17 +12,16 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 }
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -34,7 +33,7 @@ function Lv.load()
})
-- Description
Gui.new({
FlexLove.new({
x = "2vw",
y = "10vh",
width = "96vw",
@@ -46,7 +45,7 @@ function Lv.load()
})
-- Section 1: Overlapping boxes with different z-index
Gui.new({
FlexLove.new({
x = "2vw",
y = "15vh",
width = "46vw",
@@ -57,7 +56,7 @@ function Lv.load()
})
-- Box 1 (z-index: 1)
Gui.new({
FlexLove.new({
x = "5vw",
y = "20vh",
width = "20vw",
@@ -72,7 +71,7 @@ function Lv.load()
})
-- Box 2 (z-index: 2) - overlaps Box 1
Gui.new({
FlexLove.new({
x = "12vw",
y = "25vh",
width = "20vw",
@@ -87,7 +86,7 @@ function Lv.load()
})
-- Box 3 (z-index: 3) - overlaps Box 1 and 2
Gui.new({
FlexLove.new({
x = "19vw",
y = "30vh",
width = "20vw",
@@ -102,7 +101,7 @@ function Lv.load()
})
-- Section 2: Cards with different layers
Gui.new({
FlexLove.new({
x = "50vw",
y = "15vh",
width = "48vw",
@@ -114,7 +113,7 @@ function Lv.load()
-- Create a stack of cards
for i = 1, 5 do
Gui.new({
FlexLove.new({
x = (52 + i * 2) .. "vw",
y = (18 + i * 3) .. "vh",
width = "22vw",
@@ -132,7 +131,7 @@ function Lv.load()
end
-- Section 3: Interactive z-index demo
Gui.new({
FlexLove.new({
x = "2vw",
y = "53vh",
width = "96vw",
@@ -146,7 +145,7 @@ function Lv.load()
-- Create interactive boxes
for i = 1, 4 do
local box = Gui.new({
local box = FlexLove.new({
x = (5 + (i - 1) * 22) .. "vw",
y = "58vh",
width = "20vw",
@@ -174,7 +173,7 @@ function Lv.load()
end
-- Info text
Gui.new({
FlexLove.new({
x = "2vw",
y = "82vh",
width = "96vw",
@@ -191,14 +190,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -14,19 +14,18 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local Animation = FlexLove.Animation
local enums = FlexLove.enums
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 },
theme = "space"
})
-- Header
local header = Gui.new({
local header = FlexLove.new({
x = 0,
y = 0,
width = "100vw",
@@ -42,7 +41,7 @@ function Lv.load()
})
-- Logo/Title
Gui.new({
FlexLove.new({
parent = header,
width = "auto",
height = "auto",
@@ -52,7 +51,7 @@ function Lv.load()
})
-- Header buttons
local headerButtons = Gui.new({
local headerButtons = FlexLove.new({
parent = header,
width = "auto",
height = "auto",
@@ -63,7 +62,7 @@ function Lv.load()
local buttonNames = { "Home", "Features", "About" }
for _, name in ipairs(buttonNames) do
Gui.new({
FlexLove.new({
parent = headerButtons,
width = "8vw",
height = "6vh",
@@ -78,7 +77,7 @@ function Lv.load()
end
-- Main content area
local mainContent = Gui.new({
local mainContent = FlexLove.new({
x = 0,
y = "12vh",
width = "100vw",
@@ -89,7 +88,7 @@ function Lv.load()
})
-- Sidebar
local sidebar = Gui.new({
local sidebar = FlexLove.new({
parent = mainContent,
width = "20vw",
height = "88vh",
@@ -112,7 +111,7 @@ function Lv.load()
}
for _, item in ipairs(menuItems) do
local menuButton = Gui.new({
local menuButton = FlexLove.new({
parent = sidebar,
width = "auto",
height = "7vh",
@@ -124,7 +123,7 @@ function Lv.load()
cornerRadius = 5,
})
Gui.new({
FlexLove.new({
parent = menuButton,
width = "auto",
height = "auto",
@@ -135,7 +134,7 @@ function Lv.load()
end
-- Content panel
local contentPanel = Gui.new({
local contentPanel = FlexLove.new({
parent = mainContent,
width = "80vw",
height = "88vh",
@@ -146,7 +145,7 @@ function Lv.load()
})
-- Welcome section
Gui.new({
FlexLove.new({
parent = contentPanel,
width = "auto",
height = "auto",
@@ -156,7 +155,7 @@ function Lv.load()
})
-- Stats grid
local statsGrid = Gui.new({
local statsGrid = FlexLove.new({
parent = contentPanel,
width = "auto",
height = "20vh",
@@ -174,7 +173,7 @@ function Lv.load()
}
for _, stat in ipairs(stats) do
local statCard = Gui.new({
local statCard = FlexLove.new({
parent = statsGrid,
positioning = enums.Positioning.FLEX,
flexDirection = enums.FlexDirection.VERTICAL,
@@ -185,7 +184,7 @@ function Lv.load()
padding = { top = 15, right = 15, bottom = 15, left = 15 },
})
Gui.new({
FlexLove.new({
parent = statCard,
width = "auto",
height = "auto",
@@ -195,7 +194,7 @@ function Lv.load()
textAlign = enums.TextAlign.CENTER,
})
Gui.new({
FlexLove.new({
parent = statCard,
width = "auto",
height = "auto",
@@ -207,7 +206,7 @@ function Lv.load()
end
-- Feature cards
local cardsContainer = Gui.new({
local cardsContainer = FlexLove.new({
parent = contentPanel,
width = "auto",
height = "auto",
@@ -228,7 +227,7 @@ function Lv.load()
}
for i, feature in ipairs(features) do
local card = Gui.new({
local card = FlexLove.new({
parent = cardsContainer,
positioning = enums.Positioning.FLEX,
justifyContent = enums.JustifyContent.CENTER,
@@ -238,7 +237,7 @@ function Lv.load()
padding = { top = 20, right = 20, bottom = 20, left = 20 },
})
Gui.new({
FlexLove.new({
parent = card,
width = "auto",
height = "auto",
@@ -261,14 +260,14 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -16,7 +16,6 @@
local Lv = love
local FlexLove = require("../FlexLove")
local Gui = FlexLove.Gui
local Color = FlexLove.Color
local enums = FlexLove.enums
@@ -45,7 +44,7 @@ local temperatureHandle
---@return table -- Returns { bg, handle, valueText }
local function createSlider(x, y, width, label, min, max, initialValue, onValueChange)
-- Container for the slider
local container = Gui.new({
local container = FlexLove.new({
x = x,
y = y,
width = width,
@@ -56,7 +55,7 @@ local function createSlider(x, y, width, label, min, max, initialValue, onValueC
})
-- Label
Gui.new({
FlexLove.new({
parent = container,
height = "3vh",
text = label,
@@ -65,7 +64,7 @@ local function createSlider(x, y, width, label, min, max, initialValue, onValueC
})
-- Slider track background
local sliderBg = Gui.new({
local sliderBg = FlexLove.new({
parent = container,
height = "4vh",
backgroundColor = Color.new(0.2, 0.2, 0.25, 1),
@@ -75,7 +74,7 @@ local function createSlider(x, y, width, label, min, max, initialValue, onValueC
-- Slider handle
local normalized = (initialValue - min) / (max - min)
local handle = Gui.new({
local handle = FlexLove.new({
parent = sliderBg,
x = (normalized * 95) .. "%",
y = "50%",
@@ -89,7 +88,7 @@ local function createSlider(x, y, width, label, min, max, initialValue, onValueC
})
-- Value display
local valueText = Gui.new({
local valueText = FlexLove.new({
parent = container,
height = "3vh",
text = string.format("%.2f", initialValue),
@@ -144,12 +143,12 @@ local function createSlider(x, y, width, label, min, max, initialValue, onValueC
end
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 },
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -161,7 +160,7 @@ function Lv.load()
})
-- Subtitle
Gui.new({
FlexLove.new({
x = "2vw",
y = "9vh",
width = "96vw",
@@ -194,7 +193,7 @@ function Lv.load()
temperatureHandle = temperatureSlider.handle
-- Visual feedback section
Gui.new({
FlexLove.new({
x = "10vw",
y = "70vh",
width = "80vw",
@@ -205,7 +204,7 @@ function Lv.load()
})
-- Volume visualization
Gui.new({
FlexLove.new({
x = "10vw",
y = "75vh",
width = "25vw",
@@ -217,7 +216,7 @@ function Lv.load()
})
-- Brightness visualization
Gui.new({
FlexLove.new({
x = "37.5vw",
y = "75vh",
width = "25vw",
@@ -229,7 +228,7 @@ function Lv.load()
})
-- Temperature visualization
Gui.new({
FlexLove.new({
x = "65vw",
y = "75vh",
width = "25vw",
@@ -242,12 +241,12 @@ function Lv.load()
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
Lv.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
-- Draw volume visualization (speaker icon with bars)
local volumeX = Lv.graphics.getWidth() * 0.10 + 20
@@ -302,5 +301,5 @@ function Lv.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end

View File

@@ -1,19 +1,18 @@
-- Example 15: Scrollable Elements
-- Demonstrates scrollable containers with overflow detection and visual scrollbars
local FlexLove = require("FlexLove")
local Gui = FlexLove.Gui
local FlexLove = require("../FlexLove")
local Color = FlexLove.Color
local enums = FlexLove.enums
local Lv = love
function Lv.load()
Gui.init({
FlexLove.init({
baseScale = { width = 1920, height = 1080 },
})
-- Title
Gui.new({
FlexLove.new({
x = "2vw",
y = "2vh",
width = "96vw",
@@ -25,7 +24,7 @@ function Lv.load()
})
-- Example 1: Vertical scroll with auto scrollbars
local verticalScroll = Gui.new({
local verticalScroll = FlexLove.new({
x = "5vw",
y = "12vh",
width = "25vw",
@@ -41,7 +40,7 @@ function Lv.load()
-- Add many items to create overflow
for i = 1, 20 do
Gui.new({
FlexLove.new({
parent = verticalScroll,
height = "5vh",
backgroundColor = Color.new(0.3 + (i % 3) * 0.1, 0.4, 0.6, 1),
@@ -53,7 +52,7 @@ function Lv.load()
end
-- Example 2: Custom styled scrollbar
local customScroll = Gui.new({
local customScroll = FlexLove.new({
x = "35vw",
y = "12vh",
width = "60vw",
@@ -73,7 +72,7 @@ function Lv.load()
-- Add content
for i = 1, 25 do
Gui.new({
FlexLove.new({
parent = customScroll,
height = "6vh",
backgroundColor = Color.new(0.2, 0.25, 0.3, 1),
@@ -85,7 +84,7 @@ function Lv.load()
end
-- Instructions
Gui.new({
FlexLove.new({
x = "5vw",
y = "52vh",
width = "90vw",
@@ -110,18 +109,18 @@ Scrollbar colors change on hover and when dragging!]],
end
function Lv.update(dt)
Gui.update(dt)
FlexLove.update(dt)
end
function Lv.draw()
love.graphics.clear(0.05, 0.05, 0.08, 1)
Gui.draw()
FlexLove.draw()
end
function Lv.resize(w, h)
Gui.resize(w, h)
FlexLove.resize(w, h)
end
function Lv.wheelmoved(x, y)
Gui.wheelmoved(x, y)
FlexLove.wheelmoved(x, y)
end

View File

@@ -4,7 +4,7 @@ Simple input field demo - multiple fields to test all features
Uses retained mode - elements are created once and reused
--]]
local FlexLove = require("libs.FlexLove")
local FlexLove = require("../FlexLove")
local Element = FlexLove.Element
local Color = FlexLove.Color