F746 GUI other class.

Dependents:   DISCO-F746NG_test001

Committer:
InoueTakashi
Date:
Sat Jul 02 05:38:45 2016 +0000
Revision:
1:c77f45e79881
Parent:
0:944b36823ef2
Add const

Who changed what in which revision?

UserRevisionLine numberNew contents of line
InoueTakashi 0:944b36823ef2 1 //
InoueTakashi 0:944b36823ef2 2 // 2016/04/27, Copyright (c) 2016 Takashi Inoue
InoueTakashi 0:944b36823ef2 3 // Button OverLapping Class Source File
InoueTakashi 0:944b36823ef2 4 // ver 0.9 rev 0.1 2016/5/18
InoueTakashi 0:944b36823ef2 5 //-----------------------------------------------------------
InoueTakashi 0:944b36823ef2 6
InoueTakashi 0:944b36823ef2 7
InoueTakashi 0:944b36823ef2 8 #include "GUIinit.hpp"
InoueTakashi 0:944b36823ef2 9
InoueTakashi 0:944b36823ef2 10 namespace TakaIno
InoueTakashi 0:944b36823ef2 11 {
InoueTakashi 0:944b36823ef2 12 // Constructor
InoueTakashi 0:944b36823ef2 13
InoueTakashi 0:944b36823ef2 14 GUIinit::GUIinit(
InoueTakashi 0:944b36823ef2 15 uint16_t x, uint16_t y, sFONT &fonts,
InoueTakashi 0:944b36823ef2 16 uint32_t textColor, uint32_t backColor,
InoueTakashi 0:944b36823ef2 17 uint32_t createdColor, uint32_t touchedColor,
InoueTakashi 0:944b36823ef2 18 uint32_t inactiveColor, uint32_t inactiveTextColor)
InoueTakashi 0:944b36823ef2 19
InoueTakashi 0:944b36823ef2 20 :GuiBase(x, y, fonts, //Initializer= GUIinit Const's args --> GuiBase Const.
InoueTakashi 0:944b36823ef2 21 textColor, backColor, createdColor,
InoueTakashi 0:944b36823ef2 22 touchedColor, inactiveColor,
InoueTakashi 0:944b36823ef2 23 inactiveTextColor)
InoueTakashi 0:944b36823ef2 24
InoueTakashi 0:944b36823ef2 25 ,m_x(x), m_y(y), m_fonts(&fonts), //member initializer member(arg)
InoueTakashi 0:944b36823ef2 26 m_text_color(textColor), m_back_color(backColor),
InoueTakashi 0:944b36823ef2 27 m_created_color(createdColor),
InoueTakashi 0:944b36823ef2 28 m_touched_color(touchedColor),
InoueTakashi 0:944b36823ef2 29 m_inactive_color(inactiveColor),
InoueTakashi 0:944b36823ef2 30 m_inactive_text_color(inactiveTextColor)
InoueTakashi 0:944b36823ef2 31
InoueTakashi 0:944b36823ef2 32 {
InoueTakashi 0:944b36823ef2 33
InoueTakashi 0:944b36823ef2 34 lcd_p = GetLcdPtr();
InoueTakashi 0:944b36823ef2 35 ts_p = GetTsPtr();
InoueTakashi 0:944b36823ef2 36 ts_state = GetTsState();
InoueTakashi 0:944b36823ef2 37 ts_touch_detected = ts_state.touchDetected;
InoueTakashi 0:944b36823ef2 38
InoueTakashi 0:944b36823ef2 39 bk_info.i_txtColor = textColor;
InoueTakashi 0:944b36823ef2 40
InoueTakashi 0:944b36823ef2 41 bk_info.i_bakColor = backColor;
InoueTakashi 0:944b36823ef2 42
InoueTakashi 0:944b36823ef2 43 g_lcd_width = BSP_LCD_GetXSize() ;
InoueTakashi 0:944b36823ef2 44 g_lcd_height = BSP_LCD_GetYSize() ;
InoueTakashi 0:944b36823ef2 45 g_width = g_lcd_width;
InoueTakashi 0:944b36823ef2 46 g_height_offset = 0;
InoueTakashi 0:944b36823ef2 47 }
InoueTakashi 0:944b36823ef2 48
InoueTakashi 0:944b36823ef2 49 GUIinit::~GUIinit() {;}
InoueTakashi 0:944b36823ef2 50
InoueTakashi 0:944b36823ef2 51 //GUI Resource Set Init
InoueTakashi 0:944b36823ef2 52 void GUIinit::SetInit(sFONT &title_font, uint16_t btn_width)
InoueTakashi 0:944b36823ef2 53 {
InoueTakashi 0:944b36823ef2 54 g_lcd_width = BSP_LCD_GetXSize() ;
InoueTakashi 0:944b36823ef2 55 g_lcd_height = BSP_LCD_GetYSize() ;
InoueTakashi 0:944b36823ef2 56
InoueTakashi 0:944b36823ef2 57 g_width = g_lcd_width - btn_width; //X game area limit
InoueTakashi 0:944b36823ef2 58 g_height_offset = title_font.Height; //Y game area first
InoueTakashi 0:944b36823ef2 59
InoueTakashi 0:944b36823ef2 60
InoueTakashi 0:944b36823ef2 61 }
InoueTakashi 0:944b36823ef2 62
InoueTakashi 0:944b36823ef2 63 LCD_DISCO_F746NG* GUIinit::GetLcdPtrOth()
InoueTakashi 0:944b36823ef2 64 {
InoueTakashi 0:944b36823ef2 65 return lcd_p;
InoueTakashi 0:944b36823ef2 66 }
InoueTakashi 0:944b36823ef2 67
InoueTakashi 0:944b36823ef2 68 TS_DISCO_F746NG* GUIinit::GetTsPtrOth()
InoueTakashi 0:944b36823ef2 69 {
InoueTakashi 0:944b36823ef2 70 return ts_p;
InoueTakashi 0:944b36823ef2 71 }
InoueTakashi 0:944b36823ef2 72
InoueTakashi 0:944b36823ef2 73 TS_StateTypeDef GUIinit::GetTsStateOth()
InoueTakashi 0:944b36823ef2 74 {
InoueTakashi 0:944b36823ef2 75 ts_p->GetState(&ts_state);
InoueTakashi 0:944b36823ef2 76 return ts_state;
InoueTakashi 0:944b36823ef2 77 }
InoueTakashi 0:944b36823ef2 78 // If panel touched, return true
InoueTakashi 0:944b36823ef2 79 bool GUIinit::PanelTouchedOth()
InoueTakashi 0:944b36823ef2 80 {
InoueTakashi 0:944b36823ef2 81 ts_p->GetState(&ts_state);
InoueTakashi 0:944b36823ef2 82 // if (touchDetected is not changed) then return false
InoueTakashi 0:944b36823ef2 83 if( ts_touch_detected != ts_state.touchDetected )
InoueTakashi 0:944b36823ef2 84 {
InoueTakashi 0:944b36823ef2 85 ts_touch_detected = ts_state.touchDetected;
InoueTakashi 0:944b36823ef2 86 return (bool)(ts_state.touchDetected);
InoueTakashi 0:944b36823ef2 87 }
InoueTakashi 0:944b36823ef2 88 return false;
InoueTakashi 0:944b36823ef2 89
InoueTakashi 0:944b36823ef2 90 }
InoueTakashi 0:944b36823ef2 91
InoueTakashi 0:944b36823ef2 92
InoueTakashi 0:944b36823ef2 93 LCD_DISCO_F746NG *GUIinit::lcd_p;
InoueTakashi 0:944b36823ef2 94 TS_DISCO_F746NG *GUIinit::ts_p;
InoueTakashi 0:944b36823ef2 95
InoueTakashi 0:944b36823ef2 96 TS_StateTypeDef GUIinit::ts_state;
InoueTakashi 0:944b36823ef2 97
InoueTakashi 0:944b36823ef2 98 uint16_t GUIinit::g_width;
InoueTakashi 0:944b36823ef2 99 uint16_t GUIinit::g_height_offset;
InoueTakashi 0:944b36823ef2 100
InoueTakashi 0:944b36823ef2 101 uint16_t GUIinit::g_lcd_width;
InoueTakashi 0:944b36823ef2 102 uint16_t GUIinit::g_lcd_height;
InoueTakashi 0:944b36823ef2 103
InoueTakashi 0:944b36823ef2 104
InoueTakashi 0:944b36823ef2 105 //bool GUIinit::ts_touch_detected;
InoueTakashi 0:944b36823ef2 106 bool ts_touch_detected;
InoueTakashi 0:944b36823ef2 107 }
InoueTakashi 0:944b36823ef2 108
InoueTakashi 0:944b36823ef2 109
InoueTakashi 0:944b36823ef2 110
InoueTakashi 0:944b36823ef2 111