<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Input Problem</title>
<description> I can&amp;#039;t get the following piece of code to work properly:



int mode = 1;

void Menu(){

// 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-&amp;gt;fbWidth,rmode-&amp;gt;xfbHeight,rmode-&amp;gt;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-&amp;gt;viTVMode&amp;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 (&quot;\x1b[%d;%dH&quot;, row, column );
printf(&quot;\x1b[2;0H&quot;);


printf(&quot;Wii Game&quot;);

while(true){

WPAD_ScanPads();

printf(&quot;\x1b[5;5H&quot;);

switch(mode){

case 1:
printf(&quot;Mode1&quot;);
break;

case 2:
printf(&quot;Mode2&quot;);
break;

case 3:
printf(&quot;Mode3&quot;);
break;

case 4:
printf(&quot;Mode4&quot;);
break;

}

if((WPAD_ButtonsDown(WPAD_CHAN_0)&amp;WPAD_BUTTON_RIGHT)||(WPAD_ButtonsDown(WPAD_CHAN_0)&amp;WPAD_NUNCHUK_BUTTON_Z))
mode++;

if((WPAD_ButtonsDown(WPAD_CHAN_0)&amp;WPAD_BUTTON_RIGHT)||(WPAD_ButtonsDown(WPAD_CHAN_0)&amp;WPAD_NUNCHUK_BUTTON_C))
mode--;

if(mode &amp;lt; 1)
mode = 4;

if(mode &amp;gt; 4)
mode = 1;

if((WPAD_ButtonsDown(WPAD_CHAN_0)&amp;WPAD_BUTTON_B)||(WPAD_ButtonsDown(WPAD_CHAN_0)&amp;WPAD_BUTTON_A))
break;

if(WPAD_ButtonsDown(WPAD_CHAN_0)&amp;WPAD_BUTTON_HOME){
quit = 1;
break;
}

// Wait for the next frame
VIDEO_WaitVSync();

}
}

Code works fine, but the input lines to deincrement and increment mode don&amp;#039;t work. If I ignore the input lines and and have mode increment itself in a loop, that works fine.</description><link>http://forum.wiibrew.org/read.php?11,965,965#msg-965</link><lastBuildDate>Thu, 19 Nov 2026 02:10:43 +0000</lastBuildDate>
<generator>Phorum 6.0.6</generator>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,1022#msg-1022</guid>
<title>Re: Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,1022#msg-1022</link><description><![CDATA[ @henke37<br />Well, it works perfectly for me!]]></description>
<dc:creator>Arikado</dc:creator>
<category>Coding</category><pubDate>Fri, 22 Aug 2008 16:21:38 +0000</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,1017#msg-1017</guid>
<title>Re: Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,1017#msg-1017</link><description><![CDATA[ I do not think that the VIDEO API is console aware, the next output on the console should just undo the clearing.]]></description>
<dc:creator>henke37</dc:creator>
<category>Coding</category><pubDate>Fri, 22 Aug 2008 15:29:01 +0000</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,1008#msg-1008</guid>
<title>Re: Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,1008#msg-1008</link><description><![CDATA[ Thanks, it works perfectly now, I&#039;ll have someone lock this topic.<br /><br />I love this forum...]]></description>
<dc:creator>Arikado</dc:creator>
<category>Coding</category><pubDate>Fri, 22 Aug 2008 13:45:44 +0000</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,1004#msg-1004</guid>
<title>Re: Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,1004#msg-1004</link><description><![CDATA[ Yes :)]]></description>
<dc:creator>nIxx</dc:creator>
<category>Coding</category><pubDate>Fri, 22 Aug 2008 13:31:33 +0000</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,1003#msg-1003</guid>
<title>Re: Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,1003#msg-1003</link><description><![CDATA[ @nlxx<br />So it would prolly look like this, correct?<br /><br /><pre class="bbcode">
VIDEO_ClearFrameBuffer (rmode, xfb, COLOR_BLACK)

</pre>]]></description>
<dc:creator>Arikado</dc:creator>
<category>Coding</category><pubDate>Fri, 22 Aug 2008 13:28:28 +0000</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,1001#msg-1001</guid>
<title>Re: Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,1001#msg-1001</link><description><![CDATA[ with<br />VIDEO_ClearFrameBuffer (GXRModeObj *rmode, void *fb, u32 color)<br />you can clear the screen<br />system("cls"); is only for dos applications]]></description>
<dc:creator>nIxx</dc:creator>
<category>Coding</category><pubDate>Fri, 22 Aug 2008 13:23:32 +0000</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,999#msg-999</guid>
<title>Re: Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,999#msg-999</link><description><![CDATA[ Thanks it works now. 99% actually, when it displays a short piece of text after a long pice of text, some of the characters from the long text are left over. Is there a way that I can clear the screen every loop?<br /><br /><pre class="bbcode">
system("cls");
//Will this work?
</pre>]]></description>
<dc:creator>Arikado</dc:creator>
<category>Coding</category><pubDate>Fri, 22 Aug 2008 13:17:46 +0000</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,979#msg-979</guid>
<title>Re: Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,979#msg-979</link><description><![CDATA[ That&#039;s true,if you press right, it does a ++--... that does nothing.<br /><br />Try with Nunchuk.]]></description>
<dc:creator>Dykam</dc:creator>
<category>Coding</category><pubDate>Fri, 22 Aug 2008 06:47:22 +0000</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,971#msg-971</guid>
<title>Re: Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,971#msg-971</link><description><![CDATA[ It looks like you made a typo in the input checking part. You check for WPAD_BUTTON_RIGHT twice.<br /><br />-Santa]]></description>
<dc:creator>SantaCode</dc:creator>
<category>Coding</category><pubDate>Fri, 22 Aug 2008 01:36:19 +0000</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,965,965#msg-965</guid>
<title>Input Problem</title><link>http://forum.wiibrew.org/read.php?11,965,965#msg-965</link><description><![CDATA[ I can&#039;t get the following piece of code to work properly:<br /><br /><pre class="bbcode">

int mode = 1;

void Menu(){
		  
		  // 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-&gt;fbWidth,rmode-&gt;xfbHeight,rmode-&gt;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-&gt;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");
	

	printf("Wii Game");
		  
		    while(true){
			
			WPAD_ScanPads();
			
			printf("\x1b[5;5H");
			
			switch(mode){
			
			  case 1:
			  printf("Mode1");
			  break;
			  
			  case 2:
			  printf("Mode2");
			  break;
			  
			  case 3:
			  printf("Mode3");
			  break;
			  
			  case 4:
			  printf("Mode4");
			  break;
			  
			}
			
 if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_RIGHT)||(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_Z))
			 mode++;
			 
if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_RIGHT)||(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_C))
			 mode--;
			 
			 if(mode &lt; 1)
			 mode = 4;
			 
			 if(mode &gt; 4)
			 mode = 1;
			 
	if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_B)||(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_A))
			 break;
			 
			 if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME){
			 quit = 1;
			 break;
			 }
			 
			 // Wait for the next frame
		     VIDEO_WaitVSync();
			 
		  }
		 }</pre><br />Code works fine, but the input lines to deincrement and increment mode don&#039;t work. If I ignore the input lines and and have mode increment itself in a loop, that works fine.]]></description>
<dc:creator>Arikado</dc:creator>
<category>Coding</category><pubDate>Thu, 21 Aug 2008 23:59:21 +0000</pubDate></item>
</channel>
</rss>