First Graphical widget
Graham Stabler
Posts: 2,510
A first graphical widget demo.
www.youtube.com/watch?v=_MMAMRoURcI
There are two functions, one draws a scale at an arbitrary position, over an aribrary angular range and with an arbitrary number of tick marks.
The second draws a pointer of with similar arbibrary parameters.
I hope the demo shows how these generalized functions can soon produce useful results with good code reusage.
Need suggestions for further functions.
Graham
www.youtube.com/watch?v=_MMAMRoURcI
There are two functions, one draws a scale at an arbitrary position, over an aribrary angular range and with an arbitrary number of tick marks.
The second draws a pointer of with similar arbibrary parameters.
I hope the demo shows how these generalized functions can soon produce useful results with good code reusage.
Need suggestions for further functions.
Graham
Comments
Post Edited (Fred Hawkins) : 10/15/2007 4:09:07 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Brian
uController.com - home of SpinStudio
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
I've got a book on QT, I guess I'll have to actually open it!
Fred,
All the code is in the one file, I've not created the actual object yet.
Brian,
Eventually when it has more than two widgets.
Ken,
by text keypad do you mean a numeric keypad?
All,
I'll be concentrating on display widgets to start with, meters, progress bars etc then I can look at user interface elements. I'd be MORE than happy for people to supply widgets to go in the library, they don't have to be complete, I can always do the generalizing, its good fun creating them.
Graham
which is one reason I was happy to buy it
Thank you very much. I haven't looked at graphics yet, but your widgets make it almost irresistable.
This is nit picking, but the spokes (of your dial widget) don't seem to converge on the same point (looks like an aliasing problem).
I think Parallax should offer a prize to the large model guys... first one to:
http://www.povray.org/
or
http://en.wikipedia.org/wiki/VRML
wins.
Graham
Your widgets out to be in the demo that Parallax sends out with the demo board... they spark the imagination and beg to be hacked.
The minute I saw it... I wanted to hack my car. Of course, I can't do that yet... but that's what it did to me.
Very sweet.
Rich
Very nicely done! I am impressed. I would love to be able to do the things you and many others are doing with the propeller!
Some of my ideas for additional graphic widgets include bar graphs that are horizontal, vertical or curved and displayed as individual segments or a solid bar with or without a full range outline. Also round or polygon shapes that could be substituted in place of rectangular increment markers might make for some interesting displays.
Thinking of the popularity of GPS systems these days, creating an arrow shaped pointer would seem to be an easy and very useful variation on what you already have.
Finally, I think a resizable digit or hex display would also be very useful as well.
I think your analog meter design is great! The way you have split the tick marks from the pointers will be very useful. Keep up the good work!
- Sparks
All I am doing is using the functions in graphics.spin, no clever programming really this widget was done using vec, this just displays a vector sprite found in the DAT section at a given angle, positon and scale. So all I needed then for the scale was to have a loop drawing the tick vector. For the pointer it draws a single vector sprite. The only hard part was making it general so it works when the angle range crosses 0/360 degrees.
As far as different pointers go, all you need to do is fiddle with the DAT section to make it match your hearts desire. Same for the scales, you might even change vec to pix which will display a pixel sprite, that could be a solid circle or even a small dog! I quite fancy doing a diving watch display demo.
I'll definately be considering the bar graphs as well as slide bars.
Another thing you can do with the hand widget is make the kind of display where two pointers cross each other.
Graham