gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > Problem when plotting a pixel

#15010 - dist0rted - Fri Jan 16, 2004 2:25 am

I've done a lot of programming for the GBA with Visual HAM, but now I'm trying out DevKitAdvance and I'm always getting a "parse error before ; token" message and it won't compile.

Here's my code:

Code:

#include "gba.h"
#include "screenmodes.h"
#include "keys.h"

#define RGB(r, g, b) (r + (g << 5) + (b << 10))

u16* thePrimaryBuffer = (u16*)VideoBuffer;

int main(void)
{

     SetMode(MODE_3 | BG2_ENABLE);

     int x = 10;
     int y = 10;

     thePrimaryBuffer[x + y * 240] = RGB(31, 0, 0); // This is the line with the error message

}


What am I doing wrong?
_________________
All knowledge is good; only the way it is put to use is good or evil.

#15012 - Miked0801 - Fri Jan 16, 2004 2:34 am

Vars must me defined before code can occur. Move your setmode below the creation of the x and y ints.

#15014 - dist0rted - Fri Jan 16, 2004 2:49 am

Thanks
_________________
All knowledge is good; only the way it is put to use is good or evil.

#15016 - dist0rted - Fri Jan 16, 2004 2:58 am

Darn! It still does the error!

I've replace the line with:

thePrimaryBuffer[10 + 10 * 240] = RGB(31, 0, 0);

and I've put the variables before SetMode(MODE_3 | BG2_ENABLE); and it still does it!
_________________
All knowledge is good; only the way it is put to use is good or evil.

#15021 - dist0rted - Fri Jan 16, 2004 4:48 am

Never mind, it's fixed (forgot how i fixed it...)
_________________
All knowledge is good; only the way it is put to use is good or evil.