Issue when declaring functionpointer


I have two functions:
void emptyFunction(int functionChoice)

void randomizeButtons(Button* array[], u8 items)
int counter;
for(counter=0; counter<items; counter++)
array[counter]->posX = 220*rand();
array[counter]->posY = 220*rand();


And two pointers to these functions:
void (*foo)(int);
foo = &emptyFunction;

void (*foo2)(Button*, u8);
foo2 = &randomizeButtons;

The second pointer though, gives a warning:
warning: assignment from incompatible pointer type

To solve this, for the second pointer only, I have to change the function declaration OR typecast to (void*).
So solution 1:
void (*foo2);

And solution 2:
foo2 = (void*) &randomizeButtons;

Very strange, because this isn’t needed for the first functionpointer, foo.


Weird compiler problem


In my game the player can move blocks in four directions. While developing I used a printf() above the code that is causing problems. When I remove this printf I can no longer move boxes up, but I can move them in other directions.

I’ve also removed the printf() and called a different function. Same result, even if the function does nothing.

On the NDS it worked the same as in de emulator.

I compiled it using Eclipse and it turned out it does work when compiled in Programmers Notepad. So it’s appears to be a compile problem from Eclipse.

See images below:

Game reaches gold-status


A few weeks ago I had no knowledge of C or NDS programming and now I’ve finished my first game.

Game concept
The idea for this game comes from an old game of which I can’t remember the name. I played this game a lot when I was about 8 years old. And now I had to make a game my self. So I took the main concept from this old game and changed it a bit.

The idea is you have to collect points, and make your way through rooms by moving boxes.

Room number oneRoom six

I had no experience with C or programming without OO, so it took some time getting used to C.

I started building a lot of things I’m used from Java, like the panels, the draw functions and the actionlisteners, but after some time it got either to big to understand or the NDS emulator couldn’t handle it. But most of it did work and I learned a lot from it.

About two weeks ago I made a clean start and only made the things needed for my game. I made the map I was going to use in Numbers, made the images and made sure I could draw them on the screen, I made the structure for the data, and made the functions to listen to the buttons.

After this it took a few hours of programming and debugging, and after that I only needed to add some extra’s like the game-over screen and the sounds, but the main concept was working.

The game is now complete. Most of my ideas are in it and I can’t find anymore bugs. Comments are welcome, and here’s the game with source files: download

I had no experience with C, so I had some problems getting used to this way of programming. Especially in the beginning when I made it to complicated.

I had some problems with pointers to typedef structs, but in the final game I haven’t used pointers or typedef structs. I also had problems with the sounds but this was because I used the wrong makefile.

Overall I’ve learned a lot, but for my next game I’d prefer a OO-language and I’d propably choose a different platform.

First post, findings, end result!


Hello, my name is Herman van der Meulen.

Started with no C and NDS knowledge a few weeks ago, I have now built a simple game!

I will try to write the events in this one post in chronological order:

Learning C

Installing (on Mac OS X)

Game concept



Read the rest of this entry »

Logitech webcam


A strange thing I noticed:

working in Programmers NotePad:

the process of making was slow or even aborted.

Finally looking around on the internet I found out that my Logitech webcam was causing this!

Uninstalling the webcam software made my compiling fast again (reletively speaking) and without problems….