AmiDevCpp - sprites problem
Hi, cant get sprites to work in amidevcpp - have been trying for days :)
I open the screen with: Code:
genscreen = OpenScreenTags(NULL, My spritedata: Code:
UWORD sprite_data[]={ Code:
struct SimpleSprite * sprite; sprite->x=0; sprite->y=0; sprite->height=9; but cant do that in amidevcpp - get compile error "dereferencing pointer to incomplete type" Any help is appreciated. Regards.... |
i cannot help here, but you should copy the exact error message from the "Compiler Log" tab,
and the source code lines where it find the error you describe. |
Its on the first line
Sprite->x = 0; Or if i comment that than on the next line |
ah, ok, this is your code:
Code:
... "struct SimpleSprite { ... };" is missing. does it have the "members" x, y, height? there should be something like that: Code:
struct SimpleSprite { |
struct SimpleSprite
{ UWORD *posctldata; UWORD height; UWORD x,y; /* current position */ UWORD num; }; In sprite.h which comes with amidevcpp. |
hmm, you have #include <sprite.h> in you source file ? :)
on stackoverflow someone suggest to allocate mem for that struct: Code:
struct SimpleSprite * sprite = malloc(sizeof(SimpleSprite)); |
Tried it allready but the getsprite acctually changes the pointer. So alloc is the leak then. Anyhow already tried and no help :)
|
Quote:
#1) where do you have the "sprite->x =0;" lines? i think they have to be in the same function and below the "struct SimpleSprite * sprite;" line. Code:
struct SimpleSprite * sprite; |
Well not really, it needs to be bellow if, in that place pointer is still empty.
But it makes no difference, cant access any members anywhere |
Quote:
|
Same error... tricky isnt it :) cant write to it, cant read from it. :)
|
Quote:
#1) another one from my lightwave plugin stuff. they do initialze the member before they do the struct, in this case typedef struct: Code:
int spln,dirn,thickness; |
Thats perfect for this example.
I use that all the time. But the pointer within simpleSprite i think is not allowing to access any element. No matter how are they allocated. |
Quote:
I thought you have to use all of them, but what you do, is just set some values for a certain member. this is strange. maybe that pointer has to get initialized prior using the sprite struct? #1) i would just make a copy of sprite.h, and edit that struct, move the *posctldata to the last position of that struct. just to see what happens :spin |
yup, that works, tried it now - no problems.
but that structure needs to be like this - for system calls, cant just move pointer down... |
Well, thanks a lot!!! you got me thinking in a different direction.
struct SimpleSprite1 { APTR posctldata; UWORD height; UWORD x,y; UWORD num; }; Recreating that struck like this works just fine, sprite show and all!!! Great help!!! |
Quote:
#1) I cannot find the APTR example i was looking for. I had some issue with such type the other day, but in this case you replaced UWORD with the APTR type, so it must have been something different :) |
This is just a gift that keeps giving.
Now everything work in WinUAE, but not on real machine - no sprite is visible... Code:
// add sprite |
hmm, do you run it from shell/cli? maybe add some printf's in those conditions like:
Code:
if (spritedata > 0) { |
Did bunch of printf debuging this morning.
All is in order! Memory, pointers, sprite num etc. but no sprite on screen :) |
All times are GMT +2. The time now is 13:01. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.