LOVEly Eyes (GUI Toys) update of 2009-06-26

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-20

Post by Robin »

I think the "no new features" really keeps people from downloading this :P.
Edit: also, there are some issues:
  1. if you drag text over other text, it becomes unreadable -- even with background color!
  2. Does wrapping do anything? I'm a little confused about what it does.
Help us help you: attach a .love.
User avatar
athanazio
Citizen
Posts: 96
Joined: Fri Apr 10, 2009 3:12 am
Location: Rio de Janeiro - Brazil
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-20

Post by athanazio »

Thx for the comments Robin
1. if you drag text over other text, it becomes unreadable -- even with background color!
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 unreadable :P
2. Does wrapping do anything? I'm a little confused about what it does.
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
take a look at code of the example

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
Nothing is simple but everything is possible.
User avatar
athanazio
Citizen
Posts: 96
Joined: Fri Apr 10, 2009 3:12 am
Location: Rio de Janeiro - Brazil
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-22

Post by athanazio »

yes we have new features !!!

- text editor
- support home, end, arrows, return, delete, backspace, capslock, shift
- letters and numbers (hehehe)
- the current changes the size of the editor auto

- add 2 samples in the sample list with the editors
lovelyeyes_20090422.love
(25.21 KiB) Downloaded 200 times
Nothing is simple but everything is possible.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-20

Post by Robin »

First:
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
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).

Second, I tried your update. The Edit component is nice. There are two minor issues though:
  • The lineheight for each line is to large: if you press Return a few times, the Edit component gets too large.
  • This one may be harder to solve: the behavior of the arrow keys and backspace is unpredictable: pressing left on the beginning of a line (or right at the end of a line) doesn't go back to the previous line, and pressing backspace if you are on the beginning of a line does not always delete the "\n".
Third, I think your Scene:tostring() would be more efficient if you use:

Code: Select all

function Scene:tostring()
    return table.concat(self.childs, "\n")
end
Other than that, great work!
Help us help you: attach a .love.
User avatar
athanazio
Citizen
Posts: 96
Joined: Fri Apr 10, 2009 3:12 am
Location: Rio de Janeiro - Brazil
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-22 (text editor)

Post by athanazio »

Thanks Robin,
I will take a look on these later

cheers
Nothing is simple but everything is possible.
User avatar
athanazio
Citizen
Posts: 96
Joined: Fri Apr 10, 2009 3:12 am
Location: Rio de Janeiro - Brazil
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-22a

Post by athanazio »

yes we have new features and some bug fixing ( thanks Robin !

- text editor
- fixed the return behavior
- when left key is pressed on the first column goto the end of previous line
- when right key is pressed on on the last column goto the start of the next line
- fixed the editor height when has more than one line
- delete at the last character
- backspace at the first chaar
- drop of ctrl and alt keys
- drop function keys
is there any specific reason to put components together in a Scene
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.
function Scene:tostring()
return table.concat(self.childs, "\n")
end
not sure why but this code didnt work there :) seems to be a better code but didnt work ehhehe.

thanks for the testing !
lovelyeyes_20090422a.love
(16.83 KiB) Downloaded 173 times
Nothing is simple but everything is possible.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-22a

Post by Robin »

The new versions has some good improvements, but has also several issues.

But first:
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.
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:

Code: Select all

function Scene:tostring()
    return table.concat(self.childs, "\n")
end
not sure why but this code didnt work there :) seems to be a better code but didnt work ehhehe.
Hmm... I'll look into it.

Now, the issues I had:
For some reason, in Edit:keypressed() you changed "local data = string.format("%c", key)" to "local data = key"
If you press "a", the result is "97", etc!

Another bug was that if you have, say:

Code: Select all

Hello
|World
(where | is the cursor)
And press backspace, you get:

Code: Select all

Hello|
World
So you can't remove a newline, unless it is the last one.

EDIT: I know why the table.concat didn't work... all the children are tables, and table.concat won't take tables. It seems like your way is the only right one.
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-22a

Post by bartbes »

Robin wrote: "local data = string.format("%c", key)" to "local data = key"
If you press "a", the result is "97", etc!
local data = string.char(key), the official solution?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-22a

Post by Robin »

bartbes wrote:
Robin wrote: "local data = string.format("%c", key)" to "local data = key"
If you press "a", the result is "97", etc!
local data = string.char(key), the official solution?
That seems a lot more logical to me too. Once again, I have no idea why he did that.
Help us help you: attach a .love.
User avatar
athanazio
Citizen
Posts: 96
Joined: Fri Apr 10, 2009 3:12 am
Location: Rio de Janeiro - Brazil
Contact:

Re: LOVEly Eyes (GUI Toys) update of 2009-04-22a

Post by athanazio »

hehehe coding late at nite has some drwbacks ...
changed to local data = string.char(key)
was making some tests on char codes ... :)

will see the newline bug later on, and I agree with you Group is a better name than Scene will refactor that

cheers
Nothing is simple but everything is possible.
Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests