#163917 - Bong - Wed Oct 15, 2008 2:16 am
I am trying to compile my game with the irq functions and am getting the error undefined reference to irq_init(), irq_add(), and VBlankIntrWait() which is part of the tonc.h header(tonc library). Here is my code:
Just uncomment the irq functions and you'll see what i mean. Any ideas?
Sincerely,
Bong
Code: |
#include <tonc.h> //--------------------------------------------------------------------------------- // Prototypes //--------------------------------------------------------------------------------- void ballMove(); void getInput(); bool hasWon( u8 score ); bool intersectsBottomBoundry( u16 y ); bool intersectsLeftBoundry( u16 x ); bool intersectsRighttBoundry( u16 x ); bool intersectsTopBoundry( u16 y ); void paddleMoveDown( u8 paddleid ); void paddleMoveUP( u8 paddleid ); //--------------------------------------------------------------------------------- // Inlines //--------------------------------------------------------------------------------- //--------------------------------------------------------------------------------- // Structures //--------------------------------------------------------------------------------- // Player Structure struct Player { u16 y; u8 score; }player[2]; // Ball Structure struct Ball { u16 x; u16 y; s8 vx; s8 vy; }ball; //--------------------------------------------------------------------------------- // Enumuationss //--------------------------------------------------------------------------------- enum paddle{ left, right }; //--------------------------------------------------------------------------------- // Program entry point //--------------------------------------------------------------------------------- int main() { //--------------------------------------------------------------------------------- //set the display mode to Mode 3 and background to 2 REG_DISPCNT = DCNT_MODE3 | DCNT_BG2; // enable isr switchboard and VBlank interrupt //irq_init(NULL); //irq_add(II_VBLANK, NULL); // start of main game loop while(1) { // Wait for VSync //VBlankIntrWait(); } } //--------------------------------------------------------------------------------- // Function: ballMove() // Purpose: Moves the ball based on it velocities //--------------------------------------------------------------------------------- void ballMove() { ball.x += ball.vx; ball.y += ball.vy; } //--------------------------------------------------------------------------------- // Function: getInput() // Purpose: performs actions based on the users input //--------------------------------------------------------------------------------- void getInput() { if(key_is_down(KEY_UP)) { } else if(key_is_down(KEY_DOWN)) { } } //--------------------------------------------------------------------------------- // Function: hasWon() // Purpose: Returns if a player has won //--------------------------------------------------------------------------------- bool hasWon( u8 score ) { if( score > 11) { return true; } else { return false; } } //--------------------------------------------------------------------------------- // Function: intersectsBottomBoundry() // Purpose: Returns if an object has intersected the bottom boundry //--------------------------------------------------------------------------------- bool intersectsBottomBoundry( u16 y ) { if( y > 160) { return true; } else { return false; } } //--------------------------------------------------------------------------------- // Function: intersectsLeftBoundry() // Purpose: Returns if an object has intersected the left boundry //--------------------------------------------------------------------------------- bool intersectsLeftBoundry( u16 x ) { if( x < 0) { return true; } else { return false; } } //--------------------------------------------------------------------------------- // Function: intersectsRightBoundry() // Purpose: Returns if an object has intersected the right boundry //--------------------------------------------------------------------------------- bool intersectsRightBoundry( u16 x ) { if( x > 240) { return true; } else { return false; } } //--------------------------------------------------------------------------------- // Function: intersectsTopBoundry() // Purpose: Returns if an object has intersected the top boundry //--------------------------------------------------------------------------------- bool intersectsTopBoundry( u16 y ) { if( y > 0) { return true; } else { return false; } } //--------------------------------------------------------------------------------- // Function: paddleMoveDown() // Purpose: Move the paddle down the screen on its y position //--------------------------------------------------------------------------------- void paddleMoveDown( u8 paddleid ) { player[paddleid].y++; } //--------------------------------------------------------------------------------- // Function: paddleMoveUp() // Purpose: Move the paddle up the screen on its y position //--------------------------------------------------------------------------------- void paddleMoveUp( u8 paddleid ) { player[paddleid].y--; } |
Just uncomment the irq functions and you'll see what i mean. Any ideas?
Sincerely,
Bong