CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: SopaXorzTaker on August 23, 2017, 11:13:34 AM

Poll
Question: Should I add an input control in the next version? If so, how?
Option 1: The input control should work like the Input Str1 command is in TI-BASIC (like the default keyboard). votes: 4
Option 2: The input control should work like an old phone, with the number keys repeatedly pressed for various letters. votes: 0
Option 3: Other, I'll describe below. votes: 0
Option 4: Don't add an input control. votes: 1
Title: [ti-84+] GTKALK, a primitive GUI library!
Post by: SopaXorzTaker on August 23, 2017, 11:13:34 AM
(https://img.ourl.ca/1503507941.gif)

http://sc.cemetech.net/?hash=DxaLZE3oe+a3YgRYQ8mQA148UdXZ

So basically, GTKALK is my attempt at writing a simple and lightweight GUI library in TI-BASIC.
It's pretty simple, doesn't support the color calculators yet, but I think you guys might find it interesting ;).

Program GTKEX0 is a simple demo of all features so far.
GTKEX1 is a more sophisticated one, showing multiple buttons and stuff.

(move the cursor with arrow keys and use ENTER to click - the Input command is used to handle the cursor)
To exit GTKEX1, just click on the button that says X (obviously).
Please, try it and tell me what do you think  :).
Again, don't expect full-blown Qt running on your calculator.

You can use the code for any purposes, just consider giving credit (optional).
Title: Re: [ti-84+] GTKALK, a primitive GUI library!
Post by: 123outerme on August 23, 2017, 02:16:05 PM
Wow, that's looking good! It seems to run pretty fast, and I assume buttons can have custom behavior, so I'd love to see it used some day for a game menu or battle screen! Do you have any projects in mind for this?
Title: Re: [ti-84+] GTKALK, a primitive GUI library!
Post by: SopaXorzTaker on August 23, 2017, 02:22:43 PM
Initially I wanted to write some sort of a Logisim clone, and the idea to write that came up.
It's really primitive, and the program has to handle redrawing of windows, etc (see the source code of GTKEX0/1).
You can even write custom controls for it, the calling convention is really simple and described in the comments.

The code of GTKEX0 (on Cemetech) is commented (and comments aren't preserved in the tokenized version attached), you can read it to understand how the library works.

I am also planning to port it to 84+CE, with colors and stuff.
Title: Re: GTKALK, a primitive GUI library!
Post by: ben_g on August 23, 2017, 06:23:41 PM
I'd personally use the "CoordOff" instruction before the input to hide the coordinates at the bottom, but apart from that it looks pretty good.
Title: Re: [ti-84+] GTKALK, a primitive GUI library!
Post by: kotu on August 24, 2017, 05:49:24 AM
This looks really beautiful, reminds me of when I used to make GUI programs in ASCII on my CGA XT with QuickBASIC.

Can't wait to see a colour version!! Will it be in C or TI-BASIC??


*edit*
BTW I voted not to add a input control - yet - that might actually be quite tricky - with such things as do you scroll the contents of the control to the left if you use up all the space?
I'd rather see it in colour first - but I am biased  :D
Title: Re: GTKALK, a primitive GUI library!
Post by: Dream of Omnimaga on August 26, 2017, 04:12:30 PM
For a CE version, you can probably make some fancy borders via a for loop that generates gradient borders.
Title: Re: [ti-84+] GTKALK, a primitive GUI library!
Post by: kotu on August 31, 2017, 03:36:43 PM
Well, it's possible I guess, but gradients can be dodgy even with 24-bit color, so might be a waste of palette