Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Munchor on April 06, 2011, 09:51:19 am

Title: Axe GUI Library
Post by: Munchor on April 06, 2011, 09:51:19 am
(http://img.removedfromgame.com/imgs/GUILibraryScreenshot0001.gif)  (http://img.removedfromgame.com/imgs/GUILibraryScreenshot0003.gif)

I was just in the mood to create an Axe GUI library and I thought "Why not?".

So it's not really a library since I use subroutines to create frames, buttons and dialogs.

So that you can have an idea of how this works, take a look at the code to draw the ABOUT button you can see in the demo:

Code: [Select]
sub(DB,40,42,30,10
Text(46,44,"ABOUT

As simple as that!

Let's take a look at its event when pressed:

Code: [Select]
If getKey(54)
[80C0E0F0F8F0B818->O
If X>40 and (X<70 and (Y>42 and (Y<52
sub(DD,"ABOUT","PROGRAM MADE","BY DAVID","GOMES"
Repeat getKey
End
End
...
End


So you have just learnt the two Drawing subroutines, DD (draw dialog) and DB (draw button).

There is not a DF (draw frame) yet, I am tidying it up to make it all a subroutine, but when finished it'll work like this:

Code: [Select]
sub(DF,"TITLE",1,0
The 1 (which could be a 0) is for X button or no X button to close the frame.
The 0 (which could be a 1) is for allow [CLEAR] to exit or don't allow [CLEAR] to exit.

This is just a demo, but I hope the library can have some uses :D I'll be making a few more Drawing Routines for other kinds of buttons, listboxes, etc. Not sure of how to make a textbox though.

Probably they can be in separate files (the routines) instead of being in the same program as the main program.

What do you think?
Title: Re: Axe GUI Library
Post by: Yeong on April 06, 2011, 11:16:43 am
Looks pretty good! :D
Looks like DCS7 cursor thingy XD
Title: Re: Axe GUI Library
Post by: Munchor on April 06, 2011, 01:00:44 pm
Looks pretty good! :D
Looks like DCS7 cursor thingy XD

Thanks :D

I finished the Draw Frame subroutine and here's my code for drawing the GUI in the GUI demo now:

Code: [Select]
sub(DB,30,30,30,10
Text(34,32,"BUTTON
sub(DB,40,42,30,10
Text(46,44,"ABOUT
sub(DF,1,"TITLE

And that's all!!!
Title: Re: Axe GUI Library
Post by: AngelFish on April 06, 2011, 01:06:46 pm
Looks nice, but you could optimize the location detection routine if you are willing to accept aligned buttons,
Title: Re: Axe GUI Library
Post by: aeTIos on April 06, 2011, 01:18:50 pm
Wow great job scout!
Title: Re: Axe GUI Library
Post by: Munchor on April 06, 2011, 05:36:14 pm
Wow great job scout!

Thanks.

I forgot how to explain how to use the three subroutines so far, here I go:
----------------------------------------------------------------------------------------------------
Code: [Select]
sub(DF,1,"TITLE
sub(DF,0,"NO CLOSE BUTTON

When you have 1 it draws a little X in the right upper corner, if you put 0 it won't.
----------------------------------------------------------------------------------------------------
Code: [Select]
sub(DB,30,30,30,10
Text(34,32,"BUTTON

This draws a button at coordinates (30,30) with width 30 and height 10.
----------------------------------------------------------------------------------------------------
Code: [Select]
sub(DD,"ABOUT","PROGRAM MADE","BY DAVID","GOMES"
Repeat getKey
End

This draws a message box (or dialog) with title 'ABOUT', and its text is the following:
Code: [Select]
PROGRAM MADE
BY DAVID
GOMES

Each argument is a line.


Hope you got it :D
Title: Re: Axe GUI Library
Post by: thepenguin77 on April 06, 2011, 06:00:40 pm
That is really impressive. It looks almost exactly like the way you do Windows stuff, just way easier.
Title: Re: Axe GUI Library
Post by: Munchor on April 07, 2011, 09:11:46 am
Looks pretty good! :D
Looks like DCS7 cursor thingy XD

Yeah, I used the same mouse sprite since I couldn't think of another way to do it.

Looks nice, but you could optimize the location detection routine if you are willing to accept aligned buttons,

What do you mean with that?


Also, I have added yet another GUI component, I'll show it to you later :)
Title: Re: Axe GUI Library
Post by: Munchor on April 07, 2011, 10:11:05 am
Update

(http://img.removedfromgame.com/imgs/GUILibraryScreenshot0005.gif)

I added a status bar, very similar to Windows's, which can be created by writing:

Code: [Select]
sub(SB,X,"TEXT"

X is the X position of the text, for example, for the image above I wrote sub(SB,62,"GUI DEMO.

I optimized the subroutines and the main code (in the loop) is getting much shorter. The GUI DEMO is only 2000bytes for now :D (the compiled version).

Attached is the source code of the GUI. It works better if compiled with Axe 0.5.1 :D
Title: Re: Axe GUI Library
Post by: Juju on April 07, 2011, 12:02:27 pm
That looks awesome :D

Maybe we could make an axiom with that?
Title: Re: Axe GUI Library
Post by: AngelFish on April 07, 2011, 01:07:56 pm
Looks nice, but you could optimize the location detection routine if you are willing to accept aligned buttons,

What do you mean with that?

Currently you're using M>X and N<X to kind of "trap" the cursor and detect it. However, you can take advantage of the fact that Axe doesn't use decimal math to get the position of the cursor with two lines and half as many comparisons per button. The disadvantage is that you're forced to give up some accuracy and flexibility in where you can put your buttons. Here's a demonstration of what I mean:

(http://img.removedfromgame.com/imgs/1-GUIdemo.gif)

As you can see, the buttons are all triggered by clicking on them when the cursor is inside of their "area." It's a simple matter to only define those areas that you want clicked and the size of each click area can be fully modified.
Title: Re: Axe GUI Library
Post by: Munchor on April 08, 2011, 10:01:03 am
"Currently you're using M>X and N<X to kind of "trap" the cursor and detect it."

Exactly.

"However, you can take advantage of the fact that Axe doesn't use decimal math to get the position of the cursor with two lines and half as many comparisons per button."

No idea of what you mean.

Also, since this library is 200% open source, Ashbad is joining the team and will make a few changes to it, I hope he contributes :D
Title: Re: Axe GUI Library
Post by: z80man on April 08, 2011, 10:26:31 am
I think what Qwerty means is that because the buttons are all located on a grid instead of randomly placed, you can add some optimizations. So correct me if I'm wrong, but you can find the cursor position on the grid by using x/width and y/height. Then using the 2 grid coordinates you can see if a button exists there.
Title: Re: Axe GUI Library
Post by: Ashbad on April 08, 2011, 11:54:25 am
I used a system that qwerty would like, but also added:

-pic support
-scroll bars (working)
-input boxes
-scripting language
Title: Re: Axe GUI Library
Post by: Munchor on April 08, 2011, 11:54:51 am
I used a system that qwerty would like, but also added:

-pic support
-scroll bars (working)
-input boxes
-scripting language

Very nice Ashbad :D
Title: Re: Axe GUI Library
Post by: Broseph Radson on April 08, 2011, 11:58:26 am
Idea!
Would it be possible to change the cursor to [20505ED5C195423C] (finger pointer) when you hover over a button?
Title: Re: Axe GUI Library
Post by: Munchor on April 08, 2011, 11:58:55 am
Idea!
Would it be possible to change the cursor to [20505ED5C195423C] (finger pointer) when you hover over a button?

Yes, it would, it's quite easy in fact =D
Title: Re: Axe GUI Library
Post by: Broseph Radson on April 08, 2011, 12:03:50 pm
:w00t: Coolio
Title: Re: Axe GUI Library
Post by: Munchor on April 08, 2011, 12:04:32 pm
Just tried your sprite, looks sweeeet :D
Title: Re: Axe GUI Library
Post by: Broseph Radson on April 08, 2011, 12:04:46 pm
Thanks :)
Title: Re: Axe GUI Library
Post by: ztrumpet on April 08, 2011, 12:32:46 pm
This looks very nice.  Excellent job, Scout (and Ashbad)! ;D
Title: Re: Axe GUI Library
Post by: Munchor on April 08, 2011, 12:34:23 pm
This looks very nice.  Excellent job, Scout (and Ashbad)! ;D

I am looking forward for a screenie of Ashbad's new GUI Components ;D
Title: Re: Axe GUI Library
Post by: KermMartian on April 08, 2011, 12:44:26 pm
Why not just use the DCS GUI API via an Axiom instead of reinventing the wheel?
Title: Re: Axe GUI Library
Post by: Munchor on April 08, 2011, 12:57:35 pm
Why not just use the DCS GUI API via an Axiom instead of reinventing the wheel?

Wouldn't that be DCS only? I mean, not that it is a problem to me, but unfortunately not everybody uses Doors CS.

In addition, my Assembly knowledge on Axioms isn't that good and this will make it easier for everyone who wants to change the code. So, Axe coders can change the library code to their needs, and if it were made with Axioms, it wouldn't be that easy to change it (we'd have to know Assembly).
Title: Re: Axe GUI Library
Post by: Ashbad on April 08, 2011, 01:21:01 pm
Also, Kerm, the axiom would give us DCS power, but the libs are really meant for either assembly or BASIC.  The wrapper would give us DCS power, but it wouldn't give us all the power we need (kinda like if you wrote a Java wrapper for an x86 assembly library -- it would allow you to do that on all platforms, but it would be a pain to access the lower level stuff.  I hope you get my point -- it's a horrible example x.x) even if an axiom wrapped it up.  Since Axe is higher level than assembly, it should have its own way to access these elements, which would be better supported by a library that was intended for axe alone.  ;)

I'm not sure if everyone might get my point, but I'm sure kerm understands -- though I don't blame him for wanting us to use his libs ^-^
Title: Re: Axe GUI Library
Post by: kindermoumoute on April 08, 2011, 04:30:43 pm
but unfortunately not everybody uses Doors CS.
Sure, but DCS is the best Shell, and I think so much people use it...
Title: Re: Axe GUI Library
Post by: Munchor on April 08, 2011, 04:31:42 pm
but unfortunately not everybody uses Doors CS.
Sure, but DCS is the best Shell, and I think so much people use it...

Not enough when compared to MirageOS, If I'm correct.
I also think DCS is 100 times better than MirageOS, but there's nothing we can do about it.
Title: Re: Axe GUI Library
Post by: kindermoumoute on April 09, 2011, 04:00:41 am
In the future it will expand... :)
Title: Re: Axe GUI Library
Post by: Munchor on April 09, 2011, 05:22:46 am
In the future it will expand... :)

I also hope so.

For now, we have merged both projects here (http://code.google.com/p/axe-gui-libraries/).
Title: Re: Axe GUI Library
Post by: Munchor on April 09, 2011, 03:14:06 pm
UPDATE :D

Here it is, a Windows program (sorry non-Windows guys, I'll try to use Mono later) to create Axe GUI using the library in its current state.

What do you think?
Title: Re: Axe GUI Library
Post by: DJ Omnimaga on April 22, 2011, 10:45:01 pm
Nice, that might be useful to some people to quickly generate menus.

Personally I would probably use DCS guis, but your version has the ability to run without dependencies.

Is it normal that the generator program takes about 20 seconds to startup, though? ???
Title: Re: Axe GUI Library
Post by: Munchor on April 23, 2011, 09:24:33 am
Nice, that might be useful to some people to quickly generate menus.

Personally I would probably use DCS guis, but your version has the ability to run without dependencies.

Is it normal that the generator program takes about 20 seconds to startup, though? ???

O.O 20 seconds?

It takes about 10 seconds to me. It's quite weird taking so long though.

Quote
Personally I would probably use DCS guis, but your version has the ability to run without dependencies.

Albert, Ashbad and I are working on those (at an unfortunately low rithm though).
Title: Re: Axe GUI Library
Post by: jnesselr on April 23, 2011, 12:08:37 pm
True, it is kinda sad that you have to have a 3 or so page app to run a GUI in basic, if you or your end-user doesn't use all of DCS.
Title: Re: Axe GUI Library
Post by: alberthrocks on April 23, 2011, 12:47:47 pm
Personally I would probably use DCS guis, but your version has the ability to run without dependencies.
DCS is nice, but a lot of times classmates either don't have DCS, can't install DCS (not enough space or not compatible), or don't want it. Typically, MirageOS is what I see a lot, and consequently my compiles will be for MirageOS and nostub.

One of the other pluses about having a Axe native GUI is that all of the GUI stuff gets compiled in as well, reducing the need for any dependencies, and making it standalone. The DCS wrapper, however, requires DoorCS7 (obviously) and has to be compiled for DoorsCS, since functionality is not exposed with other program types, *even* if you are using DoorsCS7 to launch the non-DCS program.

That said, I'm still going to work to bring both native and DCS wrappered GUI so that a choice can be offered to both developers and users alike. :)

O.O 20 seconds?

It takes about 10 seconds to me. It's quite weird taking so long though.
.NET does take a while to load, especially on slower computers. After it loads though, any other .NET application (or the same one) will load almost instantaneously, max 5 seconds.

Albert, Ashbad and I are working on those (at an unfortunately low rithm though).
Oh, before I forget, could you add and commit the Axe native GUI program in so I can convert? :)

True, it is kinda sad that you have to have a 3 or so page app to run a GUI in basic, if you or your end-user doesn't use all of DCS.
...and include the fact that you need it to run ASM programs that use DCS libraries.
Interestingly enough, there are very few DCS compiled programs out there, most of them dedicated for DCS itself.
Title: Re: Axe GUI Library
Post by: Munchor on April 24, 2011, 08:17:15 am
Albert, Ashbad and I are working on those (at an unfortunately low rithm though).
Oh, before I forget, could you add and commit the Axe native GUI program in so I can convert? :)

What do you mean? It's already there AXEGUI.8XP, Ashbad didn't make any updates.
Title: Re: Axe GUI Library
Post by: DJ Omnimaga on May 21, 2011, 03:34:55 am

O.O 20 seconds?

It takes about 10 seconds to me. It's quite weird taking so long though.
.NET does take a while to load, especially on slower computers. After it loads though, any other .NET application (or the same one) will load almost instantaneously, max 5 seconds.

THe thing is that I got a i7 quad core computer though O.O

And personally I don't mind installing DCS for one game if the game is awesome, although I prefer for larger games. Now it's not an issue anymore though, since I always use my TI-84+ or TI-Nspire, which got a lot of memory to fit massive games in.
Title: Re: Axe GUI Library
Post by: Munchor on May 21, 2011, 09:25:23 am
I have to say that I will not be working on this again due to DWARF. DWARF is really good and I do not think we need more than 1 library.
Title: Re: Axe GUI Library
Post by: yunhua98 on May 21, 2011, 10:06:09 am
What is dwarf?
Title: Re: Axe GUI Library
Post by: Deep Toaster on May 21, 2011, 10:21:43 am
This thing is pretty awesome O.O I think it'll really help some people make utils in Axe.
Title: Re: Axe GUI Library
Post by: Munchor on May 21, 2011, 10:54:02 am
This thing is pretty awesome O.O I think it'll really help some people make utils in Axe.

Thanks, but it is finished. Neither Ashbad nor me nor albert are working on this anymore.
Title: Re: Axe GUI Library
Post by: alberthrocks on May 21, 2011, 10:55:50 am
I think we should continue to work on this. DrawfWM is a shell, not a GUI library, although like DCS, it will expose the GUI library as well. This project's goal is to make an independent GUI library, in which I think we could do nicely. :) At the same time, either we or SirCmpwn can make Axe wrappers for it.

However, my main focus at the moment is wxWabbitemu, since there's quite a demand for such an app, and my C++ skills are growing as well, enabling me to contribute more.
Title: Re: Axe GUI Library
Post by: Munchor on May 21, 2011, 12:43:00 pm
I think we should continue to work on this. DrawfWM is a shell, not a GUI library, although like DCS, it will expose the GUI library as well. This project's goal is to make an independent GUI library, in which I think we could do nicely. :) At the same time, either we or SirCmpwn can make Axe wrappers for it.

However, my main focus at the moment is wxWabbitemu, since there's quite a demand for such an app, and my C++ skills are growing as well, enabling me to contribute more.

Yeah I'm also focused on that and today I have fixed some bugs and worked on a few things, I'm on a rampage.
Title: Re: Axe GUI Library
Post by: SirCmpwn on May 21, 2011, 02:02:18 pm
I don't think this should die because of DwarfWM.  This offers something different - the ability for Axe programs to have a GUI and still be no-stub.  Axe programs for DwarfWM won't run without DwarfWM, whereas they can still be no-stub with this.  Also, my 'rents finally confiscated my calculator, so I can't work on DwarfWM, Motherload, or Time Shift until I get it back.
Title: Re: Axe GUI Library
Post by: DJ Omnimaga on May 21, 2011, 02:12:35 pm
I think this should continue, for the reasons said above.
Title: Re: Axe GUI Library
Post by: Deep Toaster on May 21, 2011, 06:47:38 pm
This thing is pretty awesome O.O I think it'll really help some people make utils in Axe.

Thanks, but it is finished. Neither Ashbad nor me nor albert are working on this anymore.

Aww what? This is something useful! D:

Methinks you should keep working on it :)
Title: Re: Axe GUI Library
Post by: Munchor on May 22, 2011, 05:48:05 am
Deep, I don't think anybody ever used or will use it =P I guess we should invest more on the DCS Axiom one.
Title: Re: Axe GUI Library
Post by: alberthrocks on May 30, 2011, 07:16:25 pm
Super late reply... :P I think people will use it. I've been playing around with menu code today and realized why people might use it, and am planning to implement some things (including the menu). However, some parts of it will have to be redesigned/rewritten for such uses, like for games and such :)
Title: Re: Axe GUI Library
Post by: FinaleTI on May 30, 2011, 08:48:17 pm
Can't believe I didn't post here before...

I really think you guys should keep working on this. I'm playing around with an idea right now, and this would work perfectly with it. I'd also be interested in collaborating on this, if that's ok with you guys.
Title: Re: Axe GUI Library
Post by: alberthrocks on June 01, 2011, 11:22:30 am
Can't believe I didn't post here before...

I really think you guys should keep working on this. I'm playing around with an idea right now, and this would work perfectly with it. I'd also be interested in collaborating on this, if that's ok with you guys.
Oh, no problem! :) PM me your email. We have a google code site up for code hosting, but don't try to use any of the files yet... the tokenizer is broken! :P Once I get some time, I will pull down the old tokenizer and use Michael_Lee's tokenizer for the project.

Just curious - what are you planning to do? :)
Title: Re: Axe GUI Library
Post by: Munchor on June 01, 2011, 12:56:34 pm
Can't believe I didn't post here before...

I really think you guys should keep working on this. I'm playing around with an idea right now, and this would work perfectly with it. I'd also be interested in collaborating on this, if that's ok with you guys.
Oh, no problem! :) PM me your email. We have a google code site up for code hosting, but don't try to use any of the files yet... the tokenizer is broken! :P Once I get some time, I will pull down the old tokenizer and use Michael_Lee's tokenizer for the project.

Just curious - what are you planning to do? :)

What about waiting until Wabbitemu can have files extracted? Oh wait, that's Windows only, yeah use Michael Lee's. I would rather compile with Axe and sending file to computer
Title: Re: Axe GUI Library
Post by: alberthrocks on June 01, 2011, 07:11:33 pm
What about waiting until Wabbitemu can have files extracted? Oh wait, that's Windows only, yeah use Michael Lee's. I would rather compile with Axe and sending file to computer
I'm starting to wonder if you still can recall what you wrote... :P

There's no point in compiling the library itself since... well, no program is using it! It isn't exactly like an Axiom, in which you compile and then use it. In pure Axe, you include the library in the program and then compile it, which will automatically include the library. ;) (Technically speaking, our library is more like a collection of (sub)routines, but I'll leave that up to the developer to decide.)

Since we're not exactly compiling it, but rather just converting the regular text source to 8Xp, a tokenizer/detokenizer is used. That's when Michael_Lee's program enters. See where I'm going here? ;)

Although I'm hoping to get something like that done soon (this summer! :D), you're only going to see that in say, wxWabbitemu v1.5 or v2.0. There's plenty of Wabbitemu features that need to get implemented first! :P (GIF screencapping and debugging, for instance)

====
NOTE FOR OTHER PEOPLE PLAYING WITH THIS LIBRARY - do NOT use the one on the Google Code website unless it's the one in the Downloads section. SVN's copy is broken.

Also, if you don't see a mouse at all (like I did), you may need to set X and Y to some non-zero number. Add this on the top of the GUI demo program (below the header, of course!):
Code: [Select]
10->X
10->Y
Title: Re: Axe GUI Library
Post by: FinaleTI on June 02, 2011, 03:16:31 pm
I was able to add a simple scroll bar today.
It's simply:
Code: [Select]
sub(SCR, Y-Offset, Height of scroll-box)

Here's a screenie using it.
Title: Re: Axe GUI Library
Post by: Ashbad on June 02, 2011, 03:33:25 pm
interesting :) I personally lost all the source for my incarnation, but the best method of going about handling separate objects on-screen would be to use an object-queue.  That way, you can go in order in a buffer in memory and draw things within a simple For( statement.  I suggest that if you go that way, make the size of the object queue and the size of all objects somewhat static.  That way, the speed of rendering stays a bit more constant.

Also, for scrolling, that's a cool way to do that, but I don't suggest it to be the finalized method of doing so.  That way requires picture data to be processed, and that's a lot larger in size than queue objects.  However, you could simply just scroll, changing an X and Y values for window offset on moving, and only draw objects within the window :)
Title: Re: Axe GUI Library
Post by: Munchor on June 02, 2011, 04:08:52 pm
I was able to add a simple scroll bar today.
It's simply:
Code: [Select]
sub(SCR, Y-Offset, Height of scroll-box)

Here's a screenie using it.

FinaleTI, that's looking great, nice to hear you're keeping the SubRoutine Arguments Simple like for the frame, status bar and buttons and other stuff. Thanks.

Is text input too hard? I'm afraid it is.
Title: Re: Axe GUI Library
Post by: FinaleTI on June 02, 2011, 04:08:55 pm
I only used the pic data thing for a quick demonstration, I had intended to do something more memory efficient later.
I'll probably get to the object queue/stack after I finish up my text entering routine.

I also figured that rendering your initial GUI, then storing it to the back-buffer, and copying it to the front instead of re-drawing the whole thing again was much more efficient, and you can just update the back-buffer whenever something needs to be changed. I also masked the mouse, simply because I think it looks better that way, and I could afford to with the speed update from not re-drawing the thing every frame.
Title: Re: Axe GUI Library
Post by: Munchor on June 02, 2011, 04:11:01 pm
Even though I'm not familiar with Masking and some other stuff you did, it looks better. Will you upload source to Repository? I'd like you to :)
Title: Re: Axe GUI Library
Post by: FinaleTI on June 02, 2011, 04:24:47 pm
Uploaded. It pulls in a Pic file, but that's just for testing, assign anything you want to it, or remove all references to it if you want.

Also, if my text input routine doesn't quite pan out, I believe squidgetx posted the one he originally used for name input in Ash: Phoenix, and that could probably be modified to what we need.
Title: Re: Axe GUI Library
Post by: FinaleTI on June 03, 2011, 03:00:28 pm
I accomplished a basic implementation of the GUI stack today.

In order to do so, I slightly modified the button routine.
Instead of
Code: [Select]
sub(DB,30,30,30,10)
the code for drawing a button is
Code: [Select]
sub(DB,30,30,30,10,"5Hello")All you do is simply add a 5th argument as a string of 1-9 characters, with the length prepended to it. So, since there are 5 characters in "Hello", it would become "5Hello".
The button is drawn, and the string is centered in the middle of the button.

I got the code for detecting a string's length from Nemo's dropdown menu routine (http://ourl.ca/4129/146479).

If you want to utilize the GUI stack, simply change the subroutine you call from DB to ADB.
Code: [Select]
sub(ADB,30,30,30,10,"5Hello")
sub(ADB,12,50,30,10,"8Omnimaga")
This creates the button object in the stack.

To render the GUI stack, simply call
Code: [Select]
sub(RND)
The code should be up on the repository soon.
Title: Re: Axe GUI Library
Post by: Munchor on June 03, 2011, 03:05:18 pm
Wooo! That's looking awesome FinaleTI, mainly the button drawing part, great :D
Title: Re: Axe GUI Library
Post by: FinaleTI on June 03, 2011, 03:18:20 pm
Thanks. The GUI stack took a while to make, since I accidentally lost the first build of it. The second one, the one you see now, ended up much better, and I figured an appvar would be better than rampaging all over safeRAM. I really need to optimize the library, so I'm gonna look into that for the time being. I know I can sub-routinize some of the code, but I might need to rewrite other bits.

Just in cause something goes horribly wrong, at least the code is backed up on the repository.
Title: Re: Axe GUI Library
Post by: alberthrocks on June 03, 2011, 03:23:02 pm
Oh my gosh, soo many updates! :D
Since this project is getting intensely sparked, I'm going to have to get that tokenizer working! :) (Basically, converting Michael_Lee's tokenizer to modular form)
Title: Re: Axe GUI Library
Post by: Munchor on June 04, 2011, 07:43:55 am
Here's what I though of for a Loading Bar:

Code: [Select]
LBL DLB
...
DRAW LOADING BAR
r1 is X
r2 is Y
r3 is widht
r4 is height
r5 is percentange
...

Not sure if it's very user-friendly to have 5 arguments, what do you think? The code for drawing it is actually very easy.
Title: Re: Axe GUI Library
Post by: Deep Toaster on June 04, 2011, 09:04:21 am
What about one command to set it up (4 args), and another command to update it (1 arg)?
Title: Re: Axe GUI Library
Post by: FinaleTI on June 04, 2011, 10:43:39 am
What about one command to set it up (4 args), and another command to update it (1 arg)?
That's actually not a bad idea, and would probably be better for the GUI stack.
Perhaps something like
Code: [Select]
Lbl ALB
...
ADD LOADING BAR TO STACK
r1 is X
r2 is Y
r3 is widht
r4 is height
...
to create a Loading Bar object in the stack, then
Code: [Select]
Lbl ULB
...
UPDATE LOADING BAR X
r1 is loading bar # in stack (1st loading bar is 1, 2nd is 2, and so on, regardless of other items in stack)
r2 is percentange
...

I should be able to render it in as little as 2 rectangles, too, so that's good.
I still need to optimize the library, though.
Title: Re: Axe GUI Library
Post by: DJ Omnimaga on June 07, 2011, 04:02:02 am
Wow looks nice! How big is it? (including the scrolling stuff)?
Title: Re: Axe GUI Library
Post by: alberthrocks on June 08, 2011, 09:29:03 pm
One of the concepts I've been working on for Axe GUI Library is this other side of it. I wanted to try something new - offering GUI functions that integrate seemlessly inside the program. Or, if the developer happened to want more control, give them access to some drawing functions, and let the developer handle all the other code. This portion of Axe GUI Library is geared to game developers, but also to any developers wanting a GUI without the full blown GUI. (Mouseless is one aspect.)

That said, no worries - I'm still interested in the regular, window/mouse based Axe GUI Library! :) I'm just adding another side of it to cater to other developers as well.

So what do I have for today? I have the "advanced drawing routine" done and implemented for... MENUS! :D
This routine provides the drawing, all you need to do is provide the input! :)
I've attached BOTH the source and the compiled Axe binary for your convenience.
I strongly suggest opening the source 8Xp inside a PC source editor of some kind. It's very, very, long.
The routine of interest is MNU (line "Lbl MNU" all the way to "Return", as well as routines that are used in routine MNU).
Don't get the code? Thank Runer112 for that extreme optimization that made this routine possible! :D (The original one was very, very slow)

prgmAGMENUD is the binary, which is a significant menu demo program.
prgmAGMENUDS is the source of that program.

This routine can possibly be implemented into actual menus in the regular GUI! (Not sure if actual menubars->menus would work on a calc, but click-button-to-show-menu would work.) Of course, this routine needs more work, esp. to support no animation.

Enjoy! :D

EDIT: Unfortunately, I have no suitable calculator emulator that could record a GIF of the demo program in action. Could someone please record one for me? You just need to run all around using [2nd]/[Enter], the arrow keys, and [Clear]. ;) Thanks!

EDIT 2: Darl181 posted a nice screenie below this post. Thanks Darl181! :D
Title: Re: Axe GUI Library
Post by: Darl181 on June 08, 2011, 11:25:26 pm
Have a screenie.

Impressive :D
Title: Re: Axe GUI Library
Post by: Xeda112358 on November 16, 2011, 07:33:36 am
Wow, this looks amazingly amazing O.O I wonder how easy it would be to drag objects? Like, if you are pressing enter and you are on an object, moving the mouse would move the object to...
This looks very pretty!
Title: Re: Axe GUI Library
Post by: LincolnB on November 16, 2011, 10:00:01 am
That looks pretty sweet. The Game Menu leaves a little to be desired, and the level select screen is decent enough, but the thing that really impressed me the most was the iOS like GUI demo. Looks very cool!

EDIT: Wow, pretty bad necro for Xeda and me. Is this project still being updated?
Title: Re: Axe GUI Library
Post by: Munchor on November 16, 2011, 10:02:13 am
It's amazing to see the whole community made an effort to continue what I started. I started with a few functions to make windows and buttons, but it is now out of this world! Thanks! :)
Title: Re: Axe GUI Library
Post by: alberthrocks on November 16, 2011, 11:42:04 am
It's great to see some interest in this project! :D However, significant redesign is necessary for making it a truly awesome GUI library.

Currently, it does things through an event loop that is dependent on many of the variables.
(Something like:
Code: [Select]
0->Z
While Z!=1
getKey->Z
If Z=1
Y+1->Y
End
If Z=2
X-1->X
End
If Z=3
X+1->X
End
If Z=4
Y-1->Y
End

sub(MOUSE, X, Y)

If Z=[2nd key]
sub(CLICK, X, Y)
End
End
... something like that. :P The program code should be independent from the GUI library, hence why it needs some reworking. Additional features, like instant GUI loading, can be done with a rewrite.)

I used to do some work with FinaleTI about this (Hey! I didn't forget about it! :D I've sent a reply to you today :P), and I included a draft API. If there is significant interest (we'd love developers!), I can publish the proposed API for a "request for comment" so that I can see what developers would like for a GUI API.
Title: Re: Axe GUI Library
Post by: Munchor on November 16, 2011, 12:10:55 pm
I also think that we will move a bit away from the Windows/Gnome-Like GUI and focus on mobile GUIs (Android, iOS-like), because the traditional computer OS GUIs are not adapted for mobile devices (such as calculators).
Title: Re: Axe GUI Library
Post by: alberthrocks on November 16, 2011, 03:12:56 pm
I think in the long run we will keep the mouse GUI, but at the same time develop a more calculator based GUI (see http://ourl.ca/10139/217727).
We will be able to do them both because the rewrite's new structures will support both types of GUI! :D (You'll be able to even mix and match... which isn't the best idea - only for some games, like point and shoot.)
Title: Re: Axe GUI Library
Post by: Sorunome on December 28, 2011, 06:30:19 am
Is this project still active or is it dead? (It looks sooooo cool! )
Title: Re: Axe GUI Library
Post by: Nick on December 28, 2011, 07:03:24 am
wow, i follow sorunome on this..

the only thing i saw was that in the subsubmenu (the right one) , there is safafi instead of safari xp
Title: Re: Axe GUI Library
Post by: Sorunome on December 28, 2011, 07:06:48 am
No, it says safari.... :P
EDIT: Oh, in the right column it says safafi! :P :P :P :P
Title: Re: Axe GUI Library
Post by: alberthrocks on December 31, 2011, 10:09:43 pm
Is this project still active or is it dead? (It looks sooooo cool! )
It's active... but undergoing a very serious rewrite to allow unlimited possibilities. :D
We just like to keep it quiet and make the final product a surprise. ;)
Title: Re: Axe GUI Library
Post by: Nick on January 01, 2012, 06:02:34 am
nice to hear, it looks really good!
Title: Re: Axe GUI Library
Post by: Quigibo on January 02, 2012, 04:27:38 pm
Has this taken advantage of callbacks yet, given that Axe now has variable function calls?  All modern GUI designs these days are callback-based because it makes the programming simple and minimal.  For those that don't know what I'm talking about.  Suppose you want to create a dialog box with a yes and no option.  You could do something like:

Dilog("Are you sure?",LMYes,LMNo)

This would create a dialog with the text "Are you sure?" and when the "Yes" button is clicked, calls the label MYes and when "No" or cancel is clicked, calls the label MNo.  This is just an example implementation, but I wonder if its similar?
Title: Re: Axe GUI Library
Post by: alberthrocks on January 02, 2012, 10:10:18 pm
Has this taken advantage of callbacks yet, given that Axe now has variable function calls?  All modern GUI designs these days are callback-based because it makes the programming simple and minimal.
Indeed we are. ;) However, with this:
Dilog("Are you sure?",LMYes,LMNo)
That would be an example of over-doing it! ;)

This would create a dialog with the text "Are you sure?" and when the "Yes" button is clicked, calls the label MYes and when "No" or cancel is clicked, calls the label MNo.  This is just an example implementation, but I wonder if its similar?
To fully answer this post... I know for a fact that wxWidgets does not do it this way, but it's C++, an OOP language, which Axe does not feature.... yet. ;)

So for a better comparison, I'll use a C based toolkit which has some OOP principles implemented in the background (hint hint: something that we're aiming for!) for proper comparison.

If we look at GTK+, a very popular C GUI toolkit, we have GtkMessageDialog. (See the API here (http://developer.gnome.org/gtk/2.24/GtkDialog.html#gtk-dialog-run). This link points exactly to the section I refer to below.)

If you look at gtk_dialog_run(), it shows how might this be used. Let's display it here:
Code: [Select]
gint result = gtk_dialog_run (GTK_DIALOG (dialog));
switch (result)
  {
    case GTK_RESPONSE_ACCEPT:
       do_application_specific_something ();
       break;
    default:
       do_nothing_since_dialog_was_cancelled ();
       break;
  }
gtk_widget_destroy (dialog);
We don't use callbacks in this case; instead, we take a result integer and compare it to another, preferably through predefined variables (in this case, GTK_RESPONSE_ACCEPT).

For those not versed in C, a pretty Python example (PyGTK) is shown below.
Code: [Select]
        dialog = gtk.MessageDialog(self, 0, gtk.MESSAGE_QUESTION,
            gtk.BUTTONS_YES_NO, "Are you sure you want to exit?")
        dialog.format_secondary_text(
           "We don't want you to lose any data.")
        response = dialog.run()
        dialog.destroy()
        if response == gtk.RESPONSE_YES:
            gtk.main_quit()
        elif response == gtk.RESPONSE_NO:
            print "Not exiting."

However, a case where callbacks may be (or rather, should be) used is when you create a window with all sorts of widgets inside.
For the sake of simplicity, I'll show PyGTK code.

**********************************
* Hello world!               [X] *
**********************************
* +--------+                     *
* | Button |                     *
* +--------+                     *
**********************************


Code: [Select]
import gtk

class PyApp(gtk.Window):

    def __init__(self):
        super(PyApp, self).__init__()
     
        self.set_title("Hello world!")
        self.set_size_request(250, 200)
        self.set_position(gtk.WIN_POS_CENTER)

        self.connect("destroy", gtk.main_quit)

        self.fixed = gtk.Fixed()
        self.add(self.fixed)
       
        button = gtk.Button("Button")
        button.set_size_request(80, 35)
        button.connect("clicked", self.on_clicked) # There's the callback! :)
 
        self.fixed.put(button, 50, 50)
     
        self.set_tooltip_text("Window widget")
        button.set_tooltip_text("Button widget")

        self.show_all()
    def on_clicked(self, widget): # This handle the event
        dialog = gtk.MessageDialog(self, 0, gtk.MESSAGE_QUESTION,
            gtk.BUTTONS_YES_NO, "Are you sure you want to exit?")
        dialog.format_secondary_text(
           "We don't want you to lose any data.")
        response = dialog.run()
        dialog.destroy()
        if response == gtk.RESPONSE_YES:
            gtk.main_quit()
        elif response == gtk.RESPONSE_NO:
            print "Not exiting."

PyApp()
gtk.main()

We, of course, can get even more complex by talking about the different ways you could handle events - GTK+ uses signals and callbacks (http://developer.gnome.org/gtk-tutorial/2.22/x159.html), Qt signals and slots (http://doc.trolltech.com/4.7/signalsandslots.html), wxWidgets an "event table" (http://docs.wxwidgets.org/2.9.3/overview_events.html) and regular callbacks (scroll down) (http://docs.wxwidgets.org/2.8/wx_eventhandlingoverview.html). Kinda crazy, eh? :P I think our plan is to do the "signals and callbacks" method, since it's the simplest to implement and possibly use. :)



Finally, a note to all: we follow the rule "show, don't tell" simply because we like giving surprises (who doesn't? :D), but also it gives us freedom to work on it any time without any deadline pressures. ;) And if it does die - possible, but not likely - no one can be really disappointed because we never offered any expectations in the first place.

This project is undergoing a significant rewrite - we used to do something like this:
Code: [Select]
AddButton(A,1,2)
While Z!=15
getKey->Z
If Z=1
Y+1->Y
End
. etc...
If Z=19 .or whatever ENTER is
DlgBox("Hello world!")
End

Doing it this way would make it impractical, verbose, and just a pain to make a GUI with.
Hence, we went for a complete redesign, with sophisticated planning so that you guys will enjoy the new, refined AGL once it's released! :D
As always, the foundation builds the house, NOT the roof nor the pretty furniture - and we're focusing on that foundation. ;)

If you are really good at Axe, have a passion for GUI toolkits, and would like to help, come on board! :D We could use all the help we can get! Either reply in this topic or PM me and you'll get added in. If possible, showcase some of your previous best works (like a resume :P).

A new year.... a new chance for infinite possibilities! :D
Title: Re: Axe GUI Library
Post by: LincolnB on January 02, 2012, 10:26:27 pm
uh...you lost me.
Title: Re: Axe GUI Library
Post by: alberthrocks on January 03, 2012, 07:40:50 pm
uh...you lost me.
Heh, I'm probably a bad explainer then :P

Basically, the way you build a GUI is to have a "container" to hold the "widgets", starting from the base and up.
When you want to make something interactive - say, if I click a button, I get a popup window - then you have to use a function to "connect" a signal and a callback.

Here's a possible future Axe GUI Library example: (I do not use 5 char label names here since they are very ambiguous)
.AXEGUI
InitGUI(GUIV) .Sets up the GUI system
AddWindow(GUIV, WINV, "Hello world!", 1) .Creates a "fullscreen" window
AddLabel(WINV, LBLV, "Click that button!") .Creates a label
AddButton(WINV, BTNV, "Click me!") .Creates a button

.Let's make it interactive!
Connect(BTNV, 1, LOnClick) .Set up button so that when it's clicked, the label OnClick is called.
ShowGUI() .Show the GUI/mouse.
DestroyGUI() .Delete the GUI once done
Return .Exit

Lbl OnClick
MsgBox("Hey! What a cool MsgBox this is!") .Show a dialog box (MsgBox)
Return .Exit from subroutine


If you're still confused, please tell me and I'll try to clarify. (That may mean the current API must be complex... :P)
Title: Re: Axe GUI Library
Post by: LincolnB on January 05, 2012, 10:25:52 am
Oh, that makes a lot of sense. Sorry, I was just kind of in a hurry when I "read" that first post of yours. Looking back, it makes sense too. I probably should have read it hehe.

But yeah, that looks sweet. I'm way excited for this!