Today, I'll be sharing a fun little game I'd made some time back - Ninja Air Hockey. It's your regular air hockey with a twist - You control your bat not with the mouse or keyboard, but with some colored object! Sounds weird? Check out its video in action:
I've decided to make it open source. Ninja Air Hockey was designed using openFrameworks and OpenCV. openFrameworks is an opensource C++ toolkit for creative coding.
According to its authors, openFrameworks was developed:
(for) folks using computers for creative, artistic expression, and who would like low level access to the data inside of media in order manipulate, analyze or explore. That audience we felt was significantly underserved by the current crop of C++ libraries.
oF is designed to be used on Windows, Mac OS X and Linux and supports XCode, Code::Blocks, Visual Studio and Eclipse. I had used an older version of openFrameworks - v0062 on Visual Studio. This version is archived here. Here's how you can set it up on Visual Studio:
- Download the Visual Studio 2010 FAT(v0062), and unzip it.
- You need to have OpenCV set up as well. For instructions on how to install OpenCV on Windows, check out the earlier post. Make sure you've Quicktime installed too.
- Download the source code from google code here.
- Copy AirHockey folder into apps/addonsExamples.
- Open AirHockey.sln, wait for the project to load. Press F5 to run. When running for the first time, it can take upto 2-3 mins to start since Visual Studio will build the openFrameworks libraries first.
The all important source files are present in the AirHockey/src folder. And data files are present in the AirHockey/bin/data folder. Using them, you can build this project on the platform and IDE of your choice. Please refer to openFrameworks wiki for instructions on how to set it up on your platform and IDE.