GP32 3 hours of coding...


nice, just need mp3 support and joystick interfacing and we have a Jeff Minter style Virtual light machine.

Great !
 
Couldn't you just do:

return GpRand() % 256; ??

Or if you just don't want to do GpRand do something like

return (LastNum + Seed) % 256;
 
I can guarantee he's not using the GP32 SDK, because of that filesize. Therefore, there are no GpRand-like functions.
 
Well then make a function like this:

Code:
int LastNum = 0, Seed;

...CODE...

char Random() {
    int ret;
    ret = (LastNum + Seed) % 256;
    LastNum = ret;
    return ret;
}

//And to init it:
Seed = //some random num goes here
//To use it:
TheChar = Random();
 
when i try to run the FXE on my gp32 all i get is a white screen but if i run it on geepee 32 it runs fine
 
Here's some code swiped from POVRAY 2.2 source ibm.c:

Code:
static unsigned long int next = 1;

int
m_rand(void)
{
   next = next * 1103515245L + 12345L;
   return ((int) (next / 0x10000L) & 0x7FFF);
}

void
m_srand(int seed)
{
   next = (unsigned long int)seed;
}

If you don't have the luxury of GpTickCountGet for seeding, I suggest setting up a simple main loop counter.
 
Back
Top