Version of Robotron arcade game using LPC1768, a Gameduino shield, a serial EEPROM (for high scores), two microswitch joysticks and two buttons plus a box to put it in. 20 levels of mayhem.

Dependencies:   25LCxxx_SPI CommonTypes Gameduino mbed

Committer:
RichardE
Date:
Mon Jun 17 15:10:43 2013 +0000
Revision:
18:70190f956a24
Parent:
8:82d88f9381f3
Improved response to button 1 when entering high scores (HighScoreEntry.cpp).

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RichardE 8:82d88f9381f3 1 /*
RichardE 8:82d88f9381f3 2 * SOURCE FILE : MathFuncs.h
RichardE 8:82d88f9381f3 3 *
RichardE 8:82d88f9381f3 4 * Definition of class MathFuncs.
RichardE 8:82d88f9381f3 5 *
RichardE 8:82d88f9381f3 6 */
RichardE 8:82d88f9381f3 7
RichardE 8:82d88f9381f3 8 #ifndef MathFuncsDefined
RichardE 8:82d88f9381f3 9
RichardE 8:82d88f9381f3 10 #define MathFuncsDefined
RichardE 8:82d88f9381f3 11
RichardE 8:82d88f9381f3 12 #include "Types.h"
RichardE 8:82d88f9381f3 13
RichardE 8:82d88f9381f3 14 /** Various useful maths related functions. */
RichardE 8:82d88f9381f3 15 class MathFuncs {
RichardE 8:82d88f9381f3 16
RichardE 8:82d88f9381f3 17 public :
RichardE 8:82d88f9381f3 18
RichardE 8:82d88f9381f3 19 /** Constrain a number to be between 2 values.
RichardE 8:82d88f9381f3 20 *
RichardE 8:82d88f9381f3 21 * @param x Number to constrain.
RichardE 8:82d88f9381f3 22 * @param min Minimum value.
RichardE 8:82d88f9381f3 23 * @param max Maximum value.
RichardE 8:82d88f9381f3 24 * @returns A number between min and max.
RichardE 8:82d88f9381f3 25 */
RichardE 8:82d88f9381f3 26 static Int16 Constrain( Int16 x, Int16 min, Int16 max ) {
RichardE 8:82d88f9381f3 27 if( x < min ) {
RichardE 8:82d88f9381f3 28 return min;
RichardE 8:82d88f9381f3 29 }
RichardE 8:82d88f9381f3 30 else if( x > max ) {
RichardE 8:82d88f9381f3 31 return max;
RichardE 8:82d88f9381f3 32 }
RichardE 8:82d88f9381f3 33 else {
RichardE 8:82d88f9381f3 34 return x;
RichardE 8:82d88f9381f3 35 }
RichardE 8:82d88f9381f3 36 }
RichardE 8:82d88f9381f3 37
RichardE 8:82d88f9381f3 38 };
RichardE 8:82d88f9381f3 39
RichardE 8:82d88f9381f3 40 #endif
RichardE 8:82d88f9381f3 41
RichardE 8:82d88f9381f3 42 /* END of MathFuncs.h */
RichardE 8:82d88f9381f3 43