| ... | ... |
@@ -14,8 +14,9 @@ WITH REGARD TO THIS SOFTWARE. |
| 14 | 14 |
|
| 15 | 15 |
#include "uxn.h" |
| 16 | 16 |
|
| 17 |
-#define HOR 64 / 2 |
|
| 18 |
-#define VER 48 / 2 |
|
| 17 |
+#define MODE 2 |
|
| 18 |
+#define HOR 64 / MODE |
|
| 19 |
+#define VER 48 / MODE |
|
| 19 | 20 |
#define PAD 2 |
| 20 | 21 |
#define RES (HOR * VER * 16) |
| 21 | 22 |
|
| ... | ... |
@@ -26,7 +27,7 @@ typedef struct {
|
| 26 | 27 |
|
| 27 | 28 |
int WIDTH = 8 * HOR + 8 * PAD * 2; |
| 28 | 29 |
int HEIGHT = 8 * VER + 8 * PAD * 2; |
| 29 |
-int FPS = 30, GUIDES = 1, ZOOM = 2; |
|
| 30 |
+int FPS = 30, GUIDES = 1, ZOOM = MODE; |
|
| 30 | 31 |
|
| 31 | 32 |
Uint32 theme[] = {
|
| 32 | 33 |
0x000000, |
| ... | ... |
@@ -261,6 +262,7 @@ domouse(SDL_Event *event) |
| 261 | 262 |
Uint8 flag = 0x00; |
| 262 | 263 |
int x = clamp((event->motion.x - PAD * 8 * ZOOM) / ZOOM, 0, WIDTH - 1); |
| 263 | 264 |
int y = clamp((event->motion.y - PAD * 8 * ZOOM) / ZOOM, 0, HEIGHT - 1); |
| 265 |
+ devmouse->mem[0] = (x >> 8) & 0xff; |
|
| 264 | 266 |
devmouse->mem[1] = x & 0xff; |
| 265 | 267 |
devmouse->mem[2] = (y >> 8) & 0xff; |
| 266 | 268 |
devmouse->mem[3] = y & 0xff; |
| ... | ... |
@@ -4,23 +4,22 @@ |
| 4 | 4 |
:dev/w fff9 ( std write port ) |
| 5 | 5 |
|
| 6 | 6 |
&Point2d { x 2 y 2 }
|
| 7 |
+&Window2d { x1 2 y1 2 x2 2 y2 2 }
|
|
| 7 | 8 |
|
| 8 | 9 |
;pos Point2d |
| 9 | 10 |
;mouse Point2d |
| 10 | 11 |
;scenter Point2d |
| 12 |
+;win Window2d |
|
| 11 | 13 |
|
| 12 | 14 |
( drawing ) ;color 1 ;x1 2 ;x2 2 ;y1 2 ;y2 2 ;i 2 |
| 13 |
-( window ) ;wx1 2 ;wy1 2 ;wx2 2 ;wy2 2 |
|
| 14 | 15 |
;state 1 |
| 15 | 16 |
|
| 16 | 17 |
|0100 @RESET |
| 17 | 18 |
|
| 18 |
- #01 =color |
|
| 19 |
- |
|
| 20 | 19 |
#01 =dev/r ( read screen for size ) |
| 21 |
- |
|
| 22 | 20 |
#02 =dev/w ( write to screen ) |
| 23 | 21 |
|
| 22 |
+ #08 =color |
|
| 24 | 23 |
,paint-pattern JSR |
| 25 | 24 |
|
| 26 | 25 |
#01 =dev/w ( write to screen ) |
| ... | ... |
@@ -38,8 +37,6 @@ |
| 38 | 37 |
|
| 39 | 38 |
#09 =color |
| 40 | 39 |
|
| 41 |
- ,window_name ~scenter.x #0058 SUB2 ~scenter.y #0018 SUB2 ,draw-label JSR |
|
| 42 |
- |
|
| 43 | 40 |
BRK |
| 44 | 41 |
|
| 45 | 42 |
|c000 @FRAME |
| ... | ... |
@@ -49,43 +46,41 @@ BRK |
| 49 | 46 |
( record mouse positions ) |
| 50 | 47 |
#00 IOR2 =mouse.x |
| 51 | 48 |
#02 IOR2 =mouse.y |
| 52 |
- #11 =state |
|
| 49 |
+ #13 =state |
|
| 53 | 50 |
|
| 54 | 51 |
( detect click ) |
| 55 | 52 |
#04 IOR #11 NEQ ,no-click12 ROT JMP? POP2 |
| 56 |
- #10 =state |
|
| 57 |
- ,mouse12_text #0040 ~scenter.y ,draw-label JSR |
|
| 58 |
- ~color ,mouse12_icn #0030 ~scenter.y ,draw-sprite JSR |
|
| 53 |
+ ,mouse12_text ~win.x1 #0018 ADD2 ~scenter.y #0008 SUB2 ,draw-label JSR |
|
| 54 |
+ ~color ,mouse12_icn ~win.x1 #0008 ADD2 ~scenter.y #0008 SUB2 ,draw-sprite JSR |
|
| 59 | 55 |
,end-click JSR |
| 60 | 56 |
@no-click12 |
| 61 | 57 |
#04 IOR #01 NEQ ,no-click1 ROT JMP? POP2 |
| 62 |
- #12 =state |
|
| 63 |
- ,mouse1_text #0040 ~scenter.y ,draw-label JSR |
|
| 64 |
- ~color ,mouse1_icn #0030 ~scenter.y ,draw-sprite JSR |
|
| 58 |
+ ,mouse1_text ~win.x1 #0018 ADD2 ~scenter.y #0008 SUB2 ,draw-label JSR |
|
| 59 |
+ ~color ,mouse1_icn ~win.x1 #0008 ADD2 ~scenter.y #0008 SUB2 ,draw-sprite JSR |
|
| 65 | 60 |
,end-click JSR |
| 66 | 61 |
@no-click1 |
| 67 | 62 |
#04 IOR #10 NEQ ,no-click2 ROT JMP? POP2 |
| 68 |
- #13 =state |
|
| 69 |
- ,mouse2_text #0040 ~scenter.y ,draw-label JSR |
|
| 70 |
- ~color ,mouse2_icn #0030 ~scenter.y ,draw-sprite JSR |
|
| 63 |
+ ,mouse2_text ~win.x1 #0018 ADD2 ~scenter.y #0008 SUB2 ,draw-label JSR |
|
| 64 |
+ ~color ,mouse2_icn ~win.x1 #0008 ADD2 ~scenter.y #0008 SUB2 ,draw-sprite JSR |
|
| 71 | 65 |
,end-click JSR |
| 72 | 66 |
@no-click2 |
| 73 | 67 |
( default ) |
| 74 |
- ,mouse0_text #0040 ~scenter.y ,draw-label JSR |
|
| 75 |
- ~color ,mouse0_icn #0030 ~scenter.y ,draw-sprite JSR |
|
| 68 |
+ #11 =state |
|
| 69 |
+ ,mouse0_text ~win.x1 #0018 ADD2 ~scenter.y #0008 SUB2 ,draw-label JSR |
|
| 70 |
+ ~color ,mouse0_icn ~win.x1 #0008 ADD2 ~scenter.y #0008 SUB2 ,draw-sprite JSR |
|
| 76 | 71 |
@end-click |
| 77 | 72 |
|
| 78 | 73 |
( detect chord ) |
| 79 | 74 |
#05 IOR #01 NEQ ,no-chord1 ROT JMP? POP2 |
| 80 |
- ,chord1_text #0040 ~scenter.y #0008 ADD2 ,draw-label JSR |
|
| 75 |
+ ,chord1_text ~win.x1 #0018 ADD2 ~scenter.y ,draw-label JSR |
|
| 81 | 76 |
,end-chord JSR |
| 82 | 77 |
@no-chord1 |
| 83 | 78 |
#05 IOR #10 NEQ ,no-chord2 ROT JMP? POP2 |
| 84 |
- ,chord2_text #0040 ~scenter.y #0008 ADD2 ,draw-label JSR |
|
| 79 |
+ ,chord2_text ~win.x1 #0018 ADD2 ~scenter.y ,draw-label JSR |
|
| 85 | 80 |
,end-chord JSR |
| 86 | 81 |
@no-chord2 |
| 87 | 82 |
( default ) |
| 88 |
- ,chord0_text #0040 ~scenter.y #0008 ADD2 ,draw-label JSR |
|
| 83 |
+ ,chord0_text ~win.x1 #0018 ADD2 ~scenter.y ,draw-label JSR |
|
| 89 | 84 |
@end-chord |
| 90 | 85 |
|
| 91 | 86 |
( draw mouse ) |
| ... | ... |
@@ -102,7 +97,7 @@ BRK |
| 102 | 97 |
@paint-pattern-loop-hor |
| 103 | 98 |
#0000 |
| 104 | 99 |
@paint-pattern-loop |
| 105 |
- ( draw ) OVR2 IOW2 DUP2 IOW2 ,pattern IOW2 #01 IOW |
|
| 100 |
+ ( draw ) OVR2 IOW2 DUP2 IOW2 ,pattern IOW2 ~color IOW |
|
| 106 | 101 |
( incr ) #0008 ADD2 DUP2 |
| 107 | 102 |
#00 IOR2 LTH2 ,paint-pattern-loop ROT JMP? POP2 |
| 108 | 103 |
POP2 |
| ... | ... |
@@ -114,18 +109,20 @@ RTS |
| 114 | 109 |
|
| 115 | 110 |
@paint-window ( name wx1 wy1 wx2 wy2 ) |
| 116 | 111 |
|
| 117 |
- =wy2 =wx2 =wy1 =wx1 |
|
| 112 |
+ =win.y2 =win.x2 =win.y1 =win.x1 |
|
| 118 | 113 |
|
| 119 |
- ( Draw background ) |
|
| 120 |
- #00 =color |
|
| 121 |
- ~wx1 #0003 ADD2 ~wy1 #0003 ADD2 ~wx2 #0003 ADD2 ~wy2 #0003 ADD2 ,fill-rect JSR |
|
| 114 |
+ ( Draw shadow ) |
|
| 115 |
+ #01 =color |
|
| 116 |
+ ~win.x2 ~win.y1 #0003 ADD2 ~win.x2 #0003 ADD2 ~win.y2 #0003 ADD2 ,fill-rect JSR |
|
| 117 |
+ ~win.x1 #0003 ADD2 ~win.y2 ~win.x2 #0003 ADD2 ~win.y2 #0003 ADD2 ,fill-rect JSR |
|
| 118 |
+ ( Fill background ) |
|
| 122 | 119 |
#02 =color |
| 123 |
- ~wx1 ~wy1 ~wx2 ~wy2 ,fill-rect JSR |
|
| 120 |
+ ~win.x1 ~win.y1 ~win.x2 ~win.y2 ,fill-rect JSR |
|
| 124 | 121 |
( draw outline ) |
| 125 | 122 |
#01 =color |
| 126 |
- ~wx1 ~wy1 ~wx2 ~wy2 ,line-rect JSR |
|
| 123 |
+ ~win.x1 ~win.y1 ~win.x2 ~win.y2 ,line-rect JSR |
|
| 127 | 124 |
#01 =color |
| 128 |
- ~wx1 #0002 ADD2 ~wy1 #0002 ADD2 ~wx2 #0002 SUB2 ~wy2 #0002 SUB2 ,line-rect JSR |
|
| 125 |
+ ~win.x1 #0002 ADD2 ~win.y1 #0002 ADD2 ~win.x2 #0002 SUB2 ~win.y2 #0002 SUB2 ,line-rect JSR |
|
| 129 | 126 |
|
| 130 | 127 |
RTS |
| 131 | 128 |
|
| ... | ... |
@@ -227,8 +224,7 @@ RTS |
| 227 | 224 |
@mouse1_text [ mouse 1_ ] <1 .00 |
| 228 | 225 |
@mouse2_text [ mouse _2 ] <1 .00 |
| 229 | 226 |
@mouse12_text [ mouse 12 ] <1 .00 |
| 230 |
-@window_name [ mouse test ] <1 .00 |
|
| 231 | 227 |
|
| 232 | 228 |
|d000 @ERROR BRK |
| 233 |
-|FFF0 [ 25fd c3d2 a7bf ] ( palette ) |
|
| 229 |
+|FFF0 [ f0ff 20df 40bf ] ( palette ) |
|
| 234 | 230 |
|FFFA .RESET .FRAME .ERROR |