Shell code for the Tanks game
Dependencies: 4DGL-uLCD-SE EthernetInterface Game_Synchronizer MMA8452 SDFileSystem mbed-rtos mbed wave_player
misc/misc.cpp@20:6a58052b0140, 2015-10-29 (annotated)
- Committer:
- jford38
- Date:
- Thu Oct 29 02:21:11 2015 +0000
- Revision:
- 20:6a58052b0140
- Parent:
- globals/globals.cpp@14:36c306e26317
- Child:
- 22:3c68eea5a609
Updated to use separate functions to get button data and accelerometer data separately.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jford38 | 20:6a58052b0140 | 1 | #include "misc.h" |
jford38 | 14:36c306e26317 | 2 | |
jford38 | 14:36c306e26317 | 3 | int CONVERT_24_TO_16_BPP(int col_24) { |
jford38 | 14:36c306e26317 | 4 | int b = col_24 & 0xFF; |
jford38 | 14:36c306e26317 | 5 | int g = (col_24 >> 8) & 0xFF; |
jford38 | 14:36c306e26317 | 6 | int r = (col_24 >> 16)& 0xFF; |
jford38 | 14:36c306e26317 | 7 | |
jford38 | 14:36c306e26317 | 8 | r >>= 3; |
jford38 | 14:36c306e26317 | 9 | g >>= 2; |
jford38 | 14:36c306e26317 | 10 | b >>= 3; |
jford38 | 14:36c306e26317 | 11 | |
jford38 | 14:36c306e26317 | 12 | return r<<11 | g<<5 | b; |
jford38 | 14:36c306e26317 | 13 | } |