F746 GUI other class.
Dependents: DISCO-F746NG_test001
Circle.cpp@0:944b36823ef2, 2016-06-24 (annotated)
- Committer:
- InoueTakashi
- Date:
- Fri Jun 24 01:20:07 2016 +0000
- Revision:
- 0:944b36823ef2
F746 GUI other library.
Who changed what in which revision?
User | Revision | Line number | New 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/17 |
InoueTakashi | 0:944b36823ef2 | 5 | //----------------------------------------------------------- |
InoueTakashi | 0:944b36823ef2 | 6 | |
InoueTakashi | 0:944b36823ef2 | 7 | #include "mbed.h" |
InoueTakashi | 0:944b36823ef2 | 8 | #include "Circle.hpp" |
InoueTakashi | 0:944b36823ef2 | 9 | #include "GUIconst.hpp" |
InoueTakashi | 0:944b36823ef2 | 10 | |
InoueTakashi | 0:944b36823ef2 | 11 | namespace TakaIno |
InoueTakashi | 0:944b36823ef2 | 12 | { |
InoueTakashi | 0:944b36823ef2 | 13 | // Constructor |
InoueTakashi | 0:944b36823ef2 | 14 | Circle::Circle() |
InoueTakashi | 0:944b36823ef2 | 15 | { |
InoueTakashi | 0:944b36823ef2 | 16 | m_c_info.i_lcd_width = BSP_LCD_GetXSize(); |
InoueTakashi | 0:944b36823ef2 | 17 | } |
InoueTakashi | 0:944b36823ef2 | 18 | |
InoueTakashi | 0:944b36823ef2 | 19 | Circle::Circle(struct CircleInfo cirinfo = DEF_CIR_INFO[0]) |
InoueTakashi | 0:944b36823ef2 | 20 | { |
InoueTakashi | 0:944b36823ef2 | 21 | m_c_info.i_lcd_width = BSP_LCD_GetXSize(); |
InoueTakashi | 0:944b36823ef2 | 22 | m_c_info = cirinfo; |
InoueTakashi | 0:944b36823ef2 | 23 | } |
InoueTakashi | 0:944b36823ef2 | 24 | |
InoueTakashi | 0:944b36823ef2 | 25 | Circle::~Circle() |
InoueTakashi | 0:944b36823ef2 | 26 | { |
InoueTakashi | 0:944b36823ef2 | 27 | ; |
InoueTakashi | 0:944b36823ef2 | 28 | } |
InoueTakashi | 0:944b36823ef2 | 29 | |
InoueTakashi | 0:944b36823ef2 | 30 | bool Circle::DrawCircle(bool dsp_circle) |
InoueTakashi | 0:944b36823ef2 | 31 | { |
InoueTakashi | 0:944b36823ef2 | 32 | GetLcdPtrOth()->SetTextColor(m_c_info.i_txtColor); |
InoueTakashi | 0:944b36823ef2 | 33 | GetLcdPtrOth()->SetBackColor(m_c_info.i_bakColor); |
InoueTakashi | 0:944b36823ef2 | 34 | GetLcdPtrOth()->FillCircle((uint16_t)m_c_info.i_Xpos, (uint16_t)m_c_info.i_Ypos, (uint16_t)m_c_info.i_Radius); |
InoueTakashi | 0:944b36823ef2 | 35 | |
InoueTakashi | 0:944b36823ef2 | 36 | if( m_c_info.i_disp_c_str ) { |
InoueTakashi | 0:944b36823ef2 | 37 | GetLcdPtrOth()->SetTextColor(m_c_info.i_c_str_col ); |
InoueTakashi | 0:944b36823ef2 | 38 | GetLcdPtrOth()->SetBackColor(m_c_info.i_txtColor); |
InoueTakashi | 0:944b36823ef2 | 39 | GetLcdPtrOth()->SetFont(m_c_info.i_c_fonts); |
InoueTakashi | 0:944b36823ef2 | 40 | GetLcdPtrOth()->DisplayStringAt(CalX(m_c_info.i_Xpos), (uint16_t)m_c_info.i_Ypos, |
InoueTakashi | 0:944b36823ef2 | 41 | (uint8_t *)m_c_info.i_c_str[0].c_str(), (Text_AlignModeTypdef)0x01); |
InoueTakashi | 0:944b36823ef2 | 42 | } |
InoueTakashi | 0:944b36823ef2 | 43 | |
InoueTakashi | 0:944b36823ef2 | 44 | |
InoueTakashi | 0:944b36823ef2 | 45 | return true; |
InoueTakashi | 0:944b36823ef2 | 46 | } |
InoueTakashi | 0:944b36823ef2 | 47 | |
InoueTakashi | 0:944b36823ef2 | 48 | //Draw Circle at (Xpos, Ypos) |
InoueTakashi | 0:944b36823ef2 | 49 | bool Circle::DrawCircle(int16_t Xpos, int16_t Ypos, int16_t Radius, uint32_t txtColor, uint32_t bakColor, |
InoueTakashi | 0:944b36823ef2 | 50 | bool disp_c_str_flg, uint32_t c_str_col, int16_t str_idx, |
InoueTakashi | 0:944b36823ef2 | 51 | const string c_f_str, const string c_b_str, sFONT &c_fonts) |
InoueTakashi | 0:944b36823ef2 | 52 | { |
InoueTakashi | 0:944b36823ef2 | 53 | GetLcdPtrOth()->SetTextColor(txtColor); |
InoueTakashi | 0:944b36823ef2 | 54 | GetLcdPtrOth()->SetBackColor(bakColor); |
InoueTakashi | 0:944b36823ef2 | 55 | GetLcdPtrOth()->FillCircle((uint16_t)Xpos, (uint16_t)Ypos, (uint16_t)Radius); |
InoueTakashi | 0:944b36823ef2 | 56 | |
InoueTakashi | 0:944b36823ef2 | 57 | m_c_info.i_Xpos = Xpos; //Set GUI Circle Infomation |
InoueTakashi | 0:944b36823ef2 | 58 | m_c_info.i_Ypos = Ypos; |
InoueTakashi | 0:944b36823ef2 | 59 | m_c_info.i_Radius = Radius; |
InoueTakashi | 0:944b36823ef2 | 60 | m_c_info.i_txtColor = txtColor; |
InoueTakashi | 0:944b36823ef2 | 61 | m_c_info.i_bakColor = bakColor; |
InoueTakashi | 0:944b36823ef2 | 62 | |
InoueTakashi | 0:944b36823ef2 | 63 | //if (display string on) then draw string |
InoueTakashi | 0:944b36823ef2 | 64 | if( disp_c_str_flg ) { |
InoueTakashi | 0:944b36823ef2 | 65 | m_c_info.i_disp_c_str = disp_c_str_flg; |
InoueTakashi | 0:944b36823ef2 | 66 | m_c_info.i_c_str_col = c_str_col; |
InoueTakashi | 0:944b36823ef2 | 67 | m_c_info.i_c_str_idx = str_idx; |
InoueTakashi | 0:944b36823ef2 | 68 | m_c_info.i_c_str[0] = c_f_str; |
InoueTakashi | 0:944b36823ef2 | 69 | m_c_info.i_c_str[1] = c_b_str; |
InoueTakashi | 0:944b36823ef2 | 70 | m_c_info.i_c_fonts = &c_fonts; |
InoueTakashi | 0:944b36823ef2 | 71 | |
InoueTakashi | 0:944b36823ef2 | 72 | GetLcdPtrOth()->SetTextColor(c_str_col); |
InoueTakashi | 0:944b36823ef2 | 73 | GetLcdPtrOth()->SetBackColor(m_c_info.i_txtColor); |
InoueTakashi | 0:944b36823ef2 | 74 | GetLcdPtrOth()->SetFont(m_c_info.i_c_fonts); |
InoueTakashi | 0:944b36823ef2 | 75 | GetLcdPtrOth()->DisplayStringAt(CalX(Xpos), (uint16_t)Ypos, |
InoueTakashi | 0:944b36823ef2 | 76 | (uint8_t *)m_c_info.i_c_str[0].c_str(), (Text_AlignModeTypdef)0x01); |
InoueTakashi | 0:944b36823ef2 | 77 | |
InoueTakashi | 0:944b36823ef2 | 78 | } |
InoueTakashi | 0:944b36823ef2 | 79 | |
InoueTakashi | 0:944b36823ef2 | 80 | |
InoueTakashi | 0:944b36823ef2 | 81 | return true; |
InoueTakashi | 0:944b36823ef2 | 82 | } |
InoueTakashi | 0:944b36823ef2 | 83 | |
InoueTakashi | 0:944b36823ef2 | 84 | //Reverse Circle Color (TextColor <--> BackColor)) |
InoueTakashi | 0:944b36823ef2 | 85 | bool Circle::ReverseCircleColor() |
InoueTakashi | 0:944b36823ef2 | 86 | { |
InoueTakashi | 0:944b36823ef2 | 87 | uint32_t tmp_color; |
InoueTakashi | 0:944b36823ef2 | 88 | |
InoueTakashi | 0:944b36823ef2 | 89 | tmp_color = m_c_info.i_txtColor; |
InoueTakashi | 0:944b36823ef2 | 90 | |
InoueTakashi | 0:944b36823ef2 | 91 | GetLcdPtrOth()->SetTextColor( m_c_info.i_bakColor ); |
InoueTakashi | 0:944b36823ef2 | 92 | m_c_info.i_txtColor = m_c_info.i_bakColor; |
InoueTakashi | 0:944b36823ef2 | 93 | |
InoueTakashi | 0:944b36823ef2 | 94 | GetLcdPtrOth()->SetBackColor(tmp_color); |
InoueTakashi | 0:944b36823ef2 | 95 | m_c_info.i_bakColor = tmp_color; |
InoueTakashi | 0:944b36823ef2 | 96 | |
InoueTakashi | 0:944b36823ef2 | 97 | GetLcdPtrOth()->FillCircle((uint16_t)m_c_info.i_Xpos, (uint16_t)m_c_info.i_Ypos, |
InoueTakashi | 0:944b36823ef2 | 98 | (uint16_t)m_c_info.i_Radius ); |
InoueTakashi | 0:944b36823ef2 | 99 | |
InoueTakashi | 0:944b36823ef2 | 100 | if( m_c_info.i_c_str_idx == 0 ) m_c_info.i_c_str_idx = 1; |
InoueTakashi | 0:944b36823ef2 | 101 | else m_c_info.i_c_str_idx = 0; |
InoueTakashi | 0:944b36823ef2 | 102 | |
InoueTakashi | 0:944b36823ef2 | 103 | //if (display string on) then draw string |
InoueTakashi | 0:944b36823ef2 | 104 | if( m_c_info.i_disp_c_str ) { |
InoueTakashi | 0:944b36823ef2 | 105 | |
InoueTakashi | 0:944b36823ef2 | 106 | GetLcdPtrOth()->SetTextColor(m_c_info.i_c_str_col); |
InoueTakashi | 0:944b36823ef2 | 107 | GetLcdPtrOth()->SetBackColor(m_c_info.i_txtColor); |
InoueTakashi | 0:944b36823ef2 | 108 | |
InoueTakashi | 0:944b36823ef2 | 109 | GetLcdPtrOth()->DisplayStringAt(CalX(m_c_info.i_Xpos), (uint16_t)m_c_info.i_Ypos, |
InoueTakashi | 0:944b36823ef2 | 110 | (uint8_t *)m_c_info.i_c_str[m_c_info.i_c_str_idx].c_str(), (Text_AlignModeTypdef)0x01); |
InoueTakashi | 0:944b36823ef2 | 111 | |
InoueTakashi | 0:944b36823ef2 | 112 | } |
InoueTakashi | 0:944b36823ef2 | 113 | |
InoueTakashi | 0:944b36823ef2 | 114 | return true; |
InoueTakashi | 0:944b36823ef2 | 115 | |
InoueTakashi | 0:944b36823ef2 | 116 | } |
InoueTakashi | 0:944b36823ef2 | 117 | |
InoueTakashi | 0:944b36823ef2 | 118 | //Display or Erase Circle |
InoueTakashi | 0:944b36823ef2 | 119 | bool Circle::DispOrEraseCircle(bool disp_flg) |
InoueTakashi | 0:944b36823ef2 | 120 | { |
InoueTakashi | 0:944b36823ef2 | 121 | if( disp_flg ) { |
InoueTakashi | 0:944b36823ef2 | 122 | //display |
InoueTakashi | 0:944b36823ef2 | 123 | GetLcdPtrOth()->SetTextColor( m_c_info.i_txtColor ); //set current text color |
InoueTakashi | 0:944b36823ef2 | 124 | |
InoueTakashi | 0:944b36823ef2 | 125 | GetLcdPtrOth()->FillCircle((uint16_t)m_c_info.i_Xpos, (uint16_t)m_c_info.i_Ypos, |
InoueTakashi | 0:944b36823ef2 | 126 | (uint16_t)m_c_info.i_Radius ); |
InoueTakashi | 0:944b36823ef2 | 127 | |
InoueTakashi | 0:944b36823ef2 | 128 | //if (display string on) then draw string |
InoueTakashi | 0:944b36823ef2 | 129 | if( m_c_info.i_disp_c_str ) { |
InoueTakashi | 0:944b36823ef2 | 130 | |
InoueTakashi | 0:944b36823ef2 | 131 | GetLcdPtrOth()->SetTextColor(m_c_info.i_c_str_col); |
InoueTakashi | 0:944b36823ef2 | 132 | GetLcdPtrOth()->SetBackColor(m_c_info.i_txtColor); |
InoueTakashi | 0:944b36823ef2 | 133 | GetLcdPtrOth()->DisplayStringAt(CalX(m_c_info.i_Xpos), (uint16_t)m_c_info.i_Ypos, |
InoueTakashi | 0:944b36823ef2 | 134 | (uint8_t *)m_c_info.i_c_str[m_c_info.i_c_str_idx].c_str(), (Text_AlignModeTypdef)0x01); |
InoueTakashi | 0:944b36823ef2 | 135 | |
InoueTakashi | 0:944b36823ef2 | 136 | } |
InoueTakashi | 0:944b36823ef2 | 137 | } else { |
InoueTakashi | 0:944b36823ef2 | 138 | //erase |
InoueTakashi | 0:944b36823ef2 | 139 | GetLcdPtrOth()->SetTextColor( GUIinit::bk_info.i_bakColor ); //set current text color |
InoueTakashi | 0:944b36823ef2 | 140 | |
InoueTakashi | 0:944b36823ef2 | 141 | GetLcdPtrOth()->FillCircle((uint16_t)m_c_info.i_Xpos, (uint16_t)m_c_info.i_Ypos, |
InoueTakashi | 0:944b36823ef2 | 142 | (uint16_t)m_c_info.i_Radius ); |
InoueTakashi | 0:944b36823ef2 | 143 | } |
InoueTakashi | 0:944b36823ef2 | 144 | |
InoueTakashi | 0:944b36823ef2 | 145 | |
InoueTakashi | 0:944b36823ef2 | 146 | return true; |
InoueTakashi | 0:944b36823ef2 | 147 | } |
InoueTakashi | 0:944b36823ef2 | 148 | |
InoueTakashi | 0:944b36823ef2 | 149 | |
InoueTakashi | 0:944b36823ef2 | 150 | // If panel touched, return true |
InoueTakashi | 0:944b36823ef2 | 151 | bool Circle::CircleTouched() |
InoueTakashi | 0:944b36823ef2 | 152 | { |
InoueTakashi | 0:944b36823ef2 | 153 | if( !PanelTouchedOth() ) return false; |
InoueTakashi | 0:944b36823ef2 | 154 | if( !IsOnCircle() ) return false; |
InoueTakashi | 0:944b36823ef2 | 155 | return true; |
InoueTakashi | 0:944b36823ef2 | 156 | } |
InoueTakashi | 0:944b36823ef2 | 157 | |
InoueTakashi | 0:944b36823ef2 | 158 | // If touched position is on the circle, return true |
InoueTakashi | 0:944b36823ef2 | 159 | bool Circle::IsOnCircle() |
InoueTakashi | 0:944b36823ef2 | 160 | { |
InoueTakashi | 0:944b36823ef2 | 161 | int16_t x,y,Len; |
InoueTakashi | 0:944b36823ef2 | 162 | TS_StateTypeDef tss = GetTsStateOth(); |
InoueTakashi | 0:944b36823ef2 | 163 | |
InoueTakashi | 0:944b36823ef2 | 164 | |
InoueTakashi | 0:944b36823ef2 | 165 | int nTouch = multiTouch_ ? tss.touchDetected : 1; |
InoueTakashi | 0:944b36823ef2 | 166 | |
InoueTakashi | 0:944b36823ef2 | 167 | for (int n=0; n<nTouch; n++) { |
InoueTakashi | 0:944b36823ef2 | 168 | x = (int16_t)tss.touchX[n]; |
InoueTakashi | 0:944b36823ef2 | 169 | y = (int16_t)tss.touchY[n]; |
InoueTakashi | 0:944b36823ef2 | 170 | Len = (uint16_t)sqrt((double)((m_c_info.i_Xpos - x)*(m_c_info.i_Xpos - x)+ |
InoueTakashi | 0:944b36823ef2 | 171 | (m_c_info.i_Ypos - y)*(m_c_info.i_Ypos - y))); |
InoueTakashi | 0:944b36823ef2 | 172 | if( Len <= m_c_info.i_Radius ) return true; |
InoueTakashi | 0:944b36823ef2 | 173 | |
InoueTakashi | 0:944b36823ef2 | 174 | } |
InoueTakashi | 0:944b36823ef2 | 175 | return false; |
InoueTakashi | 0:944b36823ef2 | 176 | } |
InoueTakashi | 0:944b36823ef2 | 177 | |
InoueTakashi | 0:944b36823ef2 | 178 | //Move circle |
InoueTakashi | 0:944b36823ef2 | 179 | bool Circle::MoveCircle(bool move_flg, int16_t xstep, int16_t ystep) |
InoueTakashi | 0:944b36823ef2 | 180 | { |
InoueTakashi | 0:944b36823ef2 | 181 | m_c_info.i_move_flg = move_flg; |
InoueTakashi | 0:944b36823ef2 | 182 | |
InoueTakashi | 0:944b36823ef2 | 183 | m_c_info.i_Xstep = xstep; |
InoueTakashi | 0:944b36823ef2 | 184 | m_c_info.i_Ystep = ystep; |
InoueTakashi | 0:944b36823ef2 | 185 | |
InoueTakashi | 0:944b36823ef2 | 186 | return true; |
InoueTakashi | 0:944b36823ef2 | 187 | } |
InoueTakashi | 0:944b36823ef2 | 188 | bool Circle::MoveCircle(bool move_flg) |
InoueTakashi | 0:944b36823ef2 | 189 | { |
InoueTakashi | 0:944b36823ef2 | 190 | m_c_info.i_move_flg = move_flg; |
InoueTakashi | 0:944b36823ef2 | 191 | return true; |
InoueTakashi | 0:944b36823ef2 | 192 | } |
InoueTakashi | 0:944b36823ef2 | 193 | |
InoueTakashi | 0:944b36823ef2 | 194 | bool Circle::ChangeCirclePos() |
InoueTakashi | 0:944b36823ef2 | 195 | { |
InoueTakashi | 0:944b36823ef2 | 196 | // if( m_c_info.i_Xstep != 0 || m_c_info.i_Ystep != 0) { |
InoueTakashi | 0:944b36823ef2 | 197 | if( m_c_info.i_move_flg ) { |
InoueTakashi | 0:944b36823ef2 | 198 | GetLcdPtrOth()->SetTextColor( GUIinit::bk_info.i_bakColor ); //set current text color |
InoueTakashi | 0:944b36823ef2 | 199 | |
InoueTakashi | 0:944b36823ef2 | 200 | GetLcdPtrOth()->FillCircle((uint16_t)m_c_info.i_Xpos, (uint16_t)m_c_info.i_Ypos, |
InoueTakashi | 0:944b36823ef2 | 201 | (uint16_t)m_c_info.i_Radius ); |
InoueTakashi | 0:944b36823ef2 | 202 | |
InoueTakashi | 0:944b36823ef2 | 203 | int16_t befo_x = m_c_info.i_Xpos; |
InoueTakashi | 0:944b36823ef2 | 204 | m_c_info.i_Xpos += m_c_info.i_Xstep; |
InoueTakashi | 0:944b36823ef2 | 205 | if( ((int32_t)g_width - (int32_t)m_c_info.i_Radius) < (int32_t)m_c_info.i_Xpos ) { |
InoueTakashi | 0:944b36823ef2 | 206 | m_c_info.i_Xpos = befo_x; // |
InoueTakashi | 0:944b36823ef2 | 207 | m_c_info.i_Xstep *= (-1); |
InoueTakashi | 0:944b36823ef2 | 208 | } |
InoueTakashi | 0:944b36823ef2 | 209 | if( (int32_t)m_c_info.i_Radius > (int32_t)m_c_info.i_Xpos ) { |
InoueTakashi | 0:944b36823ef2 | 210 | m_c_info.i_Xpos = befo_x; // |
InoueTakashi | 0:944b36823ef2 | 211 | m_c_info.i_Xstep *= (-1); |
InoueTakashi | 0:944b36823ef2 | 212 | } |
InoueTakashi | 0:944b36823ef2 | 213 | |
InoueTakashi | 0:944b36823ef2 | 214 | int16_t befo_y = m_c_info.i_Ypos; |
InoueTakashi | 0:944b36823ef2 | 215 | m_c_info.i_Ypos += m_c_info.i_Ystep; |
InoueTakashi | 0:944b36823ef2 | 216 | if( ((int32_t)g_lcd_height - (int32_t)m_c_info.i_Radius) < (int32_t)m_c_info.i_Ypos ) { |
InoueTakashi | 0:944b36823ef2 | 217 | m_c_info.i_Ypos = befo_y; // |
InoueTakashi | 0:944b36823ef2 | 218 | m_c_info.i_Ystep *= (-1); |
InoueTakashi | 0:944b36823ef2 | 219 | } |
InoueTakashi | 0:944b36823ef2 | 220 | if( (int32_t)(m_c_info.i_Radius + g_height_offset) > (int32_t)m_c_info.i_Ypos ) { |
InoueTakashi | 0:944b36823ef2 | 221 | m_c_info.i_Ypos = befo_y; // |
InoueTakashi | 0:944b36823ef2 | 222 | m_c_info.i_Ystep *= (-1); |
InoueTakashi | 0:944b36823ef2 | 223 | } |
InoueTakashi | 0:944b36823ef2 | 224 | |
InoueTakashi | 0:944b36823ef2 | 225 | |
InoueTakashi | 0:944b36823ef2 | 226 | } |
InoueTakashi | 0:944b36823ef2 | 227 | |
InoueTakashi | 0:944b36823ef2 | 228 | GetLcdPtrOth()->SetTextColor( m_c_info.i_txtColor ); //set current text color |
InoueTakashi | 0:944b36823ef2 | 229 | |
InoueTakashi | 0:944b36823ef2 | 230 | GetLcdPtrOth()->FillCircle((uint16_t)m_c_info.i_Xpos, (uint16_t)m_c_info.i_Ypos, |
InoueTakashi | 0:944b36823ef2 | 231 | (uint16_t)m_c_info.i_Radius ); |
InoueTakashi | 0:944b36823ef2 | 232 | |
InoueTakashi | 0:944b36823ef2 | 233 | //if (display string on) then draw string |
InoueTakashi | 0:944b36823ef2 | 234 | if( m_c_info.i_disp_c_str ) { |
InoueTakashi | 0:944b36823ef2 | 235 | |
InoueTakashi | 0:944b36823ef2 | 236 | GetLcdPtrOth()->SetTextColor(m_c_info.i_c_str_col); |
InoueTakashi | 0:944b36823ef2 | 237 | GetLcdPtrOth()->SetBackColor(m_c_info.i_txtColor); |
InoueTakashi | 0:944b36823ef2 | 238 | GetLcdPtrOth()->DisplayStringAt(CalX(m_c_info.i_Xpos), (uint16_t)m_c_info.i_Ypos, |
InoueTakashi | 0:944b36823ef2 | 239 | (uint8_t *)m_c_info.i_c_str[m_c_info.i_c_str_idx].c_str(), (Text_AlignModeTypdef)0x01); |
InoueTakashi | 0:944b36823ef2 | 240 | |
InoueTakashi | 0:944b36823ef2 | 241 | |
InoueTakashi | 0:944b36823ef2 | 242 | |
InoueTakashi | 0:944b36823ef2 | 243 | |
InoueTakashi | 0:944b36823ef2 | 244 | } |
InoueTakashi | 0:944b36823ef2 | 245 | return true; |
InoueTakashi | 0:944b36823ef2 | 246 | } |
InoueTakashi | 0:944b36823ef2 | 247 | |
InoueTakashi | 0:944b36823ef2 | 248 | uint16_t Circle::PosX(int16_t x, const string str, sFONT &sfont) |
InoueTakashi | 0:944b36823ef2 | 249 | { |
InoueTakashi | 0:944b36823ef2 | 250 | return (uint16_t)((uint16_t)x - str.length() * sfont.Width/2); |
InoueTakashi | 0:944b36823ef2 | 251 | |
InoueTakashi | 0:944b36823ef2 | 252 | } |
InoueTakashi | 0:944b36823ef2 | 253 | |
InoueTakashi | 0:944b36823ef2 | 254 | uint16_t Circle::CalX(int16_t x) |
InoueTakashi | 0:944b36823ef2 | 255 | { |
InoueTakashi | 0:944b36823ef2 | 256 | if( m_c_info.i_lcd_width / 2 < x ) { |
InoueTakashi | 0:944b36823ef2 | 257 | x -= m_c_info.i_lcd_width / 2; |
InoueTakashi | 0:944b36823ef2 | 258 | } else { |
InoueTakashi | 0:944b36823ef2 | 259 | x += m_c_info.i_lcd_width / 2; |
InoueTakashi | 0:944b36823ef2 | 260 | } |
InoueTakashi | 0:944b36823ef2 | 261 | return (uint16_t)x; |
InoueTakashi | 0:944b36823ef2 | 262 | } |
InoueTakashi | 0:944b36823ef2 | 263 | } |
InoueTakashi | 0:944b36823ef2 | 264 | |
InoueTakashi | 0:944b36823ef2 | 265 | |
InoueTakashi | 0:944b36823ef2 | 266 | |
InoueTakashi | 0:944b36823ef2 | 267 | |
InoueTakashi | 0:944b36823ef2 | 268 |