Hi, I was wondering if someone could point me in the right direction or provide some tips on if it's possible to program a mouse pointer that the user can move around on top of a hires graphic on an apple iic in Basic (I'm using a iigs emulator for development and then I copy out to a disk for testing on an apple iic)
Using code from the book below, I was able to get a mouse working and got it's X,Y and status, and I can also have the mouse draw one top of a hires graphic. But I'm not sure how to go about having the mouse pointer move overtop of the graphic without leaving a trail of pointers behind.
I've been thinking maybe I need to do page flipping, or keep a copy of the image in ram and copy it back to a$2000 each time the mouse moves, or use a shape table, but I'm new to programming on the apple iic, and was wondering if someone might be able to point me in the right direction so I don't go down a rabbit hole. Ideally I'd like to do it in Basic since I really don't know what I'm doing in assembly.
https://vintageapple.org/apple_ii/pdf/Apple_Graphics_Tools_and_Techniques_1984.pdf
Thanks!
Yeah, you're on the right track. You can display either HGR graphics page number one or two. HGR (with text space below), or HGR2, occupy memory spaces $2000-$3FFF, and $4000-$5FFF respectively. So if you animate a graphic (SHAPE or otherwise) over page one, you can "erase" the old shape (at it's old position) by having the same screen image in memory at both locations, and using the data from the unseen page as the reference to restore the seen screen image. To do it quickly, you just need to erase the bits at the old pointer graphic location, not the whole screen page. That's one way, and this method is okay machine language, slower in BASIC, but either one you get a bit of a flashing effect. You can minimize this by adding a slight pause while the graphic of the pointer is drawn/seen.The non-flashing way of doing this is to only draw the pointer, but give it a background refreshing perimeter that references the unseen screen page, as mentioned above. This gives a better result, but takes a bit more finese.
For avoiding all the hassle of writing your own animation routine (if you'd like), I recommend using The Graphics Magician. It was two programs in one. One program is a vector-based draw & fill program (that was much imitated for text adventures), and the other part is a clean animator, with the option for built-in erase to black or (what you want to do) erase to background. As with what I suggested above, you need to use both HiRes screen memory locations. One to display, one for keeping a clean copy of the background.The Graphics Magician was written with the BASIC language programmer in mind, so you make your shape(s), backgrounds, etc... then load theim from disk with DOS (or ProDOS) / BASIC commands, and use pokes, peeks, and calls to operate the animations.
Awesome, thanks for the suggestions mutant_pie! Makes sense to only reload the parts of the image where the pointer was. I'll try to give the Graphics Magician a go tonight, that sounds up my alley. The vector and fill tool sounds neat too. Thanks!
Thanks for the tip on graphics magician! I've run into one little hiccup. I'm trying to have the mouse pointer (a GM shape that is a little white pointer) be visible on top of a hi-res image that is mostly white but I can't seem to see the pointer. I know the pointer is there since when I move it over a part of the image that's not white I can see it.
First I tried adding a black border around the white pointer, but it seems GM treats the black as transparent. Then I tried putting a green border around the pointer, then I tried changing the pointer color itself to orange and green. But in all cases when the pointer moves over a white hi-res background you can't see it. Do you think I'll have to abandon GM to get this to work? I'm guessing it's something with the way pixels that are next to each other will display as white...
Hi Nemo,
Once again, your memory of how the HIRES screens work is spot on. When it comes to colors, due to Woz's thrifty methods, there are limits in HIRES. Two dots immediately next to each other form a "white" double-wide pixel. My memory fails me, but I think that there are several (three?) redraw/erase options in the Graphics Magician. I think that one deals with the issue that you are talking about, but has a longer refresh cycle. That would only be a problem with a very large graphic, where it will slow everything down too much. Check the manual for the different.