EmbeddedArtists AB
/
app_lcdboard_demo_bubbles
Example for the LPC4088 QSB Base Board
BubbleDemo.h@1:aafddd9761a3, 2014-04-09 (annotated)
- Committer:
- embeddedartists
- Date:
- Wed Apr 09 09:43:40 2014 +0000
- Revision:
- 1:aafddd9761a3
- Parent:
- 0:7546db568365
Updated to latest version of EALib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:7546db568365 | 1 | |
embeddedartists | 0:7546db568365 | 2 | #ifndef BUBBLEDEMO_H |
embeddedartists | 0:7546db568365 | 3 | #define BUBBLEDEMO_H |
embeddedartists | 0:7546db568365 | 4 | |
embeddedartists | 0:7546db568365 | 5 | #include "Graphics.h" |
embeddedartists | 0:7546db568365 | 6 | |
embeddedartists | 0:7546db568365 | 7 | class BubbleDemo { |
embeddedartists | 0:7546db568365 | 8 | public: |
embeddedartists | 0:7546db568365 | 9 | |
embeddedartists | 0:7546db568365 | 10 | enum Constants { |
embeddedartists | 0:7546db568365 | 11 | NumBalls = 17 |
embeddedartists | 0:7546db568365 | 12 | }; |
embeddedartists | 0:7546db568365 | 13 | |
embeddedartists | 0:7546db568365 | 14 | /** Set the address of the frame buffer to use. |
embeddedartists | 0:7546db568365 | 15 | * |
embeddedartists | 0:7546db568365 | 16 | * It is the content of the frame buffer that is shown on the |
embeddedartists | 0:7546db568365 | 17 | * display. All the drawing on the frame buffer can be done |
embeddedartists | 0:7546db568365 | 18 | * 'offline' and whenever it should be shown this function |
embeddedartists | 0:7546db568365 | 19 | * can be called with the address of the offline frame buffer. |
embeddedartists | 0:7546db568365 | 20 | * |
embeddedartists | 0:7546db568365 | 21 | * @param pFrameBuf Pointer to the frame buffer, which must be |
embeddedartists | 0:7546db568365 | 22 | * 3 times as big as the frame size (for tripple |
embeddedartists | 0:7546db568365 | 23 | * buffering). |
embeddedartists | 0:7546db568365 | 24 | * dispWidth The width of the display (in pixels). |
embeddedartists | 0:7546db568365 | 25 | * dispHeight The height of the display (in pixels). |
embeddedartists | 0:7546db568365 | 26 | * loops Number of loops in the demo code. |
embeddedartists | 0:7546db568365 | 27 | * delayMs Delay in milliseconds between schreen updates. |
embeddedartists | 0:7546db568365 | 28 | * |
embeddedartists | 0:7546db568365 | 29 | * @returns |
embeddedartists | 0:7546db568365 | 30 | * none |
embeddedartists | 0:7546db568365 | 31 | */ |
embeddedartists | 0:7546db568365 | 32 | BubbleDemo(uint8_t *pFrameBuf, uint16_t dispWidth, uint16_t dispHeight); |
embeddedartists | 0:7546db568365 | 33 | |
embeddedartists | 0:7546db568365 | 34 | void run(uint32_t loops, uint32_t delayMs); |
embeddedartists | 0:7546db568365 | 35 | |
embeddedartists | 0:7546db568365 | 36 | private: |
embeddedartists | 0:7546db568365 | 37 | int32_t windowX; |
embeddedartists | 0:7546db568365 | 38 | int32_t windowY; |
embeddedartists | 0:7546db568365 | 39 | uint16_t *pFrmBuf; |
embeddedartists | 0:7546db568365 | 40 | uint16_t *pFrmBuf1; |
embeddedartists | 0:7546db568365 | 41 | uint16_t *pFrmBuf2; |
embeddedartists | 0:7546db568365 | 42 | uint16_t *pFrmBuf3; |
embeddedartists | 0:7546db568365 | 43 | |
embeddedartists | 0:7546db568365 | 44 | Graphics graphics; |
embeddedartists | 0:7546db568365 | 45 | |
embeddedartists | 0:7546db568365 | 46 | uint8_t i; |
embeddedartists | 0:7546db568365 | 47 | uint8_t j; |
embeddedartists | 0:7546db568365 | 48 | |
embeddedartists | 0:7546db568365 | 49 | float x[NumBalls]; |
embeddedartists | 0:7546db568365 | 50 | float y[NumBalls]; |
embeddedartists | 0:7546db568365 | 51 | uint8_t r[NumBalls]; |
embeddedartists | 0:7546db568365 | 52 | |
embeddedartists | 0:7546db568365 | 53 | float oldX[NumBalls]; |
embeddedartists | 0:7546db568365 | 54 | float oldY[NumBalls]; |
embeddedartists | 0:7546db568365 | 55 | |
embeddedartists | 0:7546db568365 | 56 | float velX[NumBalls]; |
embeddedartists | 0:7546db568365 | 57 | float velY[NumBalls]; |
embeddedartists | 0:7546db568365 | 58 | |
embeddedartists | 0:7546db568365 | 59 | uint8_t red[NumBalls]; |
embeddedartists | 0:7546db568365 | 60 | uint8_t green[NumBalls]; |
embeddedartists | 0:7546db568365 | 61 | uint8_t blue[NumBalls]; |
embeddedartists | 0:7546db568365 | 62 | |
embeddedartists | 0:7546db568365 | 63 | |
embeddedartists | 0:7546db568365 | 64 | void initialize(); |
embeddedartists | 0:7546db568365 | 65 | void collision(); |
embeddedartists | 0:7546db568365 | 66 | void borders(); |
embeddedartists | 0:7546db568365 | 67 | void draw(); |
embeddedartists | 0:7546db568365 | 68 | }; |
embeddedartists | 0:7546db568365 | 69 | |
embeddedartists | 0:7546db568365 | 70 | #endif /* BUBBLEDEMO_H */ |
embeddedartists | 0:7546db568365 | 71 |