Mercurial > hg > forks > multipaint-js
changeset 42:14b7d678dbc2
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 04 Jul 2018 14:42:03 +0300 |
parents | c5076cf2f21d |
children | df6eecdf1cd4 |
files | Interface.pde events.pde |
diffstat | 2 files changed, 46 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Interface.pde Wed Jul 04 13:56:13 2018 +0300 +++ b/Interface.pde Wed Jul 04 14:42:03 2018 +0300 @@ -8,6 +8,7 @@ byte[] g_depressed = new byte[256]; + int g_fixedraster[] = { 1,0,0,0,1,0,0,0, 0,0,1,0,0,0,1,0, @@ -19,6 +20,7 @@ 0,0,1,0,0,0,1,0 }; + int g_rasterpatterns[] = { 0,1,1,1,0,1,1,1, @@ -120,29 +122,35 @@ set_fixed_raster(g_raster_no); } + void fixed_raster_command(int par) { if (par == 'p') { g_raster_no--; - if (g_raster_no < 0) g_raster_no = 9; + if (g_raster_no < 0) + g_raster_no = 9; set_fixed_raster(g_raster_no); g_data[int('r')] = 1; } if (par == 'n') { g_raster_no++; - if (g_raster_no > 9) g_raster_no = 0; + if (g_raster_no > 9) + g_raster_no = 0; set_fixed_raster(g_raster_no); g_data[int('r')] = 1; } if (par == 'x') { g_raster_offset_x++; - if (g_raster_offset_x > 3) g_raster_offset_x = 0; + if (g_raster_offset_x > 3) + g_raster_offset_x = 0; } if (par == 'y') { g_raster_offset_y++; - if (g_raster_offset_y > 3) g_raster_offset_y = 0; + if (g_raster_offset_y > 3) + g_raster_offset_y = 0; } } + int magmode() { //return the mode "number" based on g_uizoom and 'm' and 'M' //currently valid outputs are 0,10,20,1,11,21,2,12,22 @@ -155,6 +163,7 @@ return base; } + int magx() { //return the amount of horizontal 8x8 characters in current mode ('m' or 'M') int psize, mag; @@ -163,6 +172,7 @@ return (width - (33 * g_uizoom)) / mag; } + int magy() { //return the amount of vertical 8x8 characters in current mode ('m' or 'M') int psize, mag; @@ -171,6 +181,7 @@ return (height - (33 * g_uizoom)) / mag; //how many chars in a magmode } + void ustats() { //a debug thingie in case the step undo does not work //println("UINDEX:"+g_uindex[g_spare]); @@ -178,6 +189,7 @@ //println("UBOTTOM:"+g_ubottom[g_spare]); } + void store_undo() //to_undo { if (g_spare == 0) arrayCopy(g_map, g_undob[g_uindex[g_spare]]); @@ -194,6 +206,7 @@ ustats(); } + void restore_undo() { if (g_uindex[g_spare] == g_ubottom[g_spare]) return; @@ -208,6 +221,7 @@ ustats(); } + void redo_undo() { if (g_uindex[g_spare] == g_utop[g_spare]) return; g_uindex[g_spare]++; @@ -219,6 +233,7 @@ ustats(); } + void spare() //dpaint style spare page { if (g_spare == 0) { // in REAL page, change to SPARE page @@ -238,6 +253,7 @@ refreshpalette(); } + void switcher(int di) { // this achieves varieties of whole screen copying // needed for brush copy and pre-drawing the shapes when a @@ -267,11 +283,13 @@ } } + void sussborder() { makecolor(259, g_r[g_map[0]], g_g[g_map[0]], g_b[g_map[0]]); g_boxreconstruct = 2; } + void makecolor(int c, int rr, int gg, int bb) { //0-255 go to g_map[] up until 1021-1023 //the rest is not stored @@ -287,6 +305,7 @@ g_rgb[c] = 0xff000000 | ((rr & 0xff) << 16) | ((gg & 0xff) << 8) | (bb & 0xff); } + int fylli() { //for the animated rubberband thingy g_rband++; @@ -299,6 +318,7 @@ return 1; } + void e_rect(int x1, int y1, int w, int h, int rgb) { int ad = x1 + y1 * width; //updatepixels has to be handled elsewhere @@ -310,6 +330,7 @@ } } + void d_rect(int x1, int y1, int w, int h, int rgb) { int ad = x1 + y1 * width; //updatepixels has to be handled elsewhere @@ -322,6 +343,7 @@ } } + void t_rect(int x1, int y1, int w, int h, int rgb) { // transparent rectangle // fixed tp, for grid drawing @@ -387,12 +409,14 @@ } } + void restoreparameters() { for (int i = 0; i <= 255; i++) { g_data[i] = g_data[767 + i]; } } + void drawtext(int xo, int yo, String ss) { //draw a bunch of text maybe not needed for (int i = 0; i < ss.length(); i++) { @@ -400,6 +424,7 @@ } } + void drawicon(int xo, int yo, int t, int mm) { //draw one icon int ad, cad, xx, yy, pop, far; @@ -451,6 +476,7 @@ } } + void drawchar(int xo, int yo, int t) { //characters at the help box int ad, x, y, xx, yy, far; @@ -482,6 +508,7 @@ } } + boolean moicon(int xx, int yy, int ww, int hh) { //check mouse/icon boundary without actually drawing the icon if (g_data[int('m')] == 0 && g_data[int('M')] == 0) { @@ -498,6 +525,7 @@ return false; } + boolean doicon_drag(int xx, int yy, int ww, int hh) { if (g_iconx >= xx && g_iconx < xx + ww && g_icony >= yy && g_icony < yy + hh) { g_iconx = -1; @@ -514,6 +542,7 @@ return false; } + boolean doicon(int xx, int yy, int ww, int hh) { if (g_iconx >= xx && g_iconx < xx + ww && g_icony >= yy && g_icony < yy + hh) { g_iconx = -1; @@ -524,6 +553,7 @@ return false; } + void printat(int xx, int yy, String tex) { //creating text into the help box for (int tit = 0; tit < tex.length(); tit++) { @@ -540,6 +570,7 @@ } } + void clearmsg() { for (int y = 0; y <= 3; y++) { for (int x = 0; x <= 11; x++) { @@ -549,6 +580,7 @@ } } + void message(String tex) { if (tex.equals("*")) { g_msgctr = 100; @@ -875,6 +907,7 @@ g_data[int('9')] = 0; } + int nextluminance(int f, int d) { int res = f + d; if (machine == PLUS4 || machine == PLUS4M) { @@ -944,7 +977,6 @@ } - int tool() { //returns the current tool #, for convenience //as there is no "tool" variable really @@ -982,6 +1014,7 @@ } } + void refresh() { //refreshes all "dirty chars" and icon panels for (int i = 0; i < MX * MY; i++) { @@ -992,11 +1025,13 @@ //elsewhere use g_boxreconstruct=2 for complete window reconstruction } + void refresh_all() { refresh(); g_boxreconstruct = 2; } + void palettebox(float x0, int y0, float x1) { if (g_palsteps == 0) return; float expand = ((x1 - x0) / g_palsteps); @@ -1038,6 +1073,7 @@ e_rect(int(x0 + expand * g_b[g_farge] / divs), y0 + 20 * g_uizoom, int(expand), 7 * g_uizoom, g_rgb[262]); } + void colorselector(int xo, int yo) { int x, y, ad, yfat; int far, xonko, yhei, maxp, xloc, yloc; @@ -1161,6 +1197,7 @@ } } + void messagebox(int ox, int oy) { int cz = 8 * g_uizoom; // lcd character display chardisplay textbox @@ -1176,6 +1213,7 @@ } } + void colorindicator(int ox, int oy) { int bs = 8 * g_uizoom; int h = 0; @@ -1207,6 +1245,7 @@ } } + void update_ui() { if (g_iconmode == 1) { for (int i = 0; i <= 80000; i++) { @@ -1241,6 +1280,7 @@ colorindicator(256 * g_uizoom, height - 32 * g_uizoom); } + void magport() { int b = g_uizoom * 2; int xo = 0; @@ -1253,6 +1293,7 @@ } } + void viewport() { // formerly void redo() // main machine screen redraw