Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: thydowulays on December 20, 2011, 11:36:35 pm

Title: Sparta GUI Library *Alpha*
Post by: thydowulays on December 20, 2011, 11:36:35 pm
Hello omnimaga, it's thydowulays here! I have decided to make a complete GUI library for Axe with (I'm planning to) have every GUI feature that is in DoorsCS 7. This project currently has:

- Perfect flickerless drawing and a legit library
- Several commands
- Only one program needed to use the library, just add prgmSPARTA at the bottom of your project after the Return statement

The commands are as follows: NOTE that commands with a * are still in development and are not featured in the Sample project for a reason.

DRF(r1) - This command draws a frame with r1 being a string. r1 is drawn to the top of the frame, as a title
DRB(r1,r2,r3,r4,r5,r6) : This command draws a button. r1 is the X position, r2 is the Y position, r3 is the button width, r4 is the button height, r5 is the text in the button, and r6 is a boolean (0 or 1), 0 making it a normal button, 1 making it an inverted button
DRM(r1,r2) : This command displays a mouse on the screen at positions X(r1) and Y(r2). I recommend you replace the r1 and r2 with a variable that you can change with getkey(1 2 3 and 4) statements.
CLR() : This command is added at the BEGINNING of your Repeat loop in your program or whatever your main loop is for no flickering
BUFF() : This command buffers the objects on the screen, and passes through the CLR() command to make them update, or move
DRDIA(r1,r2,r3,r4,r5) : As of Update #1, this command is finished. It displays a message dialog on the screen much like in DoorsCS 7.

This is indeed a library, not a program with subroutines in it.

First library release, sample project, and screenie are below. Tell me what you think of it! :) P.S. prgmSPARTA is the actual library, prgmTEST is the Sample project

Update #1 is out! Link here: http://ourl.ca/14569/273147

Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 21, 2011, 12:07:32 am
Bump for epicness?
Title: Re: Sparta GUI Library *Alpha*
Post by: saintrunner on December 21, 2011, 12:16:56 am
looks pretty good :) I'll be checking out that code tomorrow ;)
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 21, 2011, 12:19:34 am
okay. I'm going to really start working on the DRDIA() command now. I plan to make it look like DoorsCS 7 dialog boxes, with the library's own little twist :)
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 21, 2011, 12:39:53 pm
Update #1

In this update, I have completed the DRDIA() function.
It now has:
- 5 arguments: r1 is the title text, r2, r3, and r4 being the text inside the box, and r5 being whether its visible or not. 0 meaning it isn't, 1 meaning it is
- Fast popping up
- Flickerless
- Comes with everything you expect from a dialog box  :P

Enjoy the update! Screenie and downloads below.

Title: Re: Sparta GUI Library *Alpha*
Post by: LincolnB on December 21, 2011, 12:47:59 pm
Wait, this is a library, but it's not a program with subroutines in it? How does that work?
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 21, 2011, 12:49:29 pm
Lol, Sparta is a library itself. That means its not an actual program that you can compile in Axe that has subroutines on the bottom. Meaning it has to have another program for it to be compiled
Title: Re: Sparta GUI Library *Alpha*
Post by: LincolnB on December 21, 2011, 12:53:04 pm
Gotcha. So it works the same way as Zedd.
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 21, 2011, 12:55:10 pm
Exactly, I tried making this before, but after taking a look at Zedd I saw that that way was much more lightweight and efficient :)
Title: Re: Sparta GUI Library *Alpha*
Post by: Builderboy on December 21, 2011, 03:25:11 pm
I'm pleased Zedd made an impact on you ^^  And this project is looking good! 

One question though, you included clrDraw() and clrDraw()r in your CLR() routine, even though none of your drawing routines use the backbuffer.  Similarly, in your BUF() command (which seems to only update the screen?) you have both DispGraph() and DispGraph()r.  This will actually display the screen twice, and a different way each time, which I do believe should cause flicker.  The first DispGraph displays normally, so all the text should be black, but the second DispGraph()r is a greyscale display routine, and since the backbuffer is clear, all of your text and graphics will be dithered. 

My suggestion in regards to the CLR() and BUF() commands is to let the user take care of when they wan't to update or clear the screen.  Most programs are going to include those commands anyway, so there is no reason to put them in a subroutine unless you are executing some custom code to do some special display.

Other than that though, this is looking good!  I assume you plan to keep the library in monochrome and not expand it to greyscale?
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 23, 2011, 03:54:32 pm
Thank you BuilderBoy! Actually, the reason I have ClrDraw and ClrDrawr in there is to keep it completely compatible with other users custom GUI. Meaning, If there is a feature thats not in Sparta, and it uses grayscale, Sparta can take care of it. I'm thinking of keeping it in Monochrome yes, but it may include greyscale. Also, the reason I included the CLR() and BUFF() commands is to keep it flickerless for the most part, because before including those I couldn't use the built in mouse command because it would flicker. But yes, Zedd really had an influence on this project, I greatly admire your work :)
Title: Re: Sparta GUI Library *Alpha*
Post by: Builderboy on December 23, 2011, 04:00:11 pm
Why would it flicker if the user clears and displays the screen themselves?  They would be using the same exact routines.  Also, displaying the screen twice with two different display routines is going to make flicker itself.  In addition, you say you wanted to include the backbuffer routines to improve compatibility, but what if the user wanted a constant greyscale background image?  By using your own CLR() routine, they would have to redraw it every frame, whereas if they were given control of clearing and displaying the buffers themselves, they would be able to just keep the image on the backbuffer.  Not to mention it would be smaller and faster. 
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 23, 2011, 04:02:24 pm
Hmm, I'm quite confused by this. I am pretty new to Axe so I don't know a lot of the features. But the users don't have to use the commands. How are you suggesting I change the CLR() and BUFF() commands?
Title: Re: Sparta GUI Library *Alpha*
Post by: Builderboy on December 23, 2011, 04:04:12 pm
I would suggest not including them at all, as it is smaller, faster, and provides more compatibility to simply let the user take care of clearing and displaying the screen themselves. 
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 23, 2011, 04:06:53 pm
Okay, thanks. Do you have any suggestions for any new commands? I'm trying to do as much as possible
Title: Re: Sparta GUI Library *Alpha*
Post by: Builderboy on December 23, 2011, 04:12:54 pm
I can't think of any graphical commands that would need to be added, but then again I'm not much of a GUI creator myself.  Other people might have some good suggestions as for what to include, or maybe check out some already existing GUI routines like Door's to see what they choose to include.  It's already looking very functional though, so good job!

EDIT: Maybe some routines for centering text or word wrapping text?
Title: Re: Sparta GUI Library *Alpha*
Post by: Spyro543 on December 23, 2011, 04:14:13 pm
Input command? For making an input field?
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 23, 2011, 04:39:11 pm
Ooh those are both great ideas. An input command would be really great, because I could use it in all of my other programs as well. How bout an SPTEXT() command for SpartaTextbox? I could also redo the Text() command so to speak so that you could put the fix statement in there already, then positioning arguments. Such as Txt(3, 25,25,"LOL",CNTR) so it would round around 25 until they are equally spread apart. I think these are great ideas, thanks for the feedback!
Title: Re: Sparta GUI Library *Alpha*
Post by: LincolnB on December 23, 2011, 04:47:19 pm
Wait a sec, you already have a Txt command? What for?
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 23, 2011, 04:49:35 pm
? No I mean a Txt() command thats just an upgrade of the Axe Text() command. It will support positioning like Centering and such.

Anyways, I am working on the SPTEXT() command now.
It will have 4 arguments.
r1 is the X position
r2 is the Y position
r3 is the width
r4 is whether or not it is in input text mode or not

BTW: The height will be fixed at 10 pixels
Title: Re: Sparta GUI Library *Alpha*
Post by: alberthrocks on December 27, 2011, 07:00:33 pm
Wow, this is quite interesting! :D

There is already another GUI library in Axe called Axe GUI Library (http://ourl.ca/10139) (duh) - have you taken a look at that? :) It's stalled though, and is undergoing (or at least, we're planning) a rewrite.

A couple of things:
1) When taking screenshots, please don't show us code. We know it's Axe, and no one will copy the code from the screenshot anyway! :P Show us the meat - the GUI itself in action! ;)
2) What other widgets are you planning to implement?
3) Possibly join us (Axe GUI Library) in the effort of making an awesome GUI library in Axe? :D (If not, that's OK too - there's nothing stopping you from going on, but I think collaborative effort may make a better fruit. ;))
Title: Re: Sparta GUI Library *Alpha*
Post by: Sorunome on December 28, 2011, 06:21:36 am
I just picked this thread up, and it looks cool! It looks very useful, that l library! Great work so far!
Title: Re: Sparta GUI Library *Alpha*
Post by: thydowulays on December 31, 2011, 09:17:31 pm
Thank you very much! Sorry for the late reply, I've been on vacation. I haven't worked much the past week on the project, but I'll pick it up tomorrow when I get home from my friends :)