#101817 - cppdungeon - Fri Sep 08, 2006 6:53 am
ok the point of this program is to basically make paint (the drawing tool for windows) for your gameboy. the problem, is that when the cursor moves, it doesent erase its trail. my solution is this sequence of events:
1. save screen to a buffer
2. draw screen
3. draw pointer
4. get any keypresses and calculate any changes
5 re calculate screen and repeat.
how do i make a buffer for my screen? how do i write to the screen with this buffer?
_________________
"in Soviet Russia, car pimps you!"
#101820 - DekuTree64 - Fri Sep 08, 2006 7:29 am
Make the cursor a sprite, and you won't have to worry about it affecting the drawing area.
Assuming you're using mode 3 or mode 4 for the BG, make sure you put the sprite at char 512 or higher, because the first half of the sprite VRAM gets switched to being used for the BG in those modes.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#101951 - cppdungeon - Sat Sep 09, 2006 5:05 am
what do you mean "char" ?
_________________
"in Soviet Russia, car pimps you!"
#101953 - tepples - Sat Sep 09, 2006 5:33 am
There are 1024 spaces in the sprite cel VRAM, each of 32 bytes. Each can hold 8x8 pixels of 16-color sprite cel data or 8x4 pixels of 256-color sprite cel data. If you are using a tiled mode (GBA display mode 0, 1, or 2), you can use all spaces 0 to 1023. But if you are using an extended rotation mode (GBA display mode 3, 4, or 5), as is likely in an image editor, you can use only the second half, that is, spaces 512 to 1023.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#101955 - DekuTree64 - Sat Sep 09, 2006 5:38 am
Check out the tutorials in the GBA section at http://www.drunkencoders.com, particularly day 3, which is all about sprites.
Basically a char on the GBA is an 8x8 pixel square. Most of the graphics hardware requires the data to be stored as chars, rather than bitmap format.
There are plenty of tools to convert .bmp files to char format, which can be found in the gbadev.org tools section. My personal favorite is gfx2gba v0.13, but that only outputs raw binary data, which is a bit more work to include in a GBA program. Kaleid is a nice windows tool that outputs a C code array of the graphics data. Probably easier if you only need a single sprite.
Those tutorials explain how to actually display the data, and should get you up and running in no time.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku