Calculator Community > Calculator C

[TIGCC] C strange 16x16 sprite error?

(1/3) > >>

bfr:
For some reason, I get the following error only when I do something for a 16x16 sprite - it doesn't happen with 8x8 or 32x32.

Incompatible type for argument 4 for 'Sprite16'.

Here's the code:

sprite16.c

c1-->CODE ec1
#include
#include "spinit.h"

unsigned short int sprite;

void _main(int x, int y, int height, char* variable, char* plane, char* method){
   if(variable=="a16"){
 

Ranman:
The function prototype for Sprite16 is:

c1-->CODE ec1void Sprite16 (short x, short y, short height, unsigned short *sprite, void *vm_addr, short mode); c2ec2

The 4th parameter is an "unsigned short *" not an "unsigned short". It is expecting you to pass in a pointer to an unsigned short. This pointer is the address of the sprite data.


Another thing to remember:

Both Sprite16 and Sprite32 expect the sprite data to begin on an even memory address. If you attempt to pass in an odd address to them, you will get a memory violation.

bfr:
Thanks.  =)

I'm always making mistakes like these...:dang:

Liazon:
QuoteBegin-Ranman+-->QUOTE (Ranman)
Both Sprite16 and Sprite32 expect the sprite data to begin on an even memory address. If you attempt to pass in an odd address to them, you will get a memory violation.

how is this possible?  how would you know if the address was odd/even?

Ranman:
QuoteBegin-Liazon+Mar 20 2006, 22:1-->QUOTE (Liazon @ Mar 20 2006, 22:10) how is this possible?

Navigation

[0] Message Index

[#] Next page

Go to full version