Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: ACagliano on August 30, 2010, 12:37:08 pm

Title: Bitmap command
Post by: ACagliano on August 30, 2010, 12:37:08 pm
Can someone explain to me how to use the Bitmap command. I get the bitmap(x,y...    part. X means x and Y means y. But what about the actual map? How should a filled 6x6 sprite look for that command?
Title: Re: Bitmap command
Post by: Raylin on August 30, 2010, 12:53:04 pm
What you do is use the Data() command and make it so that 6x6 is your width and height.
Then, write your data after that.
Then, Bitmap that Pointer.
Title: Re: Bitmap command
Post by: ACagliano on August 30, 2010, 12:59:57 pm
But what I'm asking is how should the data look. What would the "rows of that image" look like?
Title: Re: Bitmap command
Post by: Raylin on August 30, 2010, 01:04:17 pm
Code: (Axe BASIC) [Select]
:.BLAH
:Data(6,1->GDB1
:[FFFFFFFFFFFF
:ClrDraw
:Bitmap(1,1,GDB1
Title: Re: Bitmap command
Post by: nemo on August 30, 2010, 06:12:57 pm
Code: (General Formula) [Select]
Data(rowsInImage , columnsInImage)->Pic1  .columnsInImage must be a multiple of eight!
[[HEX]]
Bitmap(X,Y,Pic1)
Title: Re: Bitmap command
Post by: FinaleTI on August 30, 2010, 06:33:01 pm
Actually, you can define the first two bytes of the sprite as the size.

Code: [Select]
.BITMAP
[181000000070009803641E6430127FD254B1192919251035F1DE5E242528DCD6B7F54C5B3ECE1DFC23664E32D42BF81F0000→Pic1
Bitmap(X,Y,Pic1)
The first two bytes are hexadecimal for the height and the width of what you want to display in that order.
The width that you define does not have to be a multiple of 8, but you do have to pad all the rows in your bitmap to the nearest byte.

Be aware that if you use bitmaps in an App, you'll have to copy the bitmap you want to display to saferam or an appvar, then use a pointer to that location to display it.
Code: [Select]
.Bitmap
[181000000070009803641E6430127FD254B1192919251035F1DE5E242528DCD6B7F54C5B3ECE1DFC23664E32D42BF81F0000→Pic1
"appvBITMAP→Str1
GetCalc(Str1,50)→P
Bitmap(X,Y,P)

The examples I posted will display a 16x24 sprite at X,Y.
Title: Re: Bitmap command
Post by: LordConiupiter on August 31, 2010, 05:23:21 am
can't you read from Archive with Axe? Or is this because of Bitmap is an OS ROMcall, which isn't fully converted to Axe command (jet)?
Title: Re: Bitmap command
Post by: ACagliano on August 31, 2010, 11:05:56 am
Thank you both. I'll play around an see what I can do.
Title: Re: Bitmap command
Post by: Quigibo on August 31, 2010, 05:34:40 pm
If you draw sprites from archive, you will need to follow a few steps.  First have a small reserved place in ram for a very small and very temporary storage such as L5.  Use the copy command to copy the sprite's data to that temporary buffer.  Draw the sprite using that buffer as an argument instead of the file.  You should turn this into a subroutine that does both of these things for you automatically so you only need a single call to draw the sprite.  The exact same procedure should be used with apps as well.  If you're drawing the same sprite multiple times, you can optimize by only copying once and then drawing every instance of that sprite before copying the next sprite to be drawn.