Mercurial > hg > forks > multipaint-js
changeset 148:d80871032cdd
More change integration.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 14 Aug 2018 13:56:18 +0300 |
parents | 9ad847dcd8e3 |
children | aca95d4a8e6b |
files | compiled/index.html draw_outputs.pde index.html multipaint.pde |
diffstat | 4 files changed, 108 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/compiled/index.html Tue Aug 14 13:41:06 2018 +0300 +++ b/compiled/index.html Tue Aug 14 13:56:18 2018 +0300 @@ -15,6 +15,7 @@ function mpRunSketch(canvas) { + canvas.imageSmoothingEnabled = false; new Processing(canvas, multipaintJS); }
--- a/draw_outputs.pde Tue Aug 14 13:41:06 2018 +0300 +++ b/draw_outputs.pde Tue Aug 14 13:56:18 2018 +0300 @@ -981,34 +981,42 @@ } -void do_tool(int qqx, int qqy, int mbut) +void storecoords(int qqx, int qqy) { - int ox, oy; - int tt = tool(), - psizex = g_magpix[magmode()], + int psizex = g_magpix[magmode()], psizey = g_magpiy[magmode()]; - //handles different tool behavior - if (g_data[int('m')] == 0 && g_data[int('M')] == 0) { - x = int(qqx / psizex); - y = int(qqy / psizey); - } else - if (g_data[int('m')] == 1 || g_data[int('M')] == 1) { - x = int(qqx / psizex) + g_ofx * 8; - y = int(qqy / psizey) + g_ofy * 8; - } else { - x = int(qqx); - y = int(qqy); + if (g_data[int('m')] == 0 && g_data[int('M')] == 0) + { + g_storedcoordx = int(qqx / psizex); + g_storedcoordy = int(qqy / psizey); + } + else + if (g_data[int('m')] == 1 || g_data[int('M')] == 1) + { + g_storedcoordx = int(qqx / psizex) + g_ofx * 8; + g_storedcoordy = int(qqy / psizey) + g_ofy * 8; + } + else + { + g_storedcoordx = int(qqx); + g_storedcoordy = int(qqy); } +} - ox = x; - oy = y; - g_storedcoordx = x; - g_storedcoordy = y; + +void do_tool(int qqx, int qqy, int mbut) +{ + storecoords(qqx, qqy); - //brush handle mid point - //some tools are exempted - if (g_btype == 9 && tool() != 4 && tool() != 0 && mbut != 255) { + int tt = tool(), + ox = g_storedcoordx, + oy = g_storedcoordy, + x = g_storedcoordx, + y = g_storedcoordy; + + if (g_btype == 9 && tt != 4 && tt != 0 && mbut != 255) + { x -= int((g_bsourcex2 - g_bsourcex) / 2); y -= int((g_bsourcey2 - g_bsourcey) / 2); } @@ -1164,6 +1172,7 @@ g_rx2 = x + (int(magx() / 2) + odd(magx())) * 8; g_ry2 = y + (int(magy() / 2) + odd(magy())) * 8; g_data[int('m')] = 0; + if (g_phase == 1) { g_rubbermode = 0;
--- a/index.html Tue Aug 14 13:41:06 2018 +0300 +++ b/index.html Tue Aug 14 13:56:18 2018 +0300 @@ -14,6 +14,7 @@ function mpRunSketch(canvas) { + canvas.imageSmoothingEnabled = false; Processing.loadSketchFromSources(canvas, mpSources); }
--- a/multipaint.pde Tue Aug 14 13:41:06 2018 +0300 +++ b/multipaint.pde Tue Aug 14 13:56:18 2018 +0300 @@ -5,16 +5,31 @@ // processing setup draw and file things here // -final int C64 = 0, MSX = 5, SPECTRUM = 6, C64M = 10, PLUS4 = 9, PLUS4M = 19, CPC = 2; // supported -final int TIMEX = 7, JR200 = 8, AMIGA = 11; // experimental or incomplete -final int C64FLI = 20, C64FLIM = 21; // experimental +// Supported +final int C64 = 0, MSX = 5, SPECTRUM = 6, C64M = 10, PLUS4 = 9, PLUS4M = 19, CPC = 2; + +// Experimental or incomplete +final int C64NOLIMIT = 32; // Commodore 64 without attribute limitations +final int C64FLI = 20, C64FLIM = 21; // incomplete FLI & AFLI modes +final int TIMEX = 7, JR200 = 8, AMIGA = 11, ATARIST = 12; final int PICO8 = 88; -final int FAKEX = 32; // Commodore 64 without attribute limitations final int UNIA = 33; +final int COCO3 = 34; +final int BK0010 = 99; +final int QLLOW = 66; + +// Reserved but completely unimplemented +final int VIC = 22; // VIC-20 +final int CGA = 23; // 320 x 200 PC CGA screen with black, white, cyan, magenta +final int CGAX = 24; // 320 x 200 PC CGA screen with black, yellow, green, red-ish +final int EGA = 200; // 320 x 200 PC EGA screen, 16 colors of 64 +final int VGA = 255; // 320 x 200 PC VGA screen, 256 colors of 65536 +final int NES = 90; // 8-bit NES +final int SEGAM = 91; // 8-bit Sega Master System + final int PEESEE = 0, MACOSX = 1, PSJS = 2; final int COMMAND = 157; // Marq's cmd/ctrl solution -//-1 & -1 for normal operation int machine = -1; // change this to autoselect int platform = PSJS; @@ -24,7 +39,7 @@ int g_omag, g_bordh, g_bordv, g_keymacpos; int g_wheelup = int(':'), g_wheeldown = int(';'), g_middlebutton = int(','); -boolean g_control = false, g_shift = false, g_dirty; +boolean g_control = false, g_shift = false, g_dirty, g_inhibit_aspect = false; String g_formatname, g_formatext, filename = "", sfilename = "", @@ -84,26 +99,54 @@ void setup() { + //normi g_magpix[0] = 3; g_magpix[1] = 8; g_magpix[2] = 16; + g_magpiy[0] = 3; + g_magpiy[1] = 8; + g_magpiy[2] = 16; + + //mini g_magpix[10] = 2; g_magpix[11] = 6; g_magpix[12] = 16; + g_magpiy[10] = 2; + g_magpiy[11] = 6; + g_magpiy[12] = 16; + + //maxi g_magpix[20] = 4; g_magpix[21] = 16; g_magpix[22] = 32; - - g_magpiy[0] = 3; - g_magpiy[1] = 8; - g_magpiy[2] = 16; - g_magpiy[10] = 2; - g_magpiy[11] = 6; - g_magpiy[12] = 16; g_magpiy[20] = 4; g_magpiy[21] = 16; g_magpiy[22] = 32; + //FLAT normi + g_magpix[100] = 3; + g_magpix[101] = 9; + g_magpix[102] = 12; + g_magpiy[100] = 2; + g_magpiy[101] = 6; + g_magpiy[102] = 8; + + //FLAT mini + g_magpix[110] = 3; + g_magpix[111] = 9; + g_magpix[112] = 12; + g_magpiy[110] = 2; + g_magpiy[111] = 6; + g_magpiy[112] = 8; + + //FLAT maxi + g_magpix[120] = 6; + g_magpix[121] = 12; + g_magpix[122] = 21; + g_magpiy[120] = 4; + g_magpiy[121] = 8; + g_magpiy[122] = 14; + g_omag = 1; g_bordh = 64; g_bordv = 32; @@ -118,7 +161,8 @@ else machine = C64; - switch (g_uizoom) { + switch (g_uizoom) + { case 1: g_wzoom = 2; size(700, 468); @@ -133,23 +177,29 @@ break; } + if (g_inhibit_aspect) + { + if (machine == QLLOW || machine == BK0010) + Y = 256; + } + + if (g_uizoom >= 1 && g_uizoom <= 3) + g_wzoom = g_uizoom + 1; + g_hedge = 32 * g_uizoom; g_vedge = 32 * g_uizoom; - g_uindex[0] = 0; - g_utop[0] = 0; - g_ubottom[0] = 0; - g_uindex[1] = 0; - g_utop[1] = 0; - g_ubottom[1] = 0; g_spare = 0; g_bsize = 0; g_btype = 0; g_phase = 0; g_button = LEFT; - g_data[int('f')] = 1; - g_data[int('g')] = 1; + + g_data[int('f')] = 1; // fill on + g_data[int('g')] = 1; // grid on + g_icons = mpLoadBinaryFile("icons.bin"); + set_tool(3); g_gridx = 8; @@ -487,6 +537,9 @@ g_button = LEFT; do_tool(g_mx, g_my, LEFT); } + else + storecoords(g_mx, g_my); + if (tool() == 6) doline(g_rx, g_ry, g_rx2, g_ry2, 0); if (tool() == 7) docircle(g_rx, g_ry, g_rx2, g_ry2); if (tool() == 8) rectangle(g_rx, g_ry, g_rx2, g_ry2);