Game entry for the Game Programming Contest sponsored by OutrageousCircuits.com (RETRO Game Console)

Dependencies:   mbed

Fork of Official_RETRO by GHI Electronics

Committer:
Rogerup
Date:
Sun Mar 01 09:34:29 2015 +0000
Revision:
4:2d41b942a823
Parent:
1:cd8a3926f263
Game Entry

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();
Rogerup 4:2d41b942a823 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;
Rogerup 4:2d41b942a823 28 static const unsigned short CYAN = 0xE0FF;
Rogerup 4:2d41b942a823 29 static const unsigned short MAGENT = 0x1FF8;
Rogerup 4:2d41b942a823 30 static const unsigned short YELLOW = 0xFF07;
john_ghielec 0:21669ea33448 31 static const unsigned short WHITE = 0xFFFF;
Rogerup 4:2d41b942a823 32 static const unsigned short LGRAY = 0x18C6;
Rogerup 4:2d41b942a823 33 static const unsigned short GRAY = 0x1084;
Rogerup 4:2d41b942a823 34 static const unsigned short DGRAY = 0x0842;
john_ghielec 0:21669ea33448 35 static const unsigned short BLACK = 0x0000;
Rogerup 4:2d41b942a823 36 */
john_ghielec 0:21669ea33448 37 static const unsigned int WIDTH = 160;
john_ghielec 0:21669ea33448 38 static const unsigned int HEIGHT = 128;
john_ghielec 0:21669ea33448 39 static const unsigned char CHAR_WIDTH = 5;
john_ghielec 0:21669ea33448 40 static const unsigned char CHAR_HEIGHT = 8;
john_ghielec 0:21669ea33448 41 static const unsigned char CHAR_SPACING = 1;
john_ghielec 0:21669ea33448 42
john_ghielec 0:21669ea33448 43 static unsigned short rgbToShort(unsigned char r, unsigned char g, unsigned char b);
john_ghielec 0:21669ea33448 44
john_ghielec 0:21669ea33448 45 void clear(unsigned short backColor = 0x0000);
john_ghielec 0:21669ea33448 46 void draw(const unsigned short* data, int x, int y, int width, int height);
john_ghielec 0:21669ea33448 47 void setPixel(int x, int y, unsigned short foreColor);
john_ghielec 0:21669ea33448 48
john_ghielec 0:21669ea33448 49 void fillRect(int x, int y, int width, int height, unsigned short foreColor);
john_ghielec 0:21669ea33448 50 void drawRect(int x, int y, int width, int height, unsigned short foreColor);
john_ghielec 0:21669ea33448 51
john_ghielec 0:21669ea33448 52 void fillCircle(int x, int y, int radius, unsigned short foreColor);
john_ghielec 0:21669ea33448 53 void drawCircle(int x, int y, int radius, unsigned short foreColor);
john_ghielec 0:21669ea33448 54
Rogerup 4:2d41b942a823 55 //void drawLine(int x0, int y0, int x1, int y1, unsigned short foreColor);
john_ghielec 0:21669ea33448 56
Rogerup 4:2d41b942a823 57 void drawNumber(int x, int y, const char character, unsigned short foreColor, unsigned short backColor);
john_ghielec 0:21669ea33448 58 void drawCharacter(int x, int y, const char character, unsigned short foreColor, unsigned short backColor, unsigned char fontSize = 1);
john_ghielec 0:21669ea33448 59 void drawString(int x, int y, const char* str, unsigned short foreColor, unsigned short backColor, unsigned char fontSize = 1);
john_ghielec 0:21669ea33448 60 };