theog
Junior Member
Posts: 13
|
Post by theog on Sept 8, 2015 2:27:28 GMT -8
Hello, I have a big problem with my GD2. When I create keys with an other font than "18" like in the Widget sample, I always get an "m" at first. How can I get rid of it? I believe it comes from the init of the message[] because it sets it to 7! please help me.
Here is my code:
GD.cmd_keys(144, 168, 320, 24, 28, OPT_CENTER | OPT_CENTER | key, "qwertyuiop"); GD.cmd_keys(144, 168 + 26, 320, 24, 28, OPT_CENTER | OPT_CENTER | key, "asdfghjkl"); GD.cmd_keys(144, 168 + 52, 320, 24, 28, OPT_CENTER | OPT_CENTER | key, "zxcvbnm,."); GD.Tag(' '); GD.cmd_button(308 - 60, 172 + 74, 120, 20, 28, OPT_CENTER, "");
if ((prevkey2 == 0x00) && (' ' <= key) && (key < 0x7f)) { memmove(message2, message2 + 1, 39); message2[39] = key; } prevkey2 = key; GD.cmd_text(110, 120, 23, 0, message2); //Here I took font 23 instead of 18!
|
|
|
Post by jamesbowman on Sept 8, 2015 9:18:10 GMT -8
Right, the widgets demo fills the text buffer with character code 7, which is a circle in font 18.
But font 23 does not have character codes 00-31, so code 7 does not render. If you change widgets.ino to initialize 'message' to periods:
memset(message, '.', 40);
Then it will render fine in any font, e.g. number 23:
GD.cmd_text(149, 146, 23, 0, message);
|
|