Page 1 of 1

Game Error

Posted: Fri Sep 10, 2010 7:28 pm
by Ghost6765
Does anybody know what is wrong with this:

Code: Select all

#include <iostream>
#include <stdlib.h>
#include <gccore.h>
#include <wiiuse/WPAD.h>

using namespace std;

//--------------------------------------------------------//

static void *xfb = NULL;
static GXRModeObj *rmode = NULL;

//--------------------------------------------------------//

bool fcomplete = false; //FOREST COMPLETE
bool crcomplete = false; //CROSSROADS COMPLETE
bool ccomplete = false; //CASTLE COMPLETE

int CrossRoads()
{
    cout <<"\n\nThere are (2) monsters to fight in this Path, There is a Grizzly and a Fox:"<<endl;
	cout <<"\nWHICH ONE DO YOU CHOOSE:"<<endl;
	
	crcomplete = true;
	
	return 0;
}

int Forest()
{
    cout <<"\n\nI haven't made this yet!!"<<endl;
	fcomplete = true;
	
	return 0;
}

//--------------------------------------------------------//
int main(int argc, char **argv){    
//--------------------------------------------------------//
	Video_INIT();
//--------------------------------------------------------//
	WPAD_Init();
//--------------------------------------------------------//
    rmode = VIDEO_GetPreferredMode(NULL);
//--------------------------------------------------------//
    xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
//--------------------------------------------------------//

    console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
//--------------------------------------------------------//	
    VIDEO_Configure(rmode);
//--------------------------------------------------------//
    VIDEO_SetNextFramebuffer(xfb);
//--------------------------------------------------------//	
    VIDEO_SetBlack(FALSE);
//--------------------------------------------------------//
	VIDEO_Flush();
//--------------------------------------------------------//
	VIDEO_WaitVSync();
//--------------------------------------------------------//
	if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
//--------------------------------------------------------//

cout <<"Welcome to ADVENTURE WORDLS"<<endl;
cout <<"\n\nYou are standing in the middle of a marshy land, there are many paths going off in their directions.\nWhich Path Do You Choose"<<endl;
cout <<"HOME. Exit Game."<<endl;
cout <<"1. CrossRoads Path(QUEST)"<<endl;

if (!crcomplete && !fcomplete)
{
    cout <<"\n"<<endl;
}

if (crcomplete && !fcomplete)
{
	cout <<"1. CrossRoads Path(COMPLETED)"<<endl;
	cout <<"2. Forest Path(QUEST)"<<endl;
}

while(1) {

		// Call WPAD_ScanPads each5 loop, this reads the latest controller states
		WPAD_ScanPads();

		// WPAD_ButtonsDown tells us which buttons were pressed in this loop
		// this is a "one shot" state which will not fire again until the button has been released
		u32 pressed = WPAD_ButtonsDown(0);

		// We return to the launcher application via exit
		if ( pressed & WPAD_BUTTON_HOME ) exit(0);
		if ( pressed & WPAD_BUTTON_ONE ) CrossRoads();
		if ( pressed & WPAD_BUTTON_TWO ) Forest();

		// Wait for the next frame
		VIDEO_WaitVSync();
}
return 0;

}
The makefile was copied from the template.

Re: Game Error

Posted: Fri Sep 10, 2010 8:24 pm
by Izhido
Um... YOU tell us what's wrong... it's rather hard to diagnose a program when you don't tell us what is it doing wrong. Care to post more details about it?

Oh, by the way... which makefile are you talking about? Your post doesn't seem to contain one.

Re: Game Error

Posted: Fri Sep 10, 2010 9:06 pm
by zeromus
His code fails to compile because he has mis-capitalized one identifier and transcribed two other identifiers incorrectly. The error says which symbols are wrong, but I guess he hasn't thought to go double-check them. Maybe he should give up.