flip tile

Fork of 4DGL-uLCD-SE by jim hamblen

Committer:
4180_1
Date:
Sun Nov 17 04:36:12 2013 +0000
Revision:
2:edae99e4abe7
Parent:
1:8b656995301f
Child:
5:8936798c19a3
ver 1.01

Who changed what in which revision?

UserRevisionLine numberNew contents of line
4180_1 1:8b656995301f 1 //
4180_1 1:8b656995301f 2 // uLCD_4DGL is a class to drive 4D Systems TFT touch screens
4180_1 1:8b656995301f 3 //
4180_1 1:8b656995301f 4 // Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr>
4180_1 1:8b656995301f 5 //
4180_1 1:8b656995301f 6 // uLCD_4DGL is free software: you can redistribute it and/or modify
4180_1 1:8b656995301f 7 // it under the terms of the GNU General Public License as published by
4180_1 1:8b656995301f 8 // the Free Software Foundation, either version 3 of the License, or
4180_1 1:8b656995301f 9 // (at your option) any later version.
4180_1 1:8b656995301f 10 //
4180_1 1:8b656995301f 11 // uLCD_4DGL is distributed in the hope that it will be useful,
4180_1 1:8b656995301f 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
4180_1 1:8b656995301f 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4180_1 1:8b656995301f 14 // GNU General Public License for more details.
4180_1 1:8b656995301f 15 //
4180_1 1:8b656995301f 16 // You should have received a copy of the GNU General Public License
4180_1 1:8b656995301f 17 // along with uLCD_4DGL. If not, see <http://www.gnu.org/licenses/>.
4180_1 1:8b656995301f 18
4180_1 1:8b656995301f 19 #include "mbed.h"
4180_1 1:8b656995301f 20 #include "uLCD_4DGL.h"
4180_1 1:8b656995301f 21
4180_1 1:8b656995301f 22 //****************************************************************************************************
4180_1 1:8b656995301f 23 void uLCD_4DGL :: set_font(char mode) // set font size
4180_1 1:8b656995301f 24 {
4180_1 1:8b656995301f 25 char command[3]= "";
4180_1 1:8b656995301f 26
4180_1 1:8b656995301f 27 command[0] = SETFONT;
4180_1 1:8b656995301f 28 command[1] = 0;
4180_1 1:8b656995301f 29 command[2] = mode;
4180_1 1:8b656995301f 30
4180_1 1:8b656995301f 31 current_font = mode;
4180_1 1:8b656995301f 32
4180_1 1:8b656995301f 33 if (current_orientation == IS_PORTRAIT) {
4180_1 2:edae99e4abe7 34 current_w = SIZE_X;
4180_1 2:edae99e4abe7 35 current_h = SIZE_Y;
4180_1 1:8b656995301f 36 } else {
4180_1 2:edae99e4abe7 37 current_w = SIZE_Y;
4180_1 2:edae99e4abe7 38 current_h = SIZE_X;
4180_1 1:8b656995301f 39 }
4180_1 1:8b656995301f 40
4180_1 1:8b656995301f 41 switch (mode) {
4180_1 1:8b656995301f 42 case FONT_5X7 :
4180_1 2:edae99e4abe7 43 current_fx = 6;
4180_1 2:edae99e4abe7 44 current_fy = 8;
4180_1 2:edae99e4abe7 45 break;
4180_1 2:edae99e4abe7 46 case FONT_7X8 :
4180_1 2:edae99e4abe7 47 current_fx = 7;
4180_1 2:edae99e4abe7 48 current_fy = 8;
4180_1 1:8b656995301f 49 break;
4180_1 1:8b656995301f 50 case FONT_8X8 :
4180_1 2:edae99e4abe7 51 current_fx = 8;
4180_1 2:edae99e4abe7 52 current_fy = 8;
4180_1 1:8b656995301f 53 break;
4180_1 1:8b656995301f 54 case FONT_8X12 :
4180_1 2:edae99e4abe7 55 current_fx = 8;
4180_1 2:edae99e4abe7 56 current_fy = 12;
4180_1 1:8b656995301f 57 break;
4180_1 1:8b656995301f 58 case FONT_12X16 :
4180_1 2:edae99e4abe7 59 current_fx = 12;
4180_1 2:edae99e4abe7 60 current_fy = 16;
4180_1 1:8b656995301f 61 break;
4180_1 1:8b656995301f 62 }
4180_1 1:8b656995301f 63
4180_1 2:edae99e4abe7 64 max_col = current_w / (current_fx*current_wf);
4180_1 2:edae99e4abe7 65 max_row = current_h / (current_fy*current_hf);
4180_1 1:8b656995301f 66
4180_1 1:8b656995301f 67 writeCOMMAND(command, 3);
4180_1 1:8b656995301f 68 }
4180_1 1:8b656995301f 69
4180_1 1:8b656995301f 70 //****************************************************************************************************
4180_1 1:8b656995301f 71 void uLCD_4DGL :: text_mode(char mode) // set text mode
4180_1 1:8b656995301f 72 {
4180_1 1:8b656995301f 73 char command[3]= "";
4180_1 1:8b656995301f 74
4180_1 1:8b656995301f 75 command[0] = TEXTMODE;
4180_1 1:8b656995301f 76 command[1] = 0;
4180_1 1:8b656995301f 77 command[2] = mode;
4180_1 1:8b656995301f 78
4180_1 1:8b656995301f 79 writeCOMMAND(command, 3);
4180_1 1:8b656995301f 80 }
4180_1 1:8b656995301f 81
4180_1 1:8b656995301f 82 //****************************************************************************************************
4180_1 2:edae99e4abe7 83 void uLCD_4DGL :: text_width(char width) // set text width
4180_1 2:edae99e4abe7 84 {
4180_1 2:edae99e4abe7 85 char command[3]= "";
4180_1 2:edae99e4abe7 86
4180_1 2:edae99e4abe7 87 command[0] = TEXTWIDTH;
4180_1 2:edae99e4abe7 88 command[1] = 0;
4180_1 2:edae99e4abe7 89 command[2] = width;
4180_1 2:edae99e4abe7 90 current_wf = width;
4180_1 2:edae99e4abe7 91 max_col = current_w / (current_fx*current_wf);
4180_1 2:edae99e4abe7 92 writeCOMMAND(command, 3);
4180_1 2:edae99e4abe7 93 }
4180_1 2:edae99e4abe7 94
4180_1 2:edae99e4abe7 95 //****************************************************************************************************
4180_1 2:edae99e4abe7 96 void uLCD_4DGL :: text_height(char height) // set text height
4180_1 2:edae99e4abe7 97 {
4180_1 2:edae99e4abe7 98 char command[3]= "";
4180_1 2:edae99e4abe7 99
4180_1 2:edae99e4abe7 100 command[0] = TEXTHEIGHT;
4180_1 2:edae99e4abe7 101 command[1] = 0;
4180_1 2:edae99e4abe7 102 command[2] = height;
4180_1 2:edae99e4abe7 103 current_hf = height;
4180_1 2:edae99e4abe7 104 max_row = current_h / (current_fy*current_hf);
4180_1 2:edae99e4abe7 105 writeCOMMAND(command, 3);
4180_1 2:edae99e4abe7 106 }
4180_1 2:edae99e4abe7 107
4180_1 2:edae99e4abe7 108
4180_1 2:edae99e4abe7 109 //****************************************************************************************************
4180_1 1:8b656995301f 110 void uLCD_4DGL :: text_char(char c, char col, char row, int color) // draw a text char
4180_1 1:8b656995301f 111 {
4180_1 1:8b656995301f 112 char command[6]= "";
4180_1 1:8b656995301f 113 command[0] = 0xE4; //move cursor
4180_1 1:8b656995301f 114 command[1] = 0;
4180_1 1:8b656995301f 115 command[2] = row;
4180_1 1:8b656995301f 116 command[3] = 0;
4180_1 1:8b656995301f 117 command[4] = col;
4180_1 1:8b656995301f 118 writeCOMMAND(command, 5);
4180_1 1:8b656995301f 119
4180_1 1:8b656995301f 120 command[0] = 0x7F; //set color
4180_1 1:8b656995301f 121
4180_1 1:8b656995301f 122 int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits
4180_1 1:8b656995301f 123 int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits
4180_1 1:8b656995301f 124 int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits
4180_1 1:8b656995301f 125
4180_1 1:8b656995301f 126 command[1] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
4180_1 1:8b656995301f 127 command[2] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
4180_1 1:8b656995301f 128 writeCOMMAND(command, 3);
4180_1 1:8b656995301f 129
4180_1 1:8b656995301f 130 command[0] = TEXTCHAR; //print char
4180_1 1:8b656995301f 131 command[1] = 0;
4180_1 1:8b656995301f 132 command[2] = c;
4180_1 1:8b656995301f 133 writeCOMMAND(command, 3);
4180_1 1:8b656995301f 134
4180_1 1:8b656995301f 135 }
4180_1 1:8b656995301f 136
4180_1 1:8b656995301f 137 //****************************************************************************************************
4180_1 1:8b656995301f 138 void uLCD_4DGL :: graphic_char(char c, int x, int y, int color, char width, char height) // draw a graphic char
4180_1 1:8b656995301f 139 {
4180_1 1:8b656995301f 140 char command[10]= "";
4180_1 1:8b656995301f 141
4180_1 1:8b656995301f 142 command[0] = GRAPHCHAR;
4180_1 1:8b656995301f 143
4180_1 1:8b656995301f 144 command[1] = c;
4180_1 1:8b656995301f 145
4180_1 1:8b656995301f 146 command[2] = (x >> 8) & 0xFF;
4180_1 1:8b656995301f 147 command[3] = x & 0xFF;
4180_1 1:8b656995301f 148
4180_1 1:8b656995301f 149 command[4] = (y >> 8) & 0xFF;
4180_1 1:8b656995301f 150 command[5] = y & 0xFF;
4180_1 1:8b656995301f 151
4180_1 1:8b656995301f 152 int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits
4180_1 1:8b656995301f 153 int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits
4180_1 1:8b656995301f 154 int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits
4180_1 1:8b656995301f 155
4180_1 1:8b656995301f 156 command[6] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
4180_1 1:8b656995301f 157 command[7] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
4180_1 1:8b656995301f 158
4180_1 1:8b656995301f 159 command[8] = width;
4180_1 1:8b656995301f 160
4180_1 1:8b656995301f 161 command[9] = height;
4180_1 1:8b656995301f 162
4180_1 1:8b656995301f 163 writeCOMMAND(command, 10);
4180_1 1:8b656995301f 164 }
4180_1 1:8b656995301f 165
4180_1 1:8b656995301f 166 //****************************************************************************************************
4180_1 1:8b656995301f 167 void uLCD_4DGL :: text_string(char *s, char col, char row, char font, int color) // draw a text string
4180_1 1:8b656995301f 168 {
4180_1 1:8b656995301f 169
4180_1 1:8b656995301f 170 char command[1000]= "";
4180_1 1:8b656995301f 171 int size = strlen(s);
4180_1 1:8b656995301f 172 int i = 0;
4180_1 1:8b656995301f 173
4180_1 1:8b656995301f 174 set_font(font);
4180_1 1:8b656995301f 175
4180_1 1:8b656995301f 176 command[0] = 0xE4; //move cursor
4180_1 1:8b656995301f 177 command[1] = 0;
4180_1 1:8b656995301f 178 command[2] = row;
4180_1 1:8b656995301f 179 command[3] = 0;
4180_1 1:8b656995301f 180 command[4] = col;
4180_1 1:8b656995301f 181 writeCOMMAND(command, 5);
4180_1 1:8b656995301f 182
4180_1 1:8b656995301f 183 command[0] = 0x7F; //set color
4180_1 1:8b656995301f 184 int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits
4180_1 1:8b656995301f 185 int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits
4180_1 1:8b656995301f 186 int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits
4180_1 1:8b656995301f 187
4180_1 1:8b656995301f 188 command[1] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
4180_1 1:8b656995301f 189 command[2] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
4180_1 1:8b656995301f 190 writeCOMMAND(command, 3);
4180_1 1:8b656995301f 191
4180_1 1:8b656995301f 192 command[0] = TEXTSTRING;
4180_1 1:8b656995301f 193 for (i=0; i<size; i++) command[1+i] = s[i];
4180_1 1:8b656995301f 194 command[1+size] = 0;
4180_1 1:8b656995301f 195 writeCOMMANDnull(command, 2 + size);
4180_1 1:8b656995301f 196 }
4180_1 1:8b656995301f 197
4180_1 1:8b656995301f 198 //****************************************************************************************************
4180_1 1:8b656995301f 199 void uLCD_4DGL :: graphic_string(char *s, int x, int y, char font, int color, char width, char height) // draw a text string
4180_1 1:8b656995301f 200 {
4180_1 1:8b656995301f 201
4180_1 1:8b656995301f 202 char command[1000]= "";
4180_1 1:8b656995301f 203 int size = strlen(s);
4180_1 1:8b656995301f 204 int i = 0;
4180_1 1:8b656995301f 205
4180_1 1:8b656995301f 206 command[0] = GRAPHSTRING;
4180_1 1:8b656995301f 207
4180_1 1:8b656995301f 208 command[1] = (x >> 8) & 0xFF;
4180_1 1:8b656995301f 209 command[2] = x & 0xFF;
4180_1 1:8b656995301f 210
4180_1 1:8b656995301f 211 command[3] = (y >> 8) & 0xFF;
4180_1 1:8b656995301f 212 command[4] = y & 0xFF;
4180_1 1:8b656995301f 213
4180_1 1:8b656995301f 214 command[5] = font;
4180_1 1:8b656995301f 215
4180_1 1:8b656995301f 216 int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits
4180_1 1:8b656995301f 217 int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits
4180_1 1:8b656995301f 218 int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits
4180_1 1:8b656995301f 219
4180_1 1:8b656995301f 220 command[6] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
4180_1 1:8b656995301f 221 command[7] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
4180_1 1:8b656995301f 222
4180_1 1:8b656995301f 223 command[8] = width;
4180_1 1:8b656995301f 224
4180_1 1:8b656995301f 225 command[9] = height;
4180_1 1:8b656995301f 226
4180_1 1:8b656995301f 227 for (i=0; i<size; i++) command[10+i] = s[i];
4180_1 1:8b656995301f 228
4180_1 1:8b656995301f 229 command[10+size] = 0;
4180_1 1:8b656995301f 230
4180_1 1:8b656995301f 231 writeCOMMAND(command, 11 + size);
4180_1 1:8b656995301f 232 }
4180_1 1:8b656995301f 233
4180_1 1:8b656995301f 234 //****************************************************************************************************
4180_1 1:8b656995301f 235 void uLCD_4DGL :: text_button(char *s, char mode, int x, int y, int button_color, char font, int text_color, char width, char height) // draw a text string
4180_1 1:8b656995301f 236 {
4180_1 1:8b656995301f 237
4180_1 1:8b656995301f 238 char command[1000]= "";
4180_1 1:8b656995301f 239 int size = strlen(s);
4180_1 1:8b656995301f 240 int i = 0, red5, green6, blue5;
4180_1 1:8b656995301f 241
4180_1 1:8b656995301f 242 command[0] = TEXTBUTTON;
4180_1 1:8b656995301f 243
4180_1 1:8b656995301f 244 command[1] = mode;
4180_1 1:8b656995301f 245
4180_1 1:8b656995301f 246 command[2] = (x >> 8) & 0xFF;
4180_1 1:8b656995301f 247 command[3] = x & 0xFF;
4180_1 1:8b656995301f 248
4180_1 1:8b656995301f 249 command[4] = (y >> 8) & 0xFF;
4180_1 1:8b656995301f 250 command[5] = y & 0xFF;
4180_1 1:8b656995301f 251
4180_1 1:8b656995301f 252 red5 = (button_color >> (16 + 3)) & 0x1F; // get red on 5 bits
4180_1 1:8b656995301f 253 green6 = (button_color >> (8 + 2)) & 0x3F; // get green on 6 bits
4180_1 1:8b656995301f 254 blue5 = (button_color >> (0 + 3)) & 0x1F; // get blue on 5 bits
4180_1 1:8b656995301f 255
4180_1 1:8b656995301f 256 command[6] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
4180_1 1:8b656995301f 257 command[7] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
4180_1 1:8b656995301f 258
4180_1 1:8b656995301f 259 command[8] = font;
4180_1 1:8b656995301f 260
4180_1 1:8b656995301f 261 red5 = (text_color >> (16 + 3)) & 0x1F; // get red on 5 bits
4180_1 1:8b656995301f 262 green6 = (text_color >> (8 + 2)) & 0x3F; // get green on 6 bits
4180_1 1:8b656995301f 263 blue5 = (text_color >> (0 + 3)) & 0x1F; // get blue on 5 bits
4180_1 1:8b656995301f 264
4180_1 1:8b656995301f 265 command[9] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
4180_1 1:8b656995301f 266 command[10] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
4180_1 1:8b656995301f 267
4180_1 1:8b656995301f 268 command[11] = width;
4180_1 1:8b656995301f 269
4180_1 1:8b656995301f 270 command[12] = height;
4180_1 1:8b656995301f 271
4180_1 1:8b656995301f 272 for (i=0; i<size; i++) command[13+i] = s[i];
4180_1 1:8b656995301f 273
4180_1 1:8b656995301f 274 command[13+size] = 0;
4180_1 1:8b656995301f 275
4180_1 1:8b656995301f 276 writeCOMMAND(command, 14 + size);
4180_1 1:8b656995301f 277 }
4180_1 1:8b656995301f 278
4180_1 1:8b656995301f 279 //****************************************************************************************************
4180_1 1:8b656995301f 280 void uLCD_4DGL :: locate(char col, char row) // place text curssor at col, row
4180_1 1:8b656995301f 281 {
4180_1 2:edae99e4abe7 282 char command[5] = "";
4180_1 1:8b656995301f 283 current_col = col;
4180_1 1:8b656995301f 284 current_row = row;
4180_1 2:edae99e4abe7 285 command[0] = 0xE4; //move cursor
4180_1 2:edae99e4abe7 286 command[1] = 0;
4180_1 2:edae99e4abe7 287 command[2] = current_row;
4180_1 2:edae99e4abe7 288 command[3] = 0;
4180_1 2:edae99e4abe7 289 command[4] = current_col;
4180_1 2:edae99e4abe7 290 writeCOMMAND(command, 5);
4180_1 1:8b656995301f 291 }
4180_1 1:8b656995301f 292
4180_1 1:8b656995301f 293 //****************************************************************************************************
4180_1 1:8b656995301f 294 void uLCD_4DGL :: color(int color) // set text color
4180_1 1:8b656995301f 295 {
4180_1 2:edae99e4abe7 296 char command[5] = "";
4180_1 1:8b656995301f 297 current_color = color;
4180_1 2:edae99e4abe7 298 command[0] = 0x7F; //set color
4180_1 2:edae99e4abe7 299
4180_1 2:edae99e4abe7 300 int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits
4180_1 2:edae99e4abe7 301 int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits
4180_1 2:edae99e4abe7 302 int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits
4180_1 2:edae99e4abe7 303
4180_1 2:edae99e4abe7 304 command[1] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
4180_1 2:edae99e4abe7 305 command[2] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
4180_1 2:edae99e4abe7 306 writeCOMMAND(command, 3);
4180_1 1:8b656995301f 307 }
4180_1 1:8b656995301f 308
4180_1 1:8b656995301f 309 //****************************************************************************************************
4180_1 2:edae99e4abe7 310 void uLCD_4DGL :: putc(char c) // place char at current cursor position
4180_1 2:edae99e4abe7 311 //used by virtual printf function _putc
4180_1 1:8b656995301f 312 {
4180_1 2:edae99e4abe7 313 char command[6] ="";
4180_1 1:8b656995301f 314
4180_1 2:edae99e4abe7 315 if(c=='\n') {
4180_1 2:edae99e4abe7 316 current_col = 0;
4180_1 2:edae99e4abe7 317 current_row++;
4180_1 2:edae99e4abe7 318 command[0] = 0xE4; //move cursor to start of next line
4180_1 2:edae99e4abe7 319 command[1] = 0;
4180_1 2:edae99e4abe7 320 command[2] = current_row;
4180_1 2:edae99e4abe7 321 command[3] = 0;
4180_1 2:edae99e4abe7 322 command[4] = current_col;
4180_1 2:edae99e4abe7 323 writeCOMMAND(command, 5);
4180_1 2:edae99e4abe7 324 } else {
4180_1 2:edae99e4abe7 325 command[0] = PUTCHAR;
4180_1 2:edae99e4abe7 326 command[1] = 0x00;
4180_1 2:edae99e4abe7 327 command[2] = c;
4180_1 2:edae99e4abe7 328 writeCOMMAND(command,3);
4180_1 2:edae99e4abe7 329 }
4180_1 1:8b656995301f 330 if (current_col == max_col) {
4180_1 1:8b656995301f 331 current_col = 0;
4180_1 1:8b656995301f 332 current_row++;
4180_1 2:edae99e4abe7 333 command[0] = 0xE4; //move cursor to next line
4180_1 2:edae99e4abe7 334 command[1] = 0;
4180_1 2:edae99e4abe7 335 command[2] = current_row;
4180_1 2:edae99e4abe7 336 command[3] = 0;
4180_1 2:edae99e4abe7 337 command[4] = current_col;
4180_1 2:edae99e4abe7 338 writeCOMMAND(command, 5);
4180_1 1:8b656995301f 339 }
4180_1 1:8b656995301f 340 if (current_row == max_row) {
4180_1 1:8b656995301f 341 current_row = 0;
4180_1 2:edae99e4abe7 342 command[0] = 0xE4; //move cursor back to start
4180_1 2:edae99e4abe7 343 command[1] = 0;
4180_1 2:edae99e4abe7 344 command[2] = current_row;
4180_1 2:edae99e4abe7 345 command[3] = 0;
4180_1 2:edae99e4abe7 346 command[4] = current_col;
4180_1 2:edae99e4abe7 347 writeCOMMAND(command, 5);
4180_1 1:8b656995301f 348 }
4180_1 1:8b656995301f 349 }
4180_1 1:8b656995301f 350
4180_1 2:edae99e4abe7 351
4180_1 1:8b656995301f 352 //****************************************************************************************************
4180_1 1:8b656995301f 353 void uLCD_4DGL :: puts(char *s) // place string at current cursor position
4180_1 1:8b656995301f 354 {
4180_1 1:8b656995301f 355
4180_1 1:8b656995301f 356 text_string(s, current_col, current_row, current_font, current_color);
4180_1 1:8b656995301f 357
4180_1 1:8b656995301f 358 current_col += strlen(s);
4180_1 1:8b656995301f 359
4180_1 1:8b656995301f 360 if (current_col >= max_col) {
4180_1 1:8b656995301f 361 current_row += current_col / max_col;
4180_1 1:8b656995301f 362 current_col %= max_col;
4180_1 1:8b656995301f 363 }
4180_1 1:8b656995301f 364 if (current_row >= max_row) {
4180_1 1:8b656995301f 365 current_row %= max_row;
4180_1 1:8b656995301f 366 }
4180_1 1:8b656995301f 367 }