• Status Unconfirmed
  • Percent Complete
  • Task Type Patches
  • Category Plugins
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Soul-Slayer - 2007-08-06

FS#7544 - Tic Tac Toe Plugin

This is the first plugin I’ve ever written from scratch, and well, it was fun. I haven’t worked out how to use bitmaps yet, bear with me, for now it uses coloured rectangles. Still learning :p.

If this were to get committed, please wait until I’ve added better support for more targets, commented as many lines as are possible to help other people new to making plugins, potentially add AI (Although that would kinda ruin it as it would probably force a draw every time), and figured out how to use bitmaps properly.

If people are willing to test this out for me and tell me any bugs, please do so. I have tested this on the H10, the Gigabeat, and, using the simulator, the iPod mini G2 (Which displays it but out of alignment, will work on that soon.

I realize it’s not too exciting, but for my first real bit of work in C I’m happy :p.

TiMiD commented on 2007-08-06 08:41


I took the time to read your code and I have a few comments :
- Use the action API to handle button mappings, it will reduce your code by a few lines as well as adding mappings for all the targets as no pain (see how buttons are handled in the jackpot plugin for example)
- Use the screen API to make your draws, this will allow your plugin to work on 2 screens for devices that have a LCD remote controller (see for example the drawing functions of the metronome or demistify plugin, they are quite simple)
- Avoid global variables when possible (your start and board variables could simply be passed to the functions that use them)
- Code design : I would split the init_board function into 2 separate functions (init_board and init_draw ?), It's always better not to mix displaying code with functional code

After that it should work without problem on all targets, and we will have a tic tac toe game in rockbox.


Fixed a bug where selecting the same square would switch to another persons turn without letting the other person have theirs

Now using the action API (Have yet to learn how to use the screen API, any help would be appreciated)

The 'start' global variable is now removed and passed instead, the board ones I'm not sure I could as there are a couple of large arrays. I wasn't aware it was bad to use global variables though, if anyone could justify whats wrong with them I shall work on an alternative. Same for the init function, I can't see what I can do to break that down any further, the only 'functional' part of it is the loop that clears out the array, and I'm not sure that's worth its own function.

Support for all non-monochrome players

Commented to help people learning how to make plugins, which I could probably have done in more detail, but it's still more helpful for people new to making plugins than no comments at all.


Available keyboard shortcuts


Task Details

Task Editing