LibWiiSprite Help!
May 08, 2009 05:30AM
Ok i'm trying to get Libwiisprite to work, and I know i have all of the neccacary libs, and i'm getting an error that shouldn't be there

The Code:
#include stdio.h>
#include stdlib.h>
#include gccore.h>
#include wiiuse/wpad.h>
#include fat.h>
#include wiisprite.h>

// libwiisprite uses wsp as it's namespace
using namespace wsp;

void Initialize() {
	GameWindow gwd;
	gwd.InitVideo();
	
	gwd.SetBackground((GXColor){ 255, 255, 255, 255 });

	// Initialise Wiimote
	WPAD_Init();
}

int main(int argc, char **argv)
{
	Initialize();

	Quad rectangle1;
	
	rectangle1.SetWidth(20);
	rectangle1.SetHeight(200);
	rectangle1.SetBorder(1);
	rectangle1.SetFillColor((GXColor){0xFF, 0x00, 0x00, 0xFF});
	rectangle1.Draw(0,0);

	for(;;)
	{
		WPAD_ScanPads();
		
		u32 buttondown = WPAD_ButtonsDown(0);
		
		if(buttondown & WPAD_BUTTON_HOME)
			break;
		gwd.Flush();
	}
	return 0;
}

My Error:
d:/Homebrew/mystuff/C++/wiispritetest/source/main.cpp:41: error: 'gwd' was not declared in this scope

I don't think there is anything wrong, all I added was the code to draw a rectangle.
Thanks
Re: LibWiiSprite Help!
May 08, 2009 06:17AM
First up, I haven't even touched libwiisprite before this post.
As far as the error goes... gwd is not declared in main()
Just add "GameWindow gwd;" I'd think?
int main(int argc, char **argv)
{
	Initialize();
	GameWindow gwd;
	...snip...
}

Edit: I need to learn more about makefiles.
And err... with that fixed.. it just black-screens. Going on a hunch here, but the scope mixing looks like an issue?
I can get the background filled white if everything is contained in main(), but no rectangle being drawn.
I hope some help is better than no help =/



Edited 2 time(s). Last edit at 05/08/2009 06:49AM by PhoenixTank.
Re: LibWiiSprite Help!
May 08, 2009 11:04AM
Just define gwd as a global variable.
Re: LibWiiSprite Help!
May 08, 2009 05:54PM
The error means that you can not use gwd in main(). You cant use gwd in main() because it was declared in Initialize(). Declare gwd globally to fix the problem.
Re: LibWiiSprite Help!
May 08, 2009 05:55PM
Quote
PhoenixTank
First up, I haven't even touched libwiisprite before this post.
As far as the error goes... gwd is not declared in main()
Just add "GameWindow gwd;" I'd think?
int main(int argc, char **argv)
{
	Initialize();
	GameWindow gwd;
	...snip...
}

Edit: I need to learn more about makefiles.
And err... with that fixed.. it just black-screens. Going on a hunch here, but the scope mixing looks like an issue?
I can get the background filled white if everything is contained in main(), but no rectangle being drawn.
I hope some help is better than no help =/
That doesnt work because you didnt initialze the video of the new gwd in main().
Re: LibWiiSprite Help!
May 08, 2009 11:29PM
Ah yes, that makes sense, thank you.
I think I better lurk and learn more for now.
Re: LibWiiSprite Help!
May 09, 2009 12:47AM
No need, I'm glad you tried to help. Since you both seem to be relatively new to coding, you can both PM me with any questions you have. It may take me a day or two to respond sometimes, but even if I cant help I can at least point you in the direction of someone who can.
Sorry, only registered users may post in this forum.

Click here to login