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.
Dependencies: BSP_DISCO_F746NG
view.cpp
00001 #include "view.h" 00002 #include "stm32746g_discovery_lcd.h" 00003 #include "mbed.h" 00004 #include "button.h" 00005 #include <list> 00006 #include "entrer-limiter.h" 00007 00008 View::View(int width, int height, uint32_t bgColor) 00009 : m_width(width), m_height(height), m_bgColor(bgColor) 00010 { 00011 Button *butDefault = new Button(100, 200, 150, 40, LCD_COLOR_GREEN,2); 00012 Button *but = new Button(250,200, 150, 40, LCD_COLOR_BLUE,2); 00013 but->setText("-1" ); 00014 butDefault->setText("reset"); 00015 m_buttonList.push_front(butDefault); 00016 m_buttonList.push_front(but); 00017 m_bgColor = LCD_COLOR_RED; 00018 draw(); 00019 00020 } 00021 00022 View::~View() 00023 { 00024 for (Button * it : m_buttonList) { 00025 delete it; 00026 } 00027 m_buttonList.clear(); 00028 } 00029 00030 void View::drawImage(int offsetX, int offsetY) 00031 { 00032 int x = 0; 00033 int y = 0; 00034 uint32_t* dataPtr = (uint32_t*)entrerlimiter.data; 00035 while(y < entrerlimiter.height) { 00036 while(x < entrerlimiter.width) { 00037 BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); 00038 dataPtr++; 00039 x++; 00040 } 00041 x = 0; 00042 y++; 00043 } 00044 } 00045 00046 void View::contain(int x, int y) 00047 { 00048 int idBut = 0; 00049 for (Button *it : m_buttonList) { 00050 bool memoetat = it->etat(); 00051 if (it->contain(x,y)) { 00052 if (idBut == 0) { 00053 if (!memoetat) { 00054 *i=*i-1; 00055 } 00056 } else { 00057 if (!memoetat) { 00058 *i=0; 00059 } 00060 } 00061 } 00062 idBut++; 00063 } 00064 } 00065 00066 void View::draw() 00067 { 00068 BSP_LCD_Clear(m_bgColor); 00069 for (Button *it : m_buttonList) { 00070 it->draw(); 00071 } 00072 00073 }
Generated on Wed Jul 13 2022 14:45:46 by
