[RESOLVED] Wii C language Noob. November 07, 2009 06:22AM | Registered: 14 years ago Posts: 2 |
/home/tommy/Projects/examples/wii/NavMenu/source/template.c: In function 'draw_text': /home/tommy/Projects/examples/wii/NavMenu/source/template.c:81: warning: passing argument 1 of 'printf' makes pointer from integer without a cast /home/tommy/Projects/examples/wii/NavMenu/source/template.c: In function 'Process_A_button': /home/tommy/Projects/examples/wii/NavMenu/source/template.c:86: error: incompatible types in assignment /home/tommy/Projects/examples/wii/NavMenu/source/template.c:89: error: incompatible types in assignment /home/tommy/Projects/examples/wii/NavMenu/source/template.c:92: error: incompatible types in assignment /home/tommy/Projects/examples/wii/NavMenu/source/template.c:95: error: incompatible types in assignment /home/tommy/Projects/examples/wii/NavMenu/source/template.c:99: warning: passing argument 1 of 'draw_text' makes integer from pointer without a cast /home/tommy/Projects/examples/wii/NavMenu/source/template.c: In function 'Process_updown': /home/tommy/Projects/examples/wii/NavMenu/source/template.c:103: warning: comparison between pointer and integer /home/tommy/Projects/examples/wii/NavMenu/source/template.c:103: warning: comparison with string literal results in unspecified behaviour /home/tommy/Projects/examples/wii/NavMenu/source/template.c:113: warning: comparison between pointer and integer /home/tommy/Projects/examples/wii/NavMenu/source/template.c:113: warning: comparison with string literal results in unspecified behaviour /home/tommy/Projects/examples/wii/NavMenu/source/template.c:124: warning: passing argument 1 of 'draw_text' makes integer from pointer without a cast /home/tommy/Projects/examples/wii/NavMenu/source/template.c: In function 'main': /home/tommy/Projects/examples/wii/NavMenu/source/template.c:140: warning: passing argument 1 of 'Process_updown' makes integer from pointer without a cast /home/tommy/Projects/examples/wii/NavMenu/source/template.c:143: warning: passing argument 1 of 'Process_updown' makes integer from pointer without a cast /home/tommy/Projects/examples/wii/NavMenu/source/template.c:146: error: incompatible types in assignment /home/tommy/Projects/examples/wii/NavMenu/source/template.c:149: warning: passing argument 1 of 'draw_text' makes integer from pointer without a cast make[1]: *** [template.o] Error 1 make: *** [build] Error 2
#include#include #include #include static void *xfb = NULL; static GXRModeObj *rmode = NULL; int selected=1; char current[30]; //--------------------------------------------------------------------------------- int main(int argc, char **argv) { //--------------------------------------------------------------------------------- // Initialise the video system VIDEO_Init(); // This function initialises the attached controllers WPAD_Init(); // Obtain the preferred video mode from the system // This will correspond to the settings in the Wii menu rmode = VIDEO_GetPreferredMode(NULL); // Allocate memory for the display in the uncached region xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); // Initialise the console, required for printf console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ); // Set up the video registers with the chosen mode VIDEO_Configure(rmode); // Tell the video hardware where our display memory is VIDEO_SetNextFramebuffer(xfb); // Make the display visible VIDEO_SetBlack(FALSE); // Flush the video register changes to the hardware VIDEO_Flush(); // Wait for Video setup to complete VIDEO_WaitVSync(); if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); // The console understands VT terminal escape codes // This positions the cursor on row 2, column 0 // we can use variables for this with format codes too // e.g. printf ("\x1b[%d;%dH", row, column ); printf("\x1b[2;0H"); void Drawmenu () { if (selected == 1 ) { printf(">> Say Hello to Dad\n"); printf("Say hello to mom\n"); printf("Say hello to dill\n"); printf("Say hello to dog\n"); } if (selected == 2 ) { printf("Say Hello to Dad\n"); printf(">> Say hello to mom\n"); printf("Say hello to dill\n"); printf("Say hello to dog\n"); } if (selected == 3 ) { printf("Say Hello to Dad\n"); printf("Say hello to mom\n"); printf(">> Say hello to dill\n"); printf("Say hello to dog\n"); } if (selected == 4 ) { printf("Say Hello to Dad\n"); printf("Say hello to mom\n"); printf("Say hello to dill\n"); printf(">> Say hello to dog\n"); } } void draw_text (char message) { printf(message); } void Process_A_button () { if (selected == 1) { current="Hello Dad!"; } if (selected == 2) { current="Hello Mom!"; } if (selected == 3) { current="Hello Dill!"; } if (selected == 4) { current="Hello Angel!"; } VIDEO_ClearFrameBuffer (rmode, xfb, COLOR_BLACK); Drawmenu(); draw_text(current); } void Process_updown (char upydown) { if (upydown=="up") { if (selected == 1) { selected=4; } else { selected--; } } if (upydown=="down") { if (selected == 4) { selected=1; } else { selected++; } } VIDEO_ClearFrameBuffer (rmode, xfb, COLOR_BLACK); Drawmenu(); draw_text(current); } Drawmenu(); while(1) { // Call WPAD_ScanPads each loop, this reads the latest controller states WPAD_ScanPads(); u16 pressed = WPAD_ButtonsUp(0); if ( pressed & WPAD_BUTTON_A ) { Process_A_button(); } if ( pressed & WPAD_BUTTON_UP ) { Process_updown("up"); } if ( pressed & WPAD_BUTTON_DOWN ) { Process_updown("down"); } if ( pressed & WPAD_BUTTON_HOME ) { current="Exiting"; VIDEO_ClearFrameBuffer (rmode, xfb, COLOR_BLACK); Drawmenu(); draw_text(current); exit(0); } VIDEO_WaitVSync(); } return 0; }
Re: Wii C language Noob. November 07, 2009 06:59AM | Registered: 14 years ago Posts: 98 |
Re: Wii C language Noob. November 07, 2009 03:34PM | Registered: 14 years ago Posts: 2 |
Re: [RESOLVED] Wii C language Noob. November 23, 2009 09:13PM | Registered: 14 years ago Posts: 10 |
Re: [RESOLVED] Wii C language Noob. December 06, 2009 01:21PM | Registered: 15 years ago Posts: 4 |
Re: [RESOLVED] Wii C language Noob. December 06, 2009 01:43PM | Registered: 14 years ago Posts: 55 |
Re: [RESOLVED] Wii C language Noob. February 01, 2010 03:36AM | Registered: 14 years ago Posts: 14 |
Re: [RESOLVED] Wii C language Noob. February 01, 2010 11:33AM | Registered: 14 years ago Posts: 379 |
And just as the Bible it's a bit outdated and has many zealots following it. But it should provide you with a good start. There are also many webtutorials, but I recommend you stay away from those as 80% of them is just bad for you. (Anyone know any good basic C tutorial sites?)Quote
unhuman
Get the Kernighan and Richie "The C Programming Language" book. Commonly referred to as "The Bible." It's awesome and concise.
-H
Re: [RESOLVED] Wii C language Noob. February 01, 2010 05:42PM | Registered: 14 years ago Posts: 118 |
Re: [RESOLVED] Wii C language Noob. February 25, 2010 05:22AM | Registered: 14 years ago Posts: 121 |