Archive for the ‘Wii Programming Tutorials’ Category

Tutorial 13: Loading and saving simple XML files

Sunday, June 21st, 2009

XML files are used as an easy way to read and store data which is useful for storing configuration settings from applications. It’s always good practice to allow your application to be customised by the user, be it by turning off the Wiimote rumble, enabling background music, disabling prompts, etc. In this tutorial we’ll learn how to load and save simple settings by using XML files. You can grab the PDF of this tutorial here: codemii-tutorial-13
(more…)

Tutorial 12: Using Mod music / sound

Tuesday, April 21st, 2009

In this tutorial you’ll learn about adding music/sounds to the Wii. It’s a fairly simple thing to do and we’ll use Mod files. I assume everyone knows MP3s but you might not know about Mod files which are a little bit like midi files. Mod files in a sense have “samples” which can be used in different ways to produce sounds. You can grab the PDF of this tutorial here: codemii-tutorial-12

There are two ways which you can load music, either from the SD card or from your source. If you aren’t going to allow users to change your music or sounds, I’d recommend loading from your source, it just saves time and it’s nicer not have lots of files on the SD card.

(more…)

Tutorial 11: Structures

Sunday, March 15th, 2009

So you’re starting to learn more and more about coding for the Wii and you’ve come to the point where you your variables to be more organised. This may be the cause if you have multiple objects on the screen that need to move around, etc. You can grab the PDF of this tutorial here: codemii-tutorial-11

You are actually able to put variables in structures, which mean you can have multiple variables in the one element of the structure.
(more…)

Tutorial 10: Using the filesystem

Monday, March 2nd, 2009

It’s been a while since I put up a tutorial and I hope that by now you have a basic understanding of programming for the Wii. So that I’m able to keep producing these tutorials I’ll try to focus on small pieces of code instead of the whole application and how the code can be applied. The explanation of Simon was a bit too long ;). This tutorial is also a bit longer than I expected. You can grab the PDF of this tutorial here: codemii-tutorial-10

In this tutorial we’ll cover initialising the filesystem, creating/deleting directories/files and reading/writing files. Thanks to joedj for his FAT init code from FTPii v0.0.5.
(more…)

Tutorial 9: Simon explained

Tuesday, December 30th, 2008

By now you should have the skills needed to start coding or modifying small games and utilities. In this Wii programming tutorial we will go through the Simon game and give a brief explanation of what things do. In this tutorial we focus on how to use the code we know to achieve certain the things that we are after. You can grab the PDF of this tutorial here: codemii-tutorial-9

Lets begin by firstly downloading the simon source code and opening up main.c. This version of Simon is intended to run on gcube. You can load the dol file with gcube and have a little play around.

Simon is a basic game; you have 4 colours and the computer generates a sequence of colours which you need to press correctly to win. The computer shows you one colour and when you press the correct colour the computer then shows you the next colour and so on.
(more…)

Tutorial 8: Image changes

Sunday, November 9th, 2008

In this Wii programming tutorial we will modify the button detection tutorial and as requested show you how you can easily change a button from yes to no based on the user’s input. You can grab the PDF of this tutorial here: codemii-tutorial-8

Firstly download this tutorial8-blank which will contain the required files to get us started. Include in the zip are two images and they have been given added to the main.c file. Shown below are the important parts of the source code. I assume you know the rest from our other tutorials.
(more…)

Tutorial 7: Using arrays

Sunday, September 28th, 2008

In this Wii programming tutorial we will quickly cover how we can utilise arrays for holding information about games like in card games or other games were the positions of objects remains static. You can grab the PDF of this tutorial here: codemii-tutorial-7

An array as you should know can hold multiple elements. By utilising these elements we can arrange them however we like. For example, if we were to do a tic tac toe game, we know there are 9 cells in 3 x 3. We can declare an array with 8 elements and set all those elements to 0 as shown below.
(more…)

Tutorial 6: Button detection

Sunday, September 14th, 2008

In this Wii programming tutorial we will cover displaying an image as the mouse cursor and how to detect button clicking. You can grab the PDF of this tutorial here: codemii-tutorial-6.

Firstly download this tutorial6-image which will contain the required files to get us started. This zip file also contains the JPEG code required to display images which you should have learnt about in the last tutorial. Extract this zip file in C:\devkitPro\examples\gamecube and open up tutorial6.pnproj.

As you should recall, we displayed a cursor which we could control on the gamecube by using the following code:
(more…)

Tutorial 5: JPEG images

Sunday, September 7th, 2008

This fifth Wii programming tutorial will cover how to display JPEG images. As usual, I’m assuming you’ve read all the other tutorials. You can grab the PDF of this tutorial here: codemii-tutorial-5

Firstly download this tutorial5-blank which will contain the required files to get us started. Extract this zip file in C:\devkitPro\examples\gamecube. Open up tutorial5.pnproj and then click on main.c to show the source code.

Included in the download are two files, one called picture.s and a JPEG picture. The picture.s file defines all our variables for the picture and the link to the picture itself. If you open the image file “about.jpg” you’ll see the image with a black background. It’s important to remember that JPEGs aren’t transparent like PNGs are.
(more…)

Tutorial 4: Cursors

Sunday, August 31st, 2008

In this fourth Wii programming tutorial, I will cover displaying a cursor by drawing a small square, movement of the cursor and then using the Wii IR to move the cursor. Before reading this tutorial I’m assuming you have picked up a few things and therefore I won’t be re-explaining the common code in the zip file or initial steps in detail. You can grab the PDF of this tutorial here: codemii-tutorial-4

Firstly download this tutorial4-blank which will contain the required files to get us started. Extract this zip file in C:\devkitPro\examples\gamecube. Open up tutorial4.pnproj and then click on main.c to show the source code.

From tutorial 3, we know how to incorporate the controller in our source code, so now all we need to use a cursor in our application, is to draw one. The source code below is our drawing functions. I’m not sure whose code it but thanks to the person whom made it.
(more…)