HP Prime for All

English  Русский 
Blotch graphics-app screenshot}}
Name Blotch
Description Draws square blotches with random colors.
Author Eddie Shore

Source code (download):

Source code formatted by website engine

EXPORT BLOTCH( ) BEGIN // EWS 04-20-2014 // Initialize LOCAL m, m1, mx, my, j, k, r; WHILE MOUSE(1) ≥ 0 DO END; // Clear Canvas RECT; LOCAL s := 50, d := 4; // Menu - to be redrawn DRAWMENU("Clear", "S+5", "S-5", "D+2", "D-2", "Exit"); // Start main loop REPEAT // Get mouse data REPEAT m := MOUSE; m1 := m(1); UNTIL SIZE(m1) > 0; mx := m1(1); my := m1(2); DRAWMENU("Clear", "S+5", "S-5", "D+2", "D-2", "Exit"); // Clear Screen IF (my ≥ 220 AND my ≤ 319) AND (mx ≥ 0 AND mx ≤ 51) THEN RECT; END; // Change Size IF (my ≥ 220 AND my ≤ 319) AND (mx ≥ 53 AND mx ≤ 104) THEN IF s < 80 THEN s := s+5; END; END; IF (my ≥ 220 AND my ≤ 319) AND (mx ≥ 106 AND mx ≤ 157) THEN IF s > 5 THEN s := s-5; END; END; // Change Depth IF (my ≥ 220 AND my ≤ 319) AND (mx ≥ 159 AND mx ≤ 210) THEN IF d < 8 THEN d := d+2; END; END; IF (my ≥ 220 AND my ≤ 319) AND (mx ≥ 212 AND mx ≤ 263) THEN IF d > 2 THEN d := d-2; END; END; // Exit Key IF (my ≥ 220 AND my ≤ 319) AND (mx ≥ 256 AND mx ≤ 319) THEN BREAK; END; // Draw Blotch FOR j FROM mx-s/2 TO mx+s/2 STEP d DO FOR k FROM my-s/2 TO my+s/2 STEP d DO r := RANDINT(1677215); RECT_P(j, k, j+d-1, k+d-1, r); END; END; // Close main loop UNTIL (my ≥ 220 AND my ≤ 319) AND (mx ≥ 256 AND mx ≤ 319); RECT_P(0, 220, 319, 239); TEXTOUT_P("DONE!", 146, 220, 4, #FF0000h); WAIT(-1); END;

Comments