-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmouse-fixes.patch
More file actions
60 lines (54 loc) · 1.68 KB
/
mouse-fixes.patch
File metadata and controls
60 lines (54 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff --git a/basic.c b/basic.c
index fd87ecf..1a2f709 100644
--- a/basic.c
+++ b/basic.c
@@ -9928,7 +9928,7 @@ static void execute_statement(char **p)
if (c == 'M') {
#ifdef GFX_VIDEO
if (starts_with_kw(*p, "MOUSESET")) {
- *p += 7;
+ *p += 8;
statement_mouseset(p);
return;
}
diff --git a/examples/gfx_mouse_demo.bas b/examples/gfx_mouse_demo.bas
index 9952e93..7f150da 100644
--- a/examples/gfx_mouse_demo.bas
+++ b/examples/gfx_mouse_demo.bas
@@ -37,13 +37,13 @@
280 IF ISMOUSEBUTTONPRESSED(2) THEN GOSUB 950
290 REM LEFT + RIGHT held together warps pointer to screen centre (MOUSESET)
-300 IF ISMOUSEBUTTONDOWN(0) AND ISMOUSEBUTTONDOWN(1) THEN MOUSESET 160, 100
+300 IF ISMOUSEBUTTONDOWN(0) AND ISMOUSEBUTTONDOWN(1) THEN GOSUB 700
310 REM change cursor shape by zone (only when zone changes)
320 ZONE = 0
330 IF MY < 40 THEN ZONE = 5
340 IF MY >= 40 AND MY < 140 THEN ZONE = 4
-350 IF ZONE <> LASTZONE THEN SETMOUSECURSOR ZONE : LASTZONE = ZONE
+350 IF ZONE <> LASTZONE THEN GOSUB 750
360 REM live status line on row 24
370 LOCATE 24, 1
@@ -53,6 +53,15 @@
390 SLEEP 1
400 GOTO 210
+700 REM ---- warp pointer to centre ----
+710 MOUSESET 160, 100
+720 RETURN
+
+750 REM ---- apply cursor shape for current zone ----
+760 SETMOUSECURSOR ZONE
+770 LASTZONE = ZONE
+780 RETURN
+
800 REM ---- banner / instruction block ----
810 LOCATE 1, 1
820 PRINT "{WHT}RGC-BASIC MOUSE DEMO"
@@ -62,7 +71,9 @@
860 RETURN
900 REM ---- clear drawing area, preserve banner ----
-910 PRINT CHR$(147);
+905 REM 8192 = $2000 bitmap base; 8000 = 320*200/8 bytes
+910 MEMSET 8192, 8000, 0
+915 PRINT CHR$(147);
920 GOSUB 800
930 RETURN