Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BubbleDemo.h
00001 00002 #ifndef BUBBLEDEMO_H 00003 #define BUBBLEDEMO_H 00004 00005 #include "Graphics.h" 00006 #include "EaLcdBoardGPIO.h" 00007 00008 class BubbleDemo { 00009 public: 00010 00011 enum Constants { 00012 NumBalls = 17 00013 }; 00014 00015 /** Set the address of the frame buffer to use. 00016 * 00017 * It is the content of the frame buffer that is shown on the 00018 * display. All the drawing on the frame buffer can be done 00019 * 'offline' and whenever it should be shown this function 00020 * can be called with the address of the offline frame buffer. 00021 * 00022 * @param pFrameBuf Pointer to the frame buffer, which must be 00023 * 3 times as big as the frame size (for tripple 00024 * buffering). 00025 * dispWidth The width of the display (in pixels). 00026 * dispHeight The height of the display (in pixels). 00027 * loops Number of loops in the demo code. 00028 * delayMs Delay in milliseconds between schreen updates. 00029 * 00030 * @returns 00031 * none 00032 */ 00033 BubbleDemo(uint8_t *pFrameBuf, uint16_t dispWidth, uint16_t dispHeight); 00034 00035 void run(EaLcdBoardGPIO& lcdBoard, uint32_t loops, uint32_t delayMs); 00036 00037 private: 00038 int32_t windowX; 00039 int32_t windowY; 00040 uint16_t *pFrmBuf; 00041 uint16_t *pFrmBuf1; 00042 uint16_t *pFrmBuf2; 00043 uint16_t *pFrmBuf3; 00044 00045 Graphics graphics; 00046 00047 uint8_t i; 00048 uint8_t j; 00049 00050 float x[NumBalls]; 00051 float y[NumBalls]; 00052 uint8_t r[NumBalls]; 00053 00054 float oldX[NumBalls]; 00055 float oldY[NumBalls]; 00056 00057 float velX[NumBalls]; 00058 float velY[NumBalls]; 00059 00060 uint8_t red[NumBalls]; 00061 uint8_t green[NumBalls]; 00062 uint8_t blue[NumBalls]; 00063 00064 00065 void initialize(); 00066 void collision(); 00067 void borders(); 00068 void draw(); 00069 }; 00070 00071 #endif /* BUBBLEDEMO_H */ 00072
Generated on Wed Jul 13 2022 20:04:53 by
1.7.2