GUI

More
04 May 2012 18:41 #182 by MatCat
Replied by MatCat on topic Re: GUI
Any chance to add disabling of the variable unused warning on the compiler? It is the bulk of warnings as each GUI element's ID is stored in a variable but not specifically used in the same code block, other then making an ugly if statement just to check every gui variable to keep it from giving warnings...

Please Log in or Create an account to join the conversation.

More
04 May 2012 19:13 #183 by MatCat
Replied by MatCat on topic Re: GUI
In experimenting I noticed eclipse has code stylings, it appears GNU code styling is closest to what you described we should use, if that is the case I can easily switch to it and just hit ctrl+shft+f and get it formatted properly :P

I have removed all warnings except the unused variables, removed all tabs, as far as code style goes I will wait on clarification.

The available options are: K&R, BSD, GNU, Whitesmiths

Generally I don't care too much about code styles as most code I work on is private party stuff and I just use my own style.

Please Log in or Create an account to join the conversation.

More
04 May 2012 20:48 #184 by MatCat
Replied by MatCat on topic Re: GUI
GUI Elements planned: (Please make note of anything to add, remove, or change, or prioritize)

Scrollbar
Checkbox
Radial
Dropdown
Number picker
Textbox
Keyboard
AnimatedSprite

Please Log in or Create an account to join the conversation.

More
05 May 2012 04:28 #186 by PhracturedBlue
Replied by PhracturedBlue on topic Re: GUI
The style I use is pretty close to 1TBS. I was able to get close in Eclipse, by
* making a new style with K&R as the base
* changing indentation to 'spaces only'
* selecting for braces: function -> next line
* selecting for braces: blocks -> next line on wrap

If you setup that style in Eclipse, it will closely math my code. Please only format the files you've created (in the gui dir) as otherwise the merge will be quite difficult.

As far as widgets:
I think we need a 'volume bar' or something equivalent that can be used to show the current position of the sticks.

We'll likely want some sort of x/y graph to allow displaying/setting the expo curves

We'll probably want an 'image button' (where an image, rather than text is shown on the button)

My order of priority would probably be something like:
volume-bar
scrollbar
image button
drowpdown
keyboard w/ entry box
radial button
x/y graph
animated sprite

You may have other methods in mind for the examples I gave above, so feel free to ignore me.

Please Log in or Create an account to join the conversation.

More
05 May 2012 04:32 #187 by PhracturedBlue
Replied by PhracturedBlue on topic Re: GUI
I just checked in new font drawing code that supports proportional fonts, and added 3 new proportional fonts, and one new fixed font (and got rid of some broken ones)

I like the Arial font (font #6), but it is a 10x14 proportional font (as opposed to the 8x8 fixed font we're currently using) and it doesn't center properly on your buttons.

Please Log in or Create an account to join the conversation.

More
05 May 2012 04:48 #188 by MatCat
Replied by MatCat on topic Re: GUI
A simple function to give back width and height of a string at a given font and I could easily adjust the code for self alignment

Please Log in or Create an account to join the conversation.

More
05 May 2012 05:19 #189 by PhracturedBlue
Replied by PhracturedBlue on topic Re: GUI
I just implemented LCD_GetStringDimensions which should do what you need.

Please Log in or Create an account to join the conversation.

More
05 May 2012 05:59 #190 by MatCat
Replied by MatCat on topic Re: GUI
Ok cool. I also agree with your assesment of widgets too. I am trying to keep it very modular and use GUI elements to build more complex ones.

For buttons I am going to do:

Image Button (I had already planned this one :P)
Imageless Button (Keyboard can be a bmp)

For analogs, what about a centered (except for throttle) design, which lights up either up, down, left, or right from center point? We can use the same concept for trims too.

I will probably do animated sprites soon, because I am working on doing the boot up / bind segmant which will look spiffy with an animation :).

One thing I am worried about is the redraw speed, I hope it is mostly the emulator but I am not sure. I noticed bmps draw very fast, but text draw seems slow, which results in ugly flicker, but then again even the stock firmware has flicker if you mess with it right. I miss the large quanity of ram I am used to with normal PC programming :P.

Please Log in or Create an account to join the conversation.

More
06 May 2012 21:32 #199 by PhracturedBlue
Replied by PhracturedBlue on topic Re: GUI
The GUI is now working on the actual hardware. It seems to be identical to running in the emulator :)
However, refresh is very slow, and setting ReDraw too frequently makes it unusable (I've disabled setting Redraw except by pressing buttons on the GUI for now. The screen flickers badly during refresh as well.

But all things considered I'm quite happy with it.

Please Log in or Create an account to join the conversation.

More
06 May 2012 21:42 #201 by MatCat
Replied by MatCat on topic Re: GUI
Yeah that was a problem I was afraid would happen, I am fairly sure walkera has to be using a screen buffer, it's a basic fundamental of doing any sort of graphics.

Please Log in or Create an account to join the conversation.

More
06 May 2012 21:53 #202 by PhracturedBlue
Replied by PhracturedBlue on topic Re: GUI
I haven't found any evidence of one. I've looked at the routines, and everything seems to be drawn via primitives. there just isn't enough RAM on the device to have a screen buffer.

Please Log in or Create an account to join the conversation.

More
06 May 2012 22:00 #203 by MatCat
Replied by MatCat on topic Re: GUI
Hrm... perhaps I will have to implament an adaptive redraw method then, only redraw individual objects unless an entire redraw is required...

Please Log in or Create an account to join the conversation.

More
06 May 2012 22:05 #204 by PhracturedBlue
Replied by PhracturedBlue on topic Re: GUI
Would it work to use a windowed redraw. Redraw all objects, but mask with a window so that you only update the screen for the window that has changed?

Please Log in or Create an account to join the conversation.

More
06 May 2012 22:26 #205 by MatCat
Replied by MatCat on topic Re: GUI
You might need to elaborate a little further...

What I am thinking might just be somewhat the same idea you are saying... basically if text changes redraw the portion of image below it only, though this will add a bit of code to figure out what exactly does need to be redrawn.

I am going to contimplate it and see if I can come up with any other alternative ideas... Perhaps look up other devices with open source firmware and see how they handle gui redraw.

Please Log in or Create an account to join the conversation.

More
06 May 2012 22:41 #206 by PhracturedBlue
Replied by PhracturedBlue on topic Re: GUI
Yes this is what I mean. Basically you call a function 'set window' which defines a window to redraw, then you repaint the entire image. The paint routines are then optimized to only paint within the rectangle and ignore everything else. To do it effectively, you need to optimize the drawing routines so that(for instance) you don't need to read the entire background image to repaint a small rectangle. You also need to store the size and location of each gui object so you know how to define the window.

Please Log in or Create an account to join the conversation.

More
06 May 2012 22:48 #207 by MatCat
Replied by MatCat on topic Re: GUI
Well that part is easy as all GUI elements do keep track of x, y, width and height. Now that I have the ability to read a string dimension I can easily implament that fully.

Please Log in or Create an account to join the conversation.

More
07 May 2012 04:42 #209 by PhracturedBlue
Replied by PhracturedBlue on topic Re: GUI
Well, I just committed code to get the sound working. I believe I have implemented basic interfaces to all of the hardware now. So once MatCat has the GUI Framework mostly done, and rcH4x0r has a radio stack, we should be able to implement a functional transmitter.

Please Log in or Create an account to join the conversation.

More
07 May 2012 19:06 #211 by MatCat
Replied by MatCat on topic Re: GUI
I am glad we are coming along... My real work has had me busy for a few days, but I am going to get image buttons done today, and work on windowed redraw.

Please Log in or Create an account to join the conversation.

More
07 May 2012 19:27 #212 by MatCat
Replied by MatCat on topic Re: GUI
objs/emu_devo8/main.o: In function `main':
/home/matcat/deviation/src/main.c:32: undefined reference to `SOUND_Init'
collect2: ld returned 1 exit status
make: *** [emu_devo8.elf] Error 1

Please Log in or Create an account to join the conversation.

More
07 May 2012 19:42 #213 by PhracturedBlue
Replied by PhracturedBlue on topic Re: GUI
I can't fix it at the moment but just define:
void SOUND_Init() {}
in target/emu_devo8/stubs.c

Please Log in or Create an account to join the conversation.

Time to create page: 0.109 seconds
Powered by Kunena Forum