Page 2 of 4
Re: GUI abstraction
Posted: Tue Jul 10, 2012 2:53 am
by Abhishek
Cool! However the GUI layer needs a lot of polishing.
Abhishek
Re: GUI abstraction
Posted: Tue Jul 10, 2012 9:45 am
by Tectu
Of course it does!
With polishing, do you mean fancy animations or the code cleanup itself?
Re: GUI abstraction
Posted: Tue Jul 10, 2012 11:51 am
by Abhishek
By polishing, I mean a better presentation of the controls. Currently we're just using rectangles and lines. I'm looking forward to the use of gradients and better looks. Currently the slider just looks like a progress bar!
Re: GUI abstraction
Posted: Tue Jul 10, 2012 12:28 pm
by Giovanni
I wonder if it would be possible to mimic some existing framework in order to have some API compatibility, for example QT or GTK ( I am not an expert, just naming some I heard about), is is a good idea to reinvent an API?
Giovanni
Re: GUI abstraction
Posted: Tue Jul 10, 2012 12:39 pm
by Badger
might be best to use something more low-level, e.g
libSDL. It could probably be implemented as a display / touch pad driver.
Re: GUI abstraction
Posted: Tue Jul 10, 2012 1:24 pm
by Tectu
if someone has deeper knowlege in knowing how to use gtk / qt / sdl as a graphic front end, I'd be happy to hear something. This would be very nice.
~ Tectu
Re: GUI abstraction
Posted: Tue Jul 10, 2012 1:35 pm
by Abhishek
@Badger, I had asked this earlier on the forum, but asking again: would it be practical to use libfreetype for text rendering with the lib?
Also. IMHO we need a familiar event handling type architecture for the GUI we are currently using. I don't have much idea about Qt or GTK but I am familiar with Swing (Java) and Windows Forms. My idea of a GUI is something like:
Code: Select all
Button b=createButton(x,y,text,name);
SetEventHandler(b, CLICK, buttonClickedFunc);
Each control should have its own paint function and should save its state in its instance.
E.g. For a button, state could be:
Idle: Normal state.
Just Pressed: If the touch is made inside the control area. As soon as a touch is detected, every control (or widget, as you like it) should be iterated and should check for a 'hit'
Hot: If the button has been touched and is Waiting to be released. Probably indicated by a colour shift.
It could have two sub-states: (i) active and hold, (ii) auto-repeat via some auto-repeat interval (only if required)
Released: when touch is removed. Either state Hot or this could be used to fire the click event.
IMO GUI requires an event based approach. Probably the event passing mechanism or message passing mechanism available in ChibiOS would prove handy.
Request comments on this approach.
Abhishek
Re: GUI abstraction
Posted: Tue Jul 10, 2012 1:47 pm
by Tectu
I worked with Qt about a year ago do create a GUI application for x86.
The thing you wrote is likley to how Qt does it.
Implementing such a thing from scratch up is a bit of work, and I guess I woud need some time and many many changes to bring up something useable.
The reason why I didn't start directly that way is because I need something working like the buttons in a current project of mine with a deadline. That is how the entire library came up.
I am sorry that I cannot provide a fancy GUI abstraction layer yet. I just thought I share what I already have, in case it could be useful for somebody to play arround.
~ Tectu
Re: GUI abstraction
Posted: Tue Jul 10, 2012 1:51 pm
by Badger
I'm sure libfreetype can be implemented, but it should be done in such a way that it is completely optional.
As for the libraries, we can probably learn a thing or two by studying the microchip and ST graphics libraries, and borrowing some good ideas.
Re: GUI abstraction
Posted: Tue Jul 10, 2012 1:57 pm
by Giovanni
I need to deploy another idea in this thread. The library is probably going to be stack-intensive. You should consider to implement it as a GUI-thread serving messages from the clients much like the FatFs wrapper thread created by Mabl:
viewtopic.php?f=8&t=466Giovanni