fix layout

This commit is contained in:
Michael Freno
2025-12-12 15:53:31 -05:00
parent aff4a519b2
commit b714b6204c
2 changed files with 27 additions and 102 deletions

View File

@@ -1,85 +0,0 @@
package = "flexlove"
version = "0.6.1-1"
source = {
url = "git+https://github.com/mikefreno/FlexLove.git",
tag = "v0.6.1",
}
description = {
summary = "A comprehensive UI library providing flexbox/grid layouts, theming, animations, and event handling for LÖVE2D games",
detailed = [[
FlexLöve is a lightweight, flexible GUI library for LÖVE2D that implements a
flexbox-based layout system. The goals of this project are two-fold: first,
anyone with basic CSS knowledge should be able to use this library with minimal
learning curve. Second, this library should take you from early prototyping to
production.
Features:
- Flexbox and Grid Layout systems
- Modern theming with 9-patch support
- Animations and transitions
- Image rendering with CSS-like object-fit
- Touch events and gesture recognition
- Text input with rich editing features
- Responsive design with viewport units
- Both immediate and retained rendering modes
Going this route, you will need to link the luarocks path to your project:
(for mac/linux)
```lua
package.path = package.path .. ";/Users/<username>/.luarocks/share/lua/<version>/?.lua"
package.path = package.path .. ";/Users/<username>/.luarocks/share/lua/<version>/?/init.lua"
package.cpath = package.cpath .. ";/Users/<username>/.luarocks/lib/lua/<version>/?.so"
```
]],
homepage = "https://mikefreno.github.io/FlexLove/",
license = "MIT",
maintainer = "Mike Freno",
}
dependencies = {
"lua >= 5.1",
"luautf8 >= 0.1.3",
}
build = {
type = "builtin",
modules = {
["FlexLove"] = "FlexLove.lua",
["FlexLove.modules.Animation"] = "modules/Animation.lua",
["FlexLove.modules.Blur"] = "modules/Blur.lua",
["FlexLove.modules.Calc"] = "modules/Calc.lua",
["FlexLove.modules.Color"] = "modules/Color.lua",
["FlexLove.modules.Context"] = "modules/Context.lua",
["FlexLove.modules.Element"] = "modules/Element.lua",
["FlexLove.modules.ErrorHandler"] = "modules/ErrorHandler.lua",
["FlexLove.modules.EventHandler"] = "modules/EventHandler.lua",
["FlexLove.modules.FFI"] = "modules/FFI.lua",
["FlexLove.modules.GestureRecognizer"] = "modules/GestureRecognizer.lua",
["FlexLove.modules.Grid"] = "modules/Grid.lua",
["FlexLove.modules.ImageCache"] = "modules/ImageCache.lua",
["FlexLove.modules.ImageRenderer"] = "modules/ImageRenderer.lua",
["FlexLove.modules.ImageScaler"] = "modules/ImageScaler.lua",
["FlexLove.modules.InputEvent"] = "modules/InputEvent.lua",
["FlexLove.modules.LayoutEngine"] = "modules/LayoutEngine.lua",
["FlexLove.modules.MemoryScanner"] = "modules/MemoryScanner.lua",
["FlexLove.modules.ModuleLoader"] = "modules/ModuleLoader.lua",
["FlexLove.modules.NinePatch"] = "modules/NinePatch.lua",
["FlexLove.modules.Performance"] = "modules/Performance.lua",
["FlexLove.modules.Renderer"] = "modules/Renderer.lua",
["FlexLove.modules.RoundedRect"] = "modules/RoundedRect.lua",
["FlexLove.modules.ScrollManager"] = "modules/ScrollManager.lua",
["FlexLove.modules.StateManager"] = "modules/StateManager.lua",
["FlexLove.modules.TextEditor"] = "modules/TextEditor.lua",
["FlexLove.modules.Theme"] = "modules/Theme.lua",
["FlexLove.modules.types"] = "modules/types.lua",
["FlexLove.modules.Units"] = "modules/Units.lua",
["FlexLove.modules.UTF8"] = "modules/UTF8.lua",
["FlexLove.modules.utils"] = "modules/utils.lua",
},
--copy_directories = {
--"docs",
--"examples",
--},
}

View File

@@ -158,10 +158,8 @@ local function buildMenu()
alignItems = "center",
height = "100%",
width = "100%",
gap = 30,
})
-- Subtitle
FlexLove.new({
parent = container,
text = "Select a profile to run:",
@@ -169,17 +167,35 @@ local function buildMenu()
textColor = FlexLove.Color.new(0.8, 0.8, 0.8, 1),
})
-- Profile list
local profileList = FlexLove.new({
local centerContainer = FlexLove.new({
parent = container,
width = "80%",
height = "80%",
height = "100%",
width = "100%",
positioning = "flex",
flexDirection = "horizontal",
justifyContent = "space-evenly",
alignItems = "flex-start",
})
FlexLove.new({
parent = centerContainer,
text = "Use arrow keys to select, ENTER to run, ESC to quit",
textSize = "lg",
textColor = FlexLove.Color.new(0.5, 0.5, 0.5, 1),
textWrap = "word",
width = "10%",
})
local profileList = FlexLove.new({
parent = centerContainer,
width = 500,
height = "100%",
positioning = "flex",
flexDirection = "vertical",
gap = 10,
padding = { vertical = 20, horizontal = 20 },
overflowY = "scroll",
--mode = "retained",
flexShrink = 0,
})
for i, profile in ipairs(state.profiles) do
@@ -187,7 +203,8 @@ local function buildMenu()
local isHovered = i == state.hoveredIndex
local button = FlexLove.new({
parent = profileList,
width = "50%",
width = "90%",
margin = { left = "5%" },
height = 50,
backgroundColor = isSelected and FlexLove.Color.new(0.2, 0.4, 0.8, 1)
or isHovered and FlexLove.Color.new(0.2, 0.2, 0.35, 1)
@@ -196,7 +213,6 @@ local function buildMenu()
positioning = "flex",
justifyContent = "center",
alignItems = "center",
alignSelf = "center",
z = 100,
padding = { horizontal = 15, vertical = 15 },
onEvent = function(_, event)
@@ -220,17 +236,11 @@ local function buildMenu()
textColor = isSelected and FlexLove.Color.new(1, 1, 1, 1) or FlexLove.Color.new(0.8, 0.8, 0.8, 1),
})
end
-- Instructions
FlexLove.new({
parent = container,
text = "Use ↑/↓ to select, ENTER to run, ESC to quit",
textSize = "md",
textColor = FlexLove.Color.new(0.5, 0.5, 0.5, 1),
margin = { top = 20 },
parent = centerContainer,
width = "10%",
})
-- Error display
if state.error then
local errorBox = FlexLove.new({
parent = container,