Omnimaga

Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: neuronix on September 12, 2016, 12:53:37 pm

Title: GUI Librarie
Post by: neuronix on September 12, 2016, 12:53:37 pm
Hi guys !
I'm working on a Librarie which provides widgets for your GUIs, like a button, an alert, a popup and more.
For now, I only have 23 funcs  ;D :
FillRect(x1,y1,x2,y2)Draw a filled rectangle on the main buffer.
Rect(x1,y1,x2,y2)Draw a rectangle on the main buffer.
PopUp(x,y,Title,Str,Line)Title must be a zero-terminated string
Str must be a zero-terminated string
Line is the number of zero-terminated string in Str
Draw a PopUp at x,y on the main buffer.
DimStr(Str)Thanks to jacobly for this function
This one return the lenght in pixel of the string
ProgressBar(x,y,weidth,height,pause)weidth is the number of pixel in the ProgressBar. If 3 is the weidth, the progressbar will have 5 pixel of weidth with the border
height is the number of pixel without border (2 pixel)
pause is the time between each percent
Draw a progress bar on the screen. It is possible to quit with [clear]. That generate an Alert (cf alert)
Button(x,y,Str,Nbr)Draw a non-filled Button at x,y on the main buffer.
Str must be a zero-terminated string
Nbr is the number of zero-terminated string in Str
Alert(Title,Str)Draw an alert on the main buffer.
Title must be a zero-terminated string
Str must be a zero-terminated string composed by one of these.
ClrAll()Clear all screen (screen, main buffer and back buffer)
ClrAllBuf()Clear only all buffer
ClrMainBuf()Clear only the main buffer
ClrBackBuf()Clear only the back buffer
Disp4Color()Draw the main and back buffer to the screen to create 4 color
Disp3Color()Draw the main and back buffer to the screen to create 3 color
Disp2Color()Draw the main buffer to the screen
IndicOff()Turns off the run indicator
DoneOff()The program will not display "done" after finishing
SetCont(cont)Set the LCD contrast (0 is lightest, 63 is darkest)
RetCont()Return the LCD contrast value
SaveMainBuf()Save the main buffer to the back buffer
RclBackBuf()Copy the back buffer to the main buffer
Screenshot()Takes a screenshot and saves it to the main buffer
DispSprt(x,y,sprt)Sprt must be create in this form:
[xxxxxxxx]->ptr
[xxxxxxxx]
[xxxxxxxx]
[xxxxxxxx]
[xxxxxxxx]
[xxxxxxxx]
[xxxxxxxx]
[xxxxxxxx]
x must be a 0 (clear the pixel at this point), a 1 (draw a pixel at this point), a 2 or other (draw or clear a pixel depending on the pixel at this point)
This function draw a sprite at x,y on the main buffer
MiniButton(x,y,str)Draw a filled button at x,y on the main buffer
str must be a zero-terminated string composed by only one of these


Thank you in advance for your returns.
neuronix
Title: Re: GUI Librarie
Post by: E37 on September 12, 2016, 03:32:52 pm
Looks nice!  :)
Why are there rectangle commands? Axe already has them built in and they have some functions that yours cannot. (such as rendering partly on the screen)
Also there are a lot commands such as ClrMainBuf that are just one command that you can leave out unless you were just trying to rename the command.
What you have looks nice, but you should eliminate the repetitive parts.
It appears you are trying to emulate the DoorsCS libraries. An axiom already exists for that. (but you might be trying to allow use without needing to have Doors installed)
Title: Re: GUI Librarie
Post by: Sorunome on September 13, 2016, 02:00:07 am
Looking nice! It reminds me of the DCS gui stack, axioms for that are already available, e.g. here (https://www.omnimaga.org/the-axe-parser-project/dcs-axiom-development/msg197839/#msg197839)! ^.^
Title: Re: GUI Librarie
Post by: neuronix on September 13, 2016, 11:08:47 am
Thank you very much
If you have any idea, don't hesitate ;)