Platform game written for the GHI/OutrageousCircuits RETRO game device. Navigate the caves collecting all the pickups and avoiding the creatures and haunted mine carts that patrol the caves. Oh and remember to watch out for the poisonous plants... This game demonstrates the ability to have multiple animated sprites where the sprites can overlap the background environment. See how the player moves past the fence and climbs the wall in the 3rd screen.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Rect.h Source File

Rect.h

00001 #ifndef __RECT_H__
00002 #define __RECT_H__
00003 
00004 #include <algorithm>
00005 
00006 struct Rect
00007 {
00008     uint8_t left;
00009     uint8_t top;
00010     uint8_t right;
00011     uint8_t bottom;
00012     
00013     Rect() :
00014         left(0),
00015         top(0),
00016         right(0),
00017         bottom(0)
00018     {
00019     }
00020     
00021     Rect(uint8_t l, uint8_t t, uint8_t w, uint8_t h) :
00022         left(l),
00023         top(t),
00024         right(l + (w - 1)),        
00025         bottom(t + (h - 1))
00026     {
00027     }
00028     
00029     Rect Intersection(Rect &rect)
00030     {
00031         uint8_t x1 = max(left, rect.left);
00032         uint8_t y1 = max(top, rect.top);
00033         uint8_t x2 = min(right, rect.right);
00034         uint8_t y2 = min(bottom, rect.bottom);
00035         
00036         return Rect(x1, y1, x2, y2); 
00037     }
00038     
00039     inline uint8_t getWidth() const { return right - left; }
00040     inline uint8_t getHeight() const { return bottom - top; }
00041 };
00042 
00043 #endif //__RECT_H__