EmbeddedArtists AB
/
app_lcdboard_demo_bubbles
Example for the LPC4088 QSB Base Board
Embed:
(wiki syntax)
Show/hide line numbers
BubbleDemo.h
00001 00002 #ifndef BUBBLEDEMO_H 00003 #define BUBBLEDEMO_H 00004 00005 #include "Graphics.h" 00006 00007 class BubbleDemo { 00008 public: 00009 00010 enum Constants { 00011 NumBalls = 17 00012 }; 00013 00014 /** Set the address of the frame buffer to use. 00015 * 00016 * It is the content of the frame buffer that is shown on the 00017 * display. All the drawing on the frame buffer can be done 00018 * 'offline' and whenever it should be shown this function 00019 * can be called with the address of the offline frame buffer. 00020 * 00021 * @param pFrameBuf Pointer to the frame buffer, which must be 00022 * 3 times as big as the frame size (for tripple 00023 * buffering). 00024 * dispWidth The width of the display (in pixels). 00025 * dispHeight The height of the display (in pixels). 00026 * loops Number of loops in the demo code. 00027 * delayMs Delay in milliseconds between schreen updates. 00028 * 00029 * @returns 00030 * none 00031 */ 00032 BubbleDemo(uint8_t *pFrameBuf, uint16_t dispWidth, uint16_t dispHeight); 00033 00034 void run(uint32_t loops, uint32_t delayMs); 00035 00036 private: 00037 int32_t windowX; 00038 int32_t windowY; 00039 uint16_t *pFrmBuf; 00040 uint16_t *pFrmBuf1; 00041 uint16_t *pFrmBuf2; 00042 uint16_t *pFrmBuf3; 00043 00044 Graphics graphics; 00045 00046 uint8_t i; 00047 uint8_t j; 00048 00049 float x[NumBalls]; 00050 float y[NumBalls]; 00051 uint8_t r[NumBalls]; 00052 00053 float oldX[NumBalls]; 00054 float oldY[NumBalls]; 00055 00056 float velX[NumBalls]; 00057 float velY[NumBalls]; 00058 00059 uint8_t red[NumBalls]; 00060 uint8_t green[NumBalls]; 00061 uint8_t blue[NumBalls]; 00062 00063 00064 void initialize(); 00065 void collision(); 00066 void borders(); 00067 void draw(); 00068 }; 00069 00070 #endif /* BUBBLEDEMO_H */ 00071
Generated on Mon Jul 18 2022 21:55:07 by 1.7.2