Mercurial > hg > forks > multipaint-js
changeset 141:cdb62481ac97
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 13 Aug 2018 13:57:51 +0300 |
parents | 0c2610e112c3 |
children | 1ec3488bfd1e |
files | Interface.pde |
diffstat | 1 files changed, 46 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/Interface.pde Thu Aug 09 15:12:53 2018 +0300 +++ b/Interface.pde Mon Aug 13 13:57:51 2018 +0300 @@ -339,7 +339,8 @@ void drawtext(int xo, int yo, String ss) { //draw a bunch of text maybe not needed - for (int i = 0; i < ss.length(); i++) { + for (int i = 0; i < ss.length(); i++) + { drawchar(xo + i * 8 * 2, yo, ss.charAt(i)); } } @@ -486,23 +487,24 @@ } -void printat(int xx, int yy, String tex) +void printat(int xc, int yc, String mstr) { //creating text into the help box - for (int tit = 0; tit < tex.length(); tit++) + for (int index = 0; index < mstr.length(); index++) { - if (tex.charCodeAt(tit) != '|') + if (mstr.charCodeAt(index) != '|') { - if (g_data[256 + xx + yy * 12] != byte(tex.charCodeAt(tit))) { - g_data[256 + xx + yy * 12] = byte(tex.charCodeAt(tit)); - g_chaup[xx + yy * 16] = 1; + if (g_data[256 + xc + yc * 12] != byte(mstr.charCodeAt(index))) + { + g_data[256 + xc + yc * 12] = byte(mstr.charCodeAt(index)); + g_chaup[xc + yc * 16] = 1; } - xx++; + xc++; } else { - xx = 0; - yy++; + xc = 0; + yc++; } } } @@ -519,14 +521,16 @@ } -void message(String tex) { - if (tex.equals("*")) { +void message(String mstr) +{ + if (mstr.equals("*")) + { g_msgctr = 100; return; } - console.log("MSG: " + tex); + console.log("MSG: " + mstr); clearmsg(); - printat(0, 0, tex); + printat(0, 0, mstr); g_msgctr = 50; } @@ -592,7 +596,8 @@ printat(7, 3, "Key:" + str(char(mode))); - switch (char(mode)) { + switch (char(mode)) + { case '.': teks = "Preset pens|.=reset"; break; @@ -759,24 +764,22 @@ void icontable(int xx, int yy, int tabletype, int realdraw) { String pan = ""; - int x, y, ad; - g_data[int('9')] = 0; - if (g_btype == 9) g_data[int('9')] = 1; + int x = 0, y = 0, ad; + g_data[int('9')] = (g_btype == 9) ? 1 : 0; // the main and sideboard icon panel order if (tabletype == 0) pan = ";;h9::123456::78::pzxy::XYtn::lsEAwW::jc0g::uo::.b"; if (tabletype == 1) pan = "BCrRfd"; if (tabletype == 2) pan = "ik"; - x = 0; - y = 0; - - for (int tit = 0; tit < pan.length(); tit++) { - ad = pan.charCodeAt(tit); + for (int tit = 0; tit < pan.length(); tit++) + { + int ad = pan.charCodeAt(tit); if (g_repanel <= 0 && realdraw == 1) { - if (ad != ';' && ad != ':' && ad != '.') { + if (ad != ';' && ad != ':' && ad != '.') + { int icolor; if (ad == 'j' && g_spare) icolor = 1; @@ -801,11 +804,13 @@ } //tooltip - if (ad != ':' && ad != ';' && ad != '.') { + if (ad != ':' && ad != ';' && ad != '.') + { if (realdraw == 0) { if (moicon(xx + x, yy + y, 16 * g_uizoom, 16 * g_uizoom)) help(ad); } - if (doicon(xx + x, yy + y, 16 * g_uizoom, 16 * g_uizoom)) { + if (doicon(xx + x, yy + y, 16 * g_uizoom, 16 * g_uizoom)) + { //println(g_realbutton); if (ad == 'C' && g_realbutton == RIGHT) ad = 'V'; if (ad == 'B' && g_realbutton == RIGHT) ad = 'Q'; @@ -821,7 +826,8 @@ g_msgctr = 50; } } - if (ad == ';') { + if (ad == ';') + { for (int ii = 0; ii <= 3; ii++) for (int jj = 0; jj <= 1; jj++) { @@ -830,18 +836,22 @@ command(128 + ii + jj * 4); } } - if (tabletype == 0) { + if (tabletype == 0) + { x = x + 16 * g_uizoom; if (ad == '.') x = x - 8 * g_uizoom; - if (x > 16 * g_uizoom) { + if (x > 16 * g_uizoom) + { x = 0; y = y + 16 * g_uizoom; if (ad == ':') y = y - 14 * g_uizoom; } } - if (tabletype == 1 || tabletype == 2) { + if (tabletype == 1 || tabletype == 2) + { y = y + 16 * g_uizoom; - if (y > 16 * g_uizoom) { + if (y > 16 * g_uizoom) + { y = 0; x = x + 16 * g_uizoom; } @@ -893,6 +903,7 @@ } } } + return res; } @@ -901,8 +912,10 @@ { //returns the current tool #, for convenience //as there is no "tool" variable really - for (int i = '0'; i <= '9'; i++) { - if (g_data[i] == 1) return i - '0'; + for (int i = '0'; i <= '9'; i++) + { + if (g_data[i] == 1) + return i - '0'; } return 0; }