Johnathan Chin / Mbed 2 deprecated Lab5

Dependencies:   4DGL-uLCD-SE PinDetect mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ScreenObject.h Source File

ScreenObject.h

00001 #ifndef __SCREENOBJECT_H__
00002 #define __SCREENOBJECT_H__
00003 
00004 #include "uLCD_4DGL.h"
00005 
00006 #define ASTEROID_HEIGHT 12
00007 #define ASTEROID_WIDTH 15
00008 #define SPRITE_MAX 15
00009 #define EARTH_WIDTH 10
00010 #define EARTH_HEIGHT 10
00011 #define EXPLOSION1_WIDTH 20
00012 #define SCREEN_MAX 125
00013 #define SCREEN_MIN 1
00014 #define NUM_ASTEROIDS 4
00015 #define Q 0x808000 //OLIVE
00016 #define I 0x008000 //GREEN
00017 #define S 0xC0C0C0 //SILVER
00018 #define C 0x17202A //UFO GLASS
00019 #define D 0x797D7F //DARK GREY
00020 #define L 0x00FF00 //LIME
00021 #define P 0xFF00FF //PINK
00022 #define R 0xF1C40F //YELLOW
00023 #define O 0xF39C12 //ORANGE
00024 #define G 0xAAB7B8 //GREY
00025 #define _ 0x000000 //BLACK
00026 #define X 0xFFFFFF //WHITE
00027 #define B 0x0000FF //BLUE
00028 #define r 0xFF0000 //RED
00029 
00030 static uLCD_4DGL uLCD(p28, p27, p29);
00031 
00032 class ScreenObject {
00033     public:
00034     virtual void draw() = 0;
00035     virtual void update() = 0;
00036     int getX() const;
00037     int getY() const;
00038     int getHeight() const;
00039     int getWidth() const;
00040     int* getSprite() const;
00041     bool getDestroyed() const;
00042     void setX(int);
00043     void setY(int);
00044     void setHeight(int);
00045     void setWidth(int);
00046     void setSprite(int *);
00047     void setDestroyed(bool);
00048     
00049     
00050     private:
00051     int xPos;
00052     int yPos;
00053     int height;
00054     int width;
00055     int* sprite;
00056     bool destroyed;
00057 };
00058 
00059 #endif