Some useful tips for starting blitzmax

BlitzMax Forums/BlitzMax Beginners Area/Some useful tips for starting blitzmax

Juiceter(Posted March) [#1]
BLITZ MAX - well I found them useful!

1. incbin(). Including binary files in your programs rather than having them external still exists! Graphics or sound can be included as such:

Incbin "a.bmp" ; Global nt=LoadImage:TImage("Incbin::a.bmp")

2. To do lots on one line use ; (semi-colon) - the old comment character in blitz 2d.

3. Use strict, it helps with debugging variables.

4. Use .ogg sound file format instead of .mp3 (licenced). It produces smaller files and there are plenty of converters on the internet.

5. To comment lines use ‘‘’. For blocks of lines use rem and end rem.

6. For Graphics work: there are no buffers as in blitz 2D. Draw to the Backbuffer, clear the screen then redraw everything. If you want to preserve something then use grabimage before cls in the display loop. Images effectively become the buffers.

7. Set colour to white before you use drawimage to draw it properly. Other colours will produce a shaded version of what you want to draw (good for effects such as ‘Graying-out’ unselected buttons etc.).

8. A reason to use Blitz Max over Blitz 2D is that you can do real-time rotation etc. but it is harder to learn. Syntax has been changed to look more like c.

9. Printing from the IDE: 90 chars per line max portrait, 135 chars per line landscape. 150 chars per line max on screen.

10. Defdata replaces data statements, and labels begin with ‘#’ rather than ‘.’.

11. Global DeltaTime, TimeDelay defines both variables as Global in this instance.

12. Try not to use grabimage as it is slow.

13. Defining a Byte variable and assigning a larger variable to it will result in truncation of the latter (very useful if you only want the first byte of it). Likewise with Word and Short. Using only the size of variable you need helps to save a lot of memory - a big plus over Blitz 2D if, say, you are using a huge 2 dimensional array.


Juiceter(Posted March) [#2]
Actually, I should have said that this is a guide to people transferring from blitz 2D to blitz max as that would make more sense ;-). Some of the changes mentioned confused me for a while.

10. seemed a pointless change though.