Re: What's everyone working on? (tigsource inspired)
Posted: Fri Jul 15, 2016 7:47 am
rebelling against the machine and making an application in love2d
Code: Select all
if arg[#arg] == "-debug" then debug = true else debug = false end
if debug then require("mobdebug").start() end
lc = require "renderer"
lc:registerFont("bigger", love.graphics.newFont(48))
lc:registerFont("smaller", love.graphics.newFont(10))
lc:registerStyledLayout("title", "text", {font = "bigger", textColor = { 200, 150, 100, 255}, backgroundColor = { 38, 38, 38, 255 } })
lc:registerStyledLayout("subtitle", "text", {font = "smaller", textColor = { 200, 200, 200, 255}, backgroundColor = { 38, 38, 38, 255 } })
lc:registerStyledLayout("hot-pink-subtitle", "subtitle", {textColor = { 255, 0, 100, 255}})
lc:registerLayout("imagecaption", {
build = function ( options)
local container = lc:build("linear", {direction = "v", width = options.width, height = options.height, backgroundColor = {0,0,255,255}})
container:addChild( lc:build( "image", {file = options.file, width="wrap", height="wrap" } ))
local textChild = lc:build( "text", {data = options.text, width="wrap", height="wrap", backgroundColor = {255,0,0,255}, textColor={0,255,0,255}, padding = lc.padding(5) })
local borderChild = lc:build("border", { backgroundColor ={255,255,0,255}, left="fill", right="fill",top=15,bottom=5 })
borderChild:addChild(textChild)
container:addChild(borderChild)
return container
end,
schema = lc:extendSchema("base",
{
file = { required = true, schemaType = "string" },
text= { required = true, schemaType = "function" }
})
})
local title = lc:build("title", {width="fill", height="wrap", gravity = {"center", "center"}, data = function() return "I'm building the thing!" end })
local subtitle = lc:build("subtitle", {width="fill", height="wrap", gravity = {"center", "center"}, data = function() return "(Even though I'm terrible with visual design. But it's a nice technical challenge.)" end })
local imageContainer = lc:build("linear", { direction = "h", width = "fill", height = "wrap", backgroundColor = { 255, 255, 255, 25 }, padding = lc.padding(15, 10, 5, 10)})
local image1 = lc:build("imagecaption", {width=150, height="wrap", file = "cards/ace.png", text = function() return "Look, an Ace" end})
local image2 = lc:build("imagecaption", {width=150, height="wrap", file = "cards/two.png", text = function() return "And a two" end})
local image3 = lc:build("imagecaption", {width=150, height="wrap", file = "cards/three.png", text = function() return "And a three" end})
imageContainer:addChild(image1)
imageContainer:addChild(image2)
imageContainer:addChild(image3)
root = lc:build("root", {direction = "v", backgroundColor = { 73, 25, 25, 255 }})
root:addChild(title)
root:addChild(subtitle)
root:addChild(imageContainer)
root:addChild(lc:build("hot-pink-subtitle", { width = "fill", height="wrap", data = function() return "Making things easily extendible and customizable is a major goal for this library." end }))
root:layoutingPass()
love.draw = function()
root:render()
end
as it is right now there is no style, all the assets are placeholdersSomeguynamedpie wrote:IMO you should rely more on bettering the art style than adding shadows for improving the look; ergo I think you're looking for more clearly defined edges of objects. Just something that might be worth looking into, but shadows on some objects definitely does look nicer, especially on non-static ones ergo actors.
I agree that it looks much better with the shadow, and like that it's just a subtle effect.Whatthefuck wrote:Wrote a super simple "shadow" shader for that game dev sim game. It adds a lot of contrast to everything and imo it looks way nicer now.
Yes, Löve doesn't require you to use a specific UI framework, and making your own is good for practice. However, when you really want to start making your UI, I strongly recommend using a UI library made by someone else.bubbie wrote:My first time having a look at Love2D, still working on a lot of the little bits.
[...]
As far as I could tell Love didn't have any actual built-in buttons so I made my own choppy system for them.