new mods upon mods by devhammer: - Added paddle control using tilting of the console - Finished mute function - Reduced flickering See game.cpp for full info.

Dependencies:   mbed

Fork of RETRO_Pong_Mod by G. Andrew Duthie

This is a mod of the official Pong game released with the RETRO game console.

Committer:
maxint
Date:
Thu Jan 15 14:34:59 2015 +0000
Revision:
4:9ad3bc45b6ce
Parent:
1:cd8a3926f263
mod150115; - Added paddle control using tilting of the console; - Reduced flickering; - Finished mute function

Who changed what in which revision?

UserRevisionLine numberNew contents of line
john_ghielec 0:21669ea33448 1 #include "mbed.h"
john_ghielec 0:21669ea33448 2
john_ghielec 0:21669ea33448 3 #pragma once
john_ghielec 0:21669ea33448 4
john_ghielec 1:cd8a3926f263 5 class DisplayN18 {
john_ghielec 0:21669ea33448 6 static const unsigned char STEP = 4;
john_ghielec 0:21669ea33448 7
john_ghielec 0:21669ea33448 8 DigitalOut resetPin;
john_ghielec 0:21669ea33448 9 DigitalOut backlightPin;
john_ghielec 0:21669ea33448 10 DigitalOut rsPin;
john_ghielec 0:21669ea33448 11 DigitalOut csPin;
john_ghielec 0:21669ea33448 12 SPI spi;
john_ghielec 0:21669ea33448 13
john_ghielec 0:21669ea33448 14 void writeCommand(unsigned char command);
john_ghielec 0:21669ea33448 15 void writeData(unsigned char data);
john_ghielec 0:21669ea33448 16 void writeData(const unsigned char* data, unsigned int length);
john_ghielec 0:21669ea33448 17
john_ghielec 0:21669ea33448 18 void reset();
john_ghielec 0:21669ea33448 19 void initialize();
john_ghielec 0:21669ea33448 20 void setClippingArea(unsigned char x, unsigned char y, unsigned char width, unsigned char height);
john_ghielec 0:21669ea33448 21
john_ghielec 0:21669ea33448 22 public:
john_ghielec 0:21669ea33448 23 DisplayN18();
john_ghielec 0:21669ea33448 24
john_ghielec 0:21669ea33448 25 static const unsigned short BLUE = 0x00F8;
john_ghielec 0:21669ea33448 26 static const unsigned short GREEN = 0xE007;
john_ghielec 0:21669ea33448 27 static const unsigned short RED = 0x1F00;
john_ghielec 0:21669ea33448 28 static const unsigned short WHITE = 0xFFFF;
john_ghielec 0:21669ea33448 29 static const unsigned short BLACK = 0x0000;
john_ghielec 0:21669ea33448 30
john_ghielec 0:21669ea33448 31 static const unsigned int WIDTH = 160;
john_ghielec 0:21669ea33448 32 static const unsigned int HEIGHT = 128;
john_ghielec 0:21669ea33448 33 static const unsigned char CHAR_WIDTH = 5;
john_ghielec 0:21669ea33448 34 static const unsigned char CHAR_HEIGHT = 8;
john_ghielec 0:21669ea33448 35 static const unsigned char CHAR_SPACING = 1;
john_ghielec 0:21669ea33448 36
john_ghielec 0:21669ea33448 37 static unsigned short rgbToShort(unsigned char r, unsigned char g, unsigned char b);
john_ghielec 0:21669ea33448 38
john_ghielec 0:21669ea33448 39 void clear(unsigned short backColor = 0x0000);
john_ghielec 0:21669ea33448 40 void draw(const unsigned short* data, int x, int y, int width, int height);
john_ghielec 0:21669ea33448 41 void setPixel(int x, int y, unsigned short foreColor);
john_ghielec 0:21669ea33448 42
john_ghielec 0:21669ea33448 43 void fillRect(int x, int y, int width, int height, unsigned short foreColor);
john_ghielec 0:21669ea33448 44 void drawRect(int x, int y, int width, int height, unsigned short foreColor);
john_ghielec 0:21669ea33448 45
john_ghielec 0:21669ea33448 46 void fillCircle(int x, int y, int radius, unsigned short foreColor);
john_ghielec 0:21669ea33448 47 void drawCircle(int x, int y, int radius, unsigned short foreColor);
john_ghielec 0:21669ea33448 48
john_ghielec 0:21669ea33448 49 void drawLine(int x0, int y0, int x1, int y1, unsigned short foreColor);
john_ghielec 0:21669ea33448 50
john_ghielec 0:21669ea33448 51 void drawCharacter(int x, int y, const char character, unsigned short foreColor, unsigned short backColor, unsigned char fontSize = 1);
john_ghielec 0:21669ea33448 52 void drawString(int x, int y, const char* str, unsigned short foreColor, unsigned short backColor, unsigned char fontSize = 1);
john_ghielec 0:21669ea33448 53 };