changeset 40:8d2362b6ac12

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 04 Jul 2018 13:39:11 +0300
parents 5e0306ac3575
children c5076cf2f21d
files multipaint.pde
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/multipaint.pde	Wed Jul 04 12:10:35 2018 +0300
+++ b/multipaint.pde	Wed Jul 04 13:39:11 2018 +0300
@@ -380,8 +380,6 @@
 
 
 void draw() {
-    int msx, msy;
-
     if (!focused) {
         g_control = false;
         g_shift = false;
@@ -400,6 +398,7 @@
     if (moicon(0, height - 32 * g_uizoom, 15 * 16 * g_uizoom, 32 * g_uizoom)) help(TAB);
     if (moicon(width - 32 * g_uizoom, 0, 32 * g_uizoom, 16 * g_uizoom)) help(int('.'));
 
+    // Update some mouse variables
     if (g_data[int('m')] == 0 && g_data[int('M')] == 0) {
         g_mx = g_msx - g_windowx;
         g_my = g_msy - g_windowy;
@@ -411,9 +410,10 @@
     g_msx = mouseX;
     g_msy = mouseY;
 
-    //actual tool drawing
+    // Actual tool drawing
     if (g_tooltrigger == 1) { // comes from mousepressed, or mousedragged
-        if (g_mx <= width - g_hedge && g_my <= height - g_vedge) do_tool(g_mx, g_my, g_button);
+        if (g_mx <= width - g_hedge && g_my <= height - g_vedge)
+            do_tool(g_mx, g_my, g_button);
     }
 
     switcher(0);
@@ -422,10 +422,11 @@
         g_remdo[i] = 0;
     }
 
+    // Tool drawing for shows
     int lipo = g_button;
-    //tool drawing for shows
     if (tool() != 5) {
-        if (g_phase == 0) g_button = LEFT;
+        if (g_phase == 0)
+            g_button = LEFT;
         do_tool(g_mx, g_my, LEFT);
     }
     if (tool() == 6) doline(g_rx, g_ry, g_rx2, g_ry2, 0);
@@ -433,14 +434,16 @@
     if (tool() == 8) rectangle(g_rx, g_ry, g_rx2, g_ry2);
     g_button = lipo;
 
+    // Screen update stuff
     loadPixels();
     viewport();
     //magport();
     switcher(1);
     update_ui();
+    updatePixels();
 
-    updatePixels();
-    if (g_msgctr > 0) g_msgctr--;
+    if (g_msgctr > 0)
+        g_msgctr--;
 
     // UI file operations
     if (fileselect) // Fileselect "event" for Load