Lesson 10
Drawing and saving pictures
To continue on from the last lesson, we will discuss how to properly use points, pixels, and how to save and recall pictures.
Points
There are seven commands under the
POINTS menu, I will break it into seperate groups. The first group is about the point commands.
Pt-On( turns on a point in an
x,y,mark format.
mark can be one of three values, and each value will present a different mark on the screen.
1 will turn on a pixel, 2 will place a box
around where the pixel is supposed to be, and 3 will place a +. If you just want a pixel turned on, you do not have to include
mark.
Pt-Off( works the same way, and also has the
mark ability. What is really neat is that if you
Pt-On( and use
mark number 2, you can
Pt-Off( with number 1 through 3.
Pt-Change( also has the same format, but does not have the
mark ability.
Pt-Change basically changes the pixel at the specified coordinate.
The last four commands are about pixels (Pxl). There are slight differences between pt and pxl commands. One of them is that pxl does not have the
mark ability. Another is the format of the of the coordinates.
Pxl-On( and
Pxl-Off( turns on and off pixels, and
Pxl-Change changes the current pixel. These commands work in an
y,x format.
Pxl-Test( is a command that refers to a pixel on the screen, and returns a 1 (on) or 0 (off).
The pt commands are able to be used directly on the graphscren, and can be used in a program. The pxl commands can only be used within a program or the homescreen.
Saving and Recalling pictures
Saving and recalling pictures requires two things. First you need either the
StorePic or
RecallPic commands, and you will need one of ten variables, found by pressing
[VARS] and
[4] and then choose one of the variables.
To store a picture, use the following syntax:
StorePic Picx
x is 0-9. What this does is create a 767 byte picture variable for easy reference. You recall an image the same way you store it. A nice feature is that recalling a picture variable will not erase what is presently stored in the graph buffer. There has been a few first person type of games made using this feature (Tomb Raider is one off the top of my memory). The only problem is that there are only 10 available picture variables. This will limit you on pictures, so don't try to rely on them as much. There is a program that helps with this, but you will have to wait for the advanced tutorials on asm libraries. :)
You can save to any picture variable, but be careful, because it will overwrite previous data, and won't ask. If you try to refer to a picture variable that has no data, i.e. it doesn't exist, you will get an ERR:UNDEFINED. The picture variables can be archived and unarchived, using the commands in
lesson 1. You will also have to make sure they are unarchived before you try to access them.
That is pretty much everything in this lesson. This covers most of the common drawing commands. In the next lesson, we will cover the making of a basic paint program.