Despite infrequent Blog updates, progress has been slow but steady over the last couple of days; I kicked off by adding the cursor pulse routines, which required a little investigation due to the fact that Blitz Max handles Data statements a little differently (indeed, it handles everything a little differently - maybe I should stop pointing this out...). Next came the Map display code - potentially a big headache but the routine slid into the framework seamlessly.
Next up came the Control routine, undoubtedly the biggest single function in the whole program. The task at hand involved removing any keychecks that were already covered in the Menu event checks (if a hotkey is assigned to a Menu item, Blitz Max will generate an event if either the Menu item is selected or if the hotkey is pressed - this means that one doesn't have to do a multitude of keychecks).
The changes in the Control routine also threw up a few little errors (Control was being called 100 times a second, sometimes twice, and the Event queue was saturated with requests). The change in the logic flow also required a few Event-driven checks, such as the Mouse Wheel, to be moved elsewhere in the program.
Rounded things off by writing my own Draw Box routine; Blitz+ had a lovely little flag that told the Draw Rect routine whether or not to draw a solid box or just an outline; Blitz Max lacks this feature (for some obscure reason), so a little bit of creative coding was needed.
Sunday, July 29, 2007
Tuesday, July 24, 2007
Wednesday 24th
The past few days have been spent furiously copying and pasting FishEd code into the new framework, and tidying up a multitude of errors and syntax changes along the way. I started by sorting out a small problem with the toolbar, as the spacers weren't working properly - this turned out to be a problem caused by the fact that the toolbar graphic was a BMP instead of a PNG. I also tidied up the event calls, as Blitz+ starts Toolbar events at zero and ignores Toolbar spaces.
This was followed by a lengthy session adding hotkeys and modifier commands to the Menus; in Blitz+, you had to add Menu shortcut keys manually, and check for the key presses yourself; Blitz Max, on the other hand, has a beautiful system that not only prints the hotkey text in the menu for you, but also checks for the keypress. Lots of fiddly work to convert, but beautiful in practise.
Hit a slight snag with the hotkey code, namely the issue of keyboard conflicts (the menu key detection takes priority over any manual key checks I perform). Finished off that particular session, however, by implementing a proper, full-screen zoom mode, something which was exceedingly simple to implement; this bodes well for FishEd Max, and hopefully I'll be able to have a much more powerful and flexible zoom mode.
Next came a fairly lengthy session inside the Globals source file; I want FishEd Max to run in Superstrict mode, which requires that, among other things, variable types are declared - this involved adding a % after all my integers, as well as assigning Object Types to Gadgets, Images and Banks.
The next big task was to start adding the Menu checks, Toolbar checks, and Button checks; the biggest problem here is that the functions have yet to be copied across to the Testbed, so any checks I add would be referencing non-existent routines.
However, I needed to set up my external function files anyway, so I set about adding the checks, compiling, then fixing the errors one by one by adding a dummy function to my function files each time a function couldn't be found (thus giving me a fully working template program).
This has the knock-on effect of allowing me to simply cut 'n' paste the functions into their relevant spot in the function files; in effect, I'm completely organised before I even start converting code. :)
With that arduous groundwork out of the way, I'm was free to start porting routines across one by one, so I kicked off by adding the Grid display code, and then turned my attention to getting the Canvas display code working for the various panels. Rounded off yesterday's session by adding the Tile Inc/Dec code (I'd completely forgotten that I'd written a really nice routine that increments and decrements the current tile, adjusting all of the display cursors and offsets along the way - a classic case of "That's a really nice routine, but I don't remember writing it...").
This was followed by a lengthy session adding hotkeys and modifier commands to the Menus; in Blitz+, you had to add Menu shortcut keys manually, and check for the key presses yourself; Blitz Max, on the other hand, has a beautiful system that not only prints the hotkey text in the menu for you, but also checks for the keypress. Lots of fiddly work to convert, but beautiful in practise.
Hit a slight snag with the hotkey code, namely the issue of keyboard conflicts (the menu key detection takes priority over any manual key checks I perform). Finished off that particular session, however, by implementing a proper, full-screen zoom mode, something which was exceedingly simple to implement; this bodes well for FishEd Max, and hopefully I'll be able to have a much more powerful and flexible zoom mode.
Next came a fairly lengthy session inside the Globals source file; I want FishEd Max to run in Superstrict mode, which requires that, among other things, variable types are declared - this involved adding a % after all my integers, as well as assigning Object Types to Gadgets, Images and Banks.
The next big task was to start adding the Menu checks, Toolbar checks, and Button checks; the biggest problem here is that the functions have yet to be copied across to the Testbed, so any checks I add would be referencing non-existent routines.
However, I needed to set up my external function files anyway, so I set about adding the checks, compiling, then fixing the errors one by one by adding a dummy function to my function files each time a function couldn't be found (thus giving me a fully working template program).
This has the knock-on effect of allowing me to simply cut 'n' paste the functions into their relevant spot in the function files; in effect, I'm completely organised before I even start converting code. :)
With that arduous groundwork out of the way, I'm was free to start porting routines across one by one, so I kicked off by adding the Grid display code, and then turned my attention to getting the Canvas display code working for the various panels. Rounded off yesterday's session by adding the Tile Inc/Dec code (I'd completely forgotten that I'd written a really nice routine that increments and decrements the current tile, adjusting all of the display cursors and offsets along the way - a classic case of "That's a really nice routine, but I don't remember writing it...").
Saturday, July 21, 2007
Saturday 21st
Today's fairly lengthy session was one of those days where you toil and struggle with all manner of bugs and problems, only to find that the program looks exactly the same as it did at the start of the day (albeit a little cleaner).
My strategy today was to start synchronising my testbed program with my main program, which also involved tidying up my external Globals file crammed with all the variables used in the program; the biggest challenge here was tweaking a vast array of arrays, as Blitz Max handles them slightly differently. Naturally, this generated several errors along the way, much to my delight.
Later in the afternoon I managed to completely break the program, but after a break for some food and a nice cup of tea, I returned to the editor and manage to iron out most of the problems (many of which are just simple teething problems associated with my Blitz Max inexperience).
By the end of the day I managed to get the Splash Screen ported across to the new framework, and thus my strategy for the conversion became clear: I take my main program (a straight copy of my Blitz Plus code), and piece by piece import it into the testbed, converting to the Blitx Max syntax along the way and splitting bigger functions into external files. Wish me luck :)
My strategy today was to start synchronising my testbed program with my main program, which also involved tidying up my external Globals file crammed with all the variables used in the program; the biggest challenge here was tweaking a vast array of arrays, as Blitz Max handles them slightly differently. Naturally, this generated several errors along the way, much to my delight.
Later in the afternoon I managed to completely break the program, but after a break for some food and a nice cup of tea, I returned to the editor and manage to iron out most of the problems (many of which are just simple teething problems associated with my Blitz Max inexperience).
By the end of the day I managed to get the Splash Screen ported across to the new framework, and thus my strategy for the conversion became clear: I take my main program (a straight copy of my Blitz Plus code), and piece by piece import it into the testbed, converting to the Blitx Max syntax along the way and splitting bigger functions into external files. Wish me luck :)
Friday, July 20, 2007
Friday 20th
After a very long hiatus in my programming activities, due in no small part to a huge amount of upheaval in my personal life, today saw me delving back into the world of Blitz programming after being away from the keyboard for almost a year.
I'd promised myself that, after writing FishEd, I'd concentrate on writing the remake of Citadel which started this whole thing in the first place; however, I'd always relished the challenge of rewriting FishEd in Blitz Max, which would allow me to add all manner of new features to the program.
After FishEd's release, I received a few enquiries regarding the program and possible commercial opportunities, and after discussing enhancements and Wish Lists with other developers and artists, returning to the project seemed like an interesting challenge.
The biggest hurdle ahead is undoubtedly getting to grips with Blitz Max after being so comfortably nestled in the bosom of Blitz Plus; though the two programs have deep, inherent similarities, there are also a lot of areas in which the two programs are poles apart. Many of the techniques I'd used in FishEd are not possible in Blitz Max, and it's likely that huge areas of the editor will need to be rewritten.
I'd actually spent a couple of days at the beginning of the year converting some of the basic FishEd code across, allowing me to display the basic window, as well as loading in a test map. However, this testbed left a lot to be desired, and the Events system - used for trapping keyboard input, mouse input, and any kind of user/gadget interaction - was virtually non-existent.
Today's session began with me converting my files across to Blitz Max, cutting and pasting across from Blitz Plus and changing obvious syntax differences; the relative sluggishness of the Blitz Max IDE is forcing me to think about how I might organise the files a little better (my main source file is 15,000 lines long - way too cumbersome, in retrospect).
After doing a few test compiles, it became obvious that a change of tactics was needed; it'd be virtually impossible to compile the code, fix the errors, compile, fix, compile, and so forth. Therefore, I returned to my earlier testbed code (which is considerably smaller and easier to manage), and set about methodically creating a framework into which I can paste chunks of code from FishEd and bash through the workload in logical chunks.
In actual fact, this turned out to be a very nice way of working; I recall that early in FishEd's development, I hit a stumbling block with the way that the program processed Windows events and user input, and this I stripped the program down to a basic shell, rewrote the underlying interface, and then added everything else back in.
The first hurdle was to get keyboard input working properly; this has always seemed unnecessarily finicky in Blitz Max, but thankfully I managed to pilfer some example code from the Blitz Forum which did the job beautifully (sometimes it's not the code you need to plagiarise, but the technique).
With this crucial part of the framework in place, I then set about bringing the Tiles panel to life, and finished up by adding an Event Hook that ensures the canvases are always redrawn if, for instance, the window is dragged off-screen or a menu drops down over the canvas areas. In short, an extremely productive session which has given me buckets of enthusiasm for the project ahead.
I'd promised myself that, after writing FishEd, I'd concentrate on writing the remake of Citadel which started this whole thing in the first place; however, I'd always relished the challenge of rewriting FishEd in Blitz Max, which would allow me to add all manner of new features to the program.
After FishEd's release, I received a few enquiries regarding the program and possible commercial opportunities, and after discussing enhancements and Wish Lists with other developers and artists, returning to the project seemed like an interesting challenge.
The biggest hurdle ahead is undoubtedly getting to grips with Blitz Max after being so comfortably nestled in the bosom of Blitz Plus; though the two programs have deep, inherent similarities, there are also a lot of areas in which the two programs are poles apart. Many of the techniques I'd used in FishEd are not possible in Blitz Max, and it's likely that huge areas of the editor will need to be rewritten.
I'd actually spent a couple of days at the beginning of the year converting some of the basic FishEd code across, allowing me to display the basic window, as well as loading in a test map. However, this testbed left a lot to be desired, and the Events system - used for trapping keyboard input, mouse input, and any kind of user/gadget interaction - was virtually non-existent.
Today's session began with me converting my files across to Blitz Max, cutting and pasting across from Blitz Plus and changing obvious syntax differences; the relative sluggishness of the Blitz Max IDE is forcing me to think about how I might organise the files a little better (my main source file is 15,000 lines long - way too cumbersome, in retrospect).
After doing a few test compiles, it became obvious that a change of tactics was needed; it'd be virtually impossible to compile the code, fix the errors, compile, fix, compile, and so forth. Therefore, I returned to my earlier testbed code (which is considerably smaller and easier to manage), and set about methodically creating a framework into which I can paste chunks of code from FishEd and bash through the workload in logical chunks.
In actual fact, this turned out to be a very nice way of working; I recall that early in FishEd's development, I hit a stumbling block with the way that the program processed Windows events and user input, and this I stripped the program down to a basic shell, rewrote the underlying interface, and then added everything else back in.
The first hurdle was to get keyboard input working properly; this has always seemed unnecessarily finicky in Blitz Max, but thankfully I managed to pilfer some example code from the Blitz Forum which did the job beautifully (sometimes it's not the code you need to plagiarise, but the technique).
With this crucial part of the framework in place, I then set about bringing the Tiles panel to life, and finished up by adding an Event Hook that ensures the canvases are always redrawn if, for instance, the window is dragged off-screen or a menu drops down over the canvas areas. In short, an extremely productive session which has given me buckets of enthusiasm for the project ahead.
Subscribe to:
Posts (Atom)
