Talk:How to use the Wiimote

From WiiBrew
Jump to navigation Jump to search

Some comments

Hi, I don't want to change the code, but this line is useless because it's going out the line after:

if(doreload) return 0;

If you are doing a switch, you shouldn't use a if just after evaluating the same condition.

if(res == WPAD_ERR_NONE) {

You are checking two times the same button

if(wd->btns_h & WPAD_BUTTON_1)

I don't know how fast the Wii process data, but I think it's always best to call less operation like cmp, mostly in a loop.
Thanks, for this great example, it's going to help me develop my application quickly. ­Crayon

Re: Changes

To the author of the page(Seeing as how I would like to update his code as well):

Do we have your permission to update this code? I ask because you may still use this, and I do not want to mess up your "original document". Also, I noticed it put this on the bottom, but does the GNU license apply to all pages on this Wiki? Meaning that should we still put the:

"Copyright (c)  YEAR  YOUR NAME.
   Permission is granted to copy, distribute and/or modify this document
   under the terms of the GNU Free Documentation License, Version 1.2
   or any later version published by the Free Software Foundation;
   with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
   A copy of the license is included in the section entitled "GNU
   Free Documentation License"."

In our code, or are we good?

P.S. If the author do not respond in quite some time, I believe it would be fair to assume we could change it seeing as he may not return.

Also not (To the guy above me) I belive that code should kinda stay like that (even though it is redundant) because this is an "example" code. It shows that the no error thing is able to be applied to a switch statement. However, maybe add a comment like "//Please not, including an if after a switch that both make the same check is bad practice, it only does this as an example."

The code i would like to add is an "else" after he does the "res==no_errors" (please note I am explaining this in shorthand, I just hope you get the just of my programming changes). In the "else" it would stop the check for the accelerometers(As doing the check uses up batery power, so I have read). Then in the normal if, put a like "if (the_battery(for_wiimote_1)==turned_off) set_the_battery(for_wiimote_1,turned_on);" (Don't you just love shorthand code? I write it since I am uncertain for the exact functions to use, which supports why I believe it should be in the example code)

If anyone "seconds" my code changes and knows how to do it, please do. Same with the guy above, I do agree there should be a note there, but no change (for the sake of it being an example). If we get one more person to agree with me, add my proposed change, if someone else agrees with him, I ask you just COMMENT OUT the bit from the select statement and then copy it over to the if (so that newbies can still see that it is allowed to be used, but just that we choose not to).

--CloneDeath 14:28, 2 July 2008 (CEST)