Edit: also, there are some issues:
- if you drag text over other text, it becomes unreadable -- even with background color!
- Does wrapping do anything? I'm a little confused about what it does.
Are you talking about the example #5 ? if so its just to demonstrate that you can drag around and is transparent, but shouldnt left over ... unless you want to make it unreadable1. if you drag text over other text, it becomes unreadable -- even with background color!
hummm this one only becomes clear if you look at the code .. =)2. Does wrapping do anything? I'm a little confused about what it does.
Code: Select all
-- Example: Wrapping components in a Scene
function load()
love.graphics.setBackgroundColor( NMSColor.GREEN_CABBAGE )
text3 = Text:new("text3",5,5,"drag the mouse over the rectangles")
text4 = Text:new("text4",5,100,"Im outside the scene")
rec1 = Rectangle:new("rec1",30,30,50,50)
rec2 = Rectangle:new("rec2",50,50,50,50)
rec2.isDraggable = true
rec2.onMouseOver = function(self)
self.fillColor = NMSColor.BROCCOLI
text3:setText("mouse over")
end
rec2.onMouseOut= function(self)
self.fillColor = NMSColor.AVOCADO
text3:setText("mouse out")
end
scene = Scene:new("scene")
scene:add(rec1)
scene:add(rec2)
scene:add(text3)
end
function draw()
scene:draw()
text4:draw()
end
function update(delta)
scene:update(delta)
text4:update(delta)
end
function mousepressed( x, y, button )
scene:mousepressed( x, y, button )
text4:mousepressed( x, y, button )
end
function mousereleased( x, y, button )
scene:mousereleased( x, y, button )
text4:mousereleased( x, y, button )
end
function keypressed(key)
scene:keypressed(key)
text4:keypressed(key)
end
Yes, I know, I read the code. But what I meant was: is there any specific reason to put components together in a Scene (other than you only have to :draw(), :update() etc the Scene, instead of each component).athanazio wrote:hummm this one only becomes clear if you look at the code .. =)
The idea is that you can use any component independent or wrapped together in a Scene
Code: Select all
function Scene:tostring()
return table.concat(self.childs, "\n")
end
My idea on this is to use the Scene concept to build complex UI elements based on the primary ones, and use then as one, for example an dialog box with the confirm/cancel buttons, also to allow hide/show for a group of components.is there any specific reason to put components together in a Scene
not sure why but this code didnt work there seems to be a better code but didnt work ehhehe.function Scene:tostring()
return table.concat(self.childs, "\n")
end
Aha, I get it now. The name "Scene" put me off a bit. You might want to consider naming it Group instead? It feels like a more logical name to me.athanazio wrote:My idea on this is to use the Scene concept to build complex UI elements based on the primary ones, and use then as one, for example an dialog box with the confirm/cancel buttons, also to allow hide/show for a group of components.
Hmm... I'll look into it.athanazio wrote:not sure why but this code didnt work there seems to be a better code but didnt work ehhehe.Code: Select all
function Scene:tostring() return table.concat(self.childs, "\n") end
Code: Select all
Hello
|World
Code: Select all
Hello|
World
local data = string.char(key), the official solution?Robin wrote: "local data = string.format("%c", key)" to "local data = key"
If you press "a", the result is "97", etc!
That seems a lot more logical to me too. Once again, I have no idea why he did that.bartbes wrote:local data = string.char(key), the official solution?Robin wrote: "local data = string.format("%c", key)" to "local data = key"
If you press "a", the result is "97", etc!
Users browsing this forum: Ahrefs [Bot] and 1 guest