#149932 - Cave Johnson - Sun Jan 27, 2008 4:38 pm
I've been working on this same simple code of a background and a fish sprite that i could control, for a week or two now, and im in the compiling stage. I have narrowed it down to 3 errors in the main.cpp, but i cannot figure out for the life of me how to fix it. Could anyone help me? The errors i get are:
c:/Taylor/dsprojects/source/main.cpp: In function 'int main()':
c:/Taylor/dsprojects/source/main.cpp:187: error: expected type-specifier before 'fish'
c:/Taylor/dsprojects/source/main.cpp:187: error: cannot convert 'int*' to 'fish*' in initialization
c:/Taylor/dsprojects/source/main.cpp:187: error: expected ',' or ';' before 'fish'
Here is the int main() and highlighted the problem area:
int main() {
powerON(POWER_ALL_2D);
irqInit();
irqSet (IRQ_VBLANK, 0);
lcdMainOnBottom();
initVideo();
initBackgrounds();
dopefishInfo spriteInfo[SPRITE_COUNT];
tOAM *oam = new tOAM();
initOAM(oam);
initSprites(oam, spriteInfo);
//colors_slot1 is the background picture
displaycolors_slot1();
//dopefish is the fish sprite im using
static const int DOPEFISH_OAM_ID = 0;
//fish is the class
SpriteEntry * fishEntry = &oam->spriteBuffer[DOPEFISH_OAM_ID];
SpriteRotation * fishRotation = &oam->matrixBuffer[DOPEFISH_OAM_ID];
fish * fish = new fish(&spriteInfo[DOPEFISH_OAM_ID]); //<-Heres the error line!!!!!!!!!!!!!!!!
for (int i = 0; i < 10; i++) {
fish->accelerate();
}
for (;;) {
handleInput(fish);
fish->movefish();
MathVector2D<float> position = fish->getPosition();
fishEntry->posX = (int)position.x;
fishEntry->posY = (int)position.y;
rotateSprite(fishRotation, fish->getAngleDeg512());
swiWaitForVBlank();
updateOAM(oam);
}
return 0;
}
If you need to see any more of my files (sprite.cpp, fish.cpp, fish.h, sprite.h, or more of main.cpp) id be glad to post them, because like i said, i dont know what you need to see so that you can help me. Thanks for the help.
c:/Taylor/dsprojects/source/main.cpp: In function 'int main()':
c:/Taylor/dsprojects/source/main.cpp:187: error: expected type-specifier before 'fish'
c:/Taylor/dsprojects/source/main.cpp:187: error: cannot convert 'int*' to 'fish*' in initialization
c:/Taylor/dsprojects/source/main.cpp:187: error: expected ',' or ';' before 'fish'
Here is the int main() and highlighted the problem area:
int main() {
powerON(POWER_ALL_2D);
irqInit();
irqSet (IRQ_VBLANK, 0);
lcdMainOnBottom();
initVideo();
initBackgrounds();
dopefishInfo spriteInfo[SPRITE_COUNT];
tOAM *oam = new tOAM();
initOAM(oam);
initSprites(oam, spriteInfo);
//colors_slot1 is the background picture
displaycolors_slot1();
//dopefish is the fish sprite im using
static const int DOPEFISH_OAM_ID = 0;
//fish is the class
SpriteEntry * fishEntry = &oam->spriteBuffer[DOPEFISH_OAM_ID];
SpriteRotation * fishRotation = &oam->matrixBuffer[DOPEFISH_OAM_ID];
fish * fish = new fish(&spriteInfo[DOPEFISH_OAM_ID]); //<-Heres the error line!!!!!!!!!!!!!!!!
for (int i = 0; i < 10; i++) {
fish->accelerate();
}
for (;;) {
handleInput(fish);
fish->movefish();
MathVector2D<float> position = fish->getPosition();
fishEntry->posX = (int)position.x;
fishEntry->posY = (int)position.y;
rotateSprite(fishRotation, fish->getAngleDeg512());
swiWaitForVBlank();
updateOAM(oam);
}
return 0;
}
If you need to see any more of my files (sprite.cpp, fish.cpp, fish.h, sprite.h, or more of main.cpp) id be glad to post them, because like i said, i dont know what you need to see so that you can help me. Thanks for the help.