Retro C IDE will soon be renamed to Retro GUI IDE with the addition of Quinn Dunki’s WeeGUI library & BASIC code builder integration for Apple II. Details coming soon, but here’s a couple of pictures to get things started:
OK so how do a a few mouse click and a few lines of Applesoft BASIC result in this KENO simulation? Well that might be a bit of an exageration, however still much easier than coding it all from scratch.
When one starts up Retro C IDE (Retro GUI IDE name change comming) you are asked to select either an existing project create a new one. Once selected the main IDE is displayed. For a AppleSoft/WeeGUI project Apple II/e should be selected as the target system, and then WeeGUI in the Window defintion group should be checked.
The size of the main window (or view in WeeGUI terminology) is set with the four spinner controls X1, Y1, X2, Y2. This is enough to create a program, not a very exciting one.
Upon clicking the play button (code, save, compile run) the codebuilder engine creates the BASIC code in the code window, the one in the lower right part of the IDE screen. It is automatically copied to the clipboard and then the AppleWin emulator is started. Then Shift -Insert will past the code into the emulator, and a RUN is appended to the bottom of the code so the program starts, yes automatically.
One point of interest is the code in the conde textbox is not in numerical order, but that doesn’t matter, think about typing a BASIC program, you don’t type in all the lines in order do you? See the images below, the first from the IDE the second listed at the ProDOS prompt.
So all this from a couple of settings in the IDE, but what does it do? First it should be noted that the target disk in the drive is a ProDOS disk with the WeeGUI program already installed, with BASIC.SYSTEM as well.
Line 10 starts up the WeeGUI program which sits in the background, (to see Quinn’s documentation see the link at the top of this post). Line 15 calls two subroutines, one that sets up all the views (think controls like windows, buttons, progress bar etc) at 60000 and one that draws static objects like labels and rectangales (boxes). The reason for this approach lies within the beauty of WeeGUI’s “lightweightness” and that there is no capturing of screen memory for redrawing. So if part of a screen gets covered being able to access these subroutines later on will be valuable. We will see this later when the help system is added.
At this point the only view set up at 60000 is the main window in line 60005. The &WINDW() has several parameters the first is the view ID, one can have upto 16 views, this one is 0. The second one is the style of the window in this case “1” is a simple box. The next two are the top left corner of the box (1,1) and the final four are the width and height of the box and text area (which can also be larger or smaller than the window).
The &sel(0) at 60101 and 6301 will be important once more views, static objects are added, but this command tells WeeGUI which view (in this case window) to apply other commands. It’s important to note these line numbers as they will be the same (60000, 60300) for all programs built with Retro GUI IDE.
Lines 100-199 form the control loop that allows for user input to WeeGUI to execute actions. Line 160 checks for the escape key and if found transfer focuse to the previous view (control) in the list, and line 170 detects a tab and advances focus to the next view. Line 180 checks for the enter key and then lets WeeGUI take the appropriate action based on the view. For example if the view is a button then the code tied to the button (a callback subroutine) is called.
I like to set the emulated procressor speed to maximum when pastng in the code, to speed things up, and then slow it down while the program is running. When this program is run not alot exciting is seen for the user. The main window is displayed and the program is looping for key presses. It should be noted the WeeGUI has it’s own &GET(A%) routine which is non-blocking, meaning that processing is occuring while checking for keys, this allows the GUI’ness. Since no other views or key checks have been added CTRL-C is our only way out at this point.
To save the work so far selecting file / Save or clicking the save (blue disk) button will create a *.rci file which holds the project data and can be loaded next time the Retro GUI IDE is run.
In the next post the menu system will be added.