rewrites existing UI to luigi

This commit is contained in:
duncathan 2019-09-10 23:35:41 -06:00
parent ac8015b2f0
commit 6eb4b0ccc8
4 changed files with 52 additions and 56 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -1,10 +1,6 @@
local Terebi = require 'lib.terebi'
local Luigi = require 'lib.luigi.layout' local Luigi = require 'lib.luigi.layout'
local background local background
local font
local screen
local status
local C = Class:extend() local C = Class:extend()
@ -12,40 +8,23 @@ local layout = Luigi(require 'layout')
layout:setStyle(require 'style') layout:setStyle(require 'style')
function C:setup() function C:setup()
Terebi.initializeLoveDefaults()
screen = Terebi.newScreen(320, 240, 2)
background = lg.newImage('assets/background.png') background = lg.newImage('assets/background.png')
font = lg.newFont('assets/monogram_extended.ttf', 16) self:setStatus("Drag and drop your Cave Story folder here.")
font:setFilter('nearest', 'nearest', 1)
status = "Drag and drop your Cave Story folder here."
end end
local function _print(text, x, y, align) layout.version.text = 'Cave Story Randomizer [Open Mode] v' .. VERSION
align = align or 'center' layout.author.text = 'by shru and duncathan'
lg.setFont(font) layout.twitter.text = '(@shruuu and @duncathan_salt)'
local limit = 320 - (x * 2)
lg.setColor(0, 0, 0)
lg.printf(text, x + 1, y + 1, limit, align)
lg.setColor(1, 1, 1)
lg.printf(text, x, y, limit, align)
end
local function _draw() layout.footer.text = 'Original randomizer:\r\nshru.itch.io/cave-story-randomizer'
lg.draw(background, 0, 0)
_print('Cave Story Randomizer [Open Mode] v' .. VERSION, 0, 10)
_print('by shru and duncathan', 0, 22)
_print('(@shruuu and @duncathan_salt)', 0, 34)
_print(status, 10, 65)
_print('Original randomizer:\r\nshru.itch.io/cave-story-randomizer', 10, 200, 'left')
end
function C:draw() function C:draw()
screen:draw(_draw) lg.draw(background, 0, 0)
layout:show() layout:show()
end end
function C:setStatus(text) function C:setStatus(text)
status = text layout.status.text = text
end end
return C return C

View file

@ -1,44 +1,58 @@
return { id = 'window', return { id = 'window',
{ flow = 'y', { flow = 'y',
{ height = 360 }, {
{ flow = 'x', type = 'panel',
id = 'header',
height = 100,
style = 'panel',
align = 'top center',
{ height = 10 },
{ id = 'version', text = "" },
{ id = 'author', text = "" },
{ id = 'twitter', text = "" },
{ height = 10 }
},
{
type = 'panel',
id = 'status',
height = 260,
style = 'panel',
align = 'top center',
margin = 24,
wrap = true,
},
{
flow = 'x',
height = '40',
{ width = false }, { width = false },
--[[
{ {
type = 'button', type = 'button',
id = 'exampleButton', id = 'settings',
text = 'Press me!', text = 'Settings',
width = 100, width = 100,
height = 32, height = 32,
}, },
{ {
type = 'button', type = 'button',
id = 'exampleButton2', id = 'go',
text = 'Press me', text = 'Randomize',
width = 100,
height = 32,
},
{
type = 'button',
id = 'exampleButton3',
text = 'Press me',
width = 100,
height = 32,
},
{
type = 'button',
id = 'exampleButton4',
text = 'Press me',
width = 100,
height = 32,
},
{
type = 'button',
id = 'exampleButton5',
text = 'Press me',
width = 100, width = 100,
height = 32, height = 32,
}, },
]]
{ width = false } { width = false }
},
{
flow = 'x',
{ width = 20 },
{
type = 'panel',
id = 'footer',
height = 80,
style = 'panel',
align = 'centre left',
}
} }
} }
} }

View file

@ -1,6 +1,9 @@
return { return {
panel = { panel = {
background = {0,0,0,0} background = {0,0,0,0},
font = 'assets/monogram_extended.ttf',
size = 32,
color = {255,255,255},
}, },
button = { button = {
align = 'centre middle' align = 'centre middle'