mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-30 09:43:02 +00:00
Fixed blending mode
This commit is contained in:
parent
720fc2f80b
commit
27b5ab0003
4 changed files with 23 additions and 47 deletions
|
@ -14,8 +14,8 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
|
|
||||||
#include "uxn.h"
|
#include "uxn.h"
|
||||||
|
|
||||||
#define HOR 32
|
#define HOR 64 / 2
|
||||||
#define VER 18
|
#define VER 48 / 2
|
||||||
#define PAD 2
|
#define PAD 2
|
||||||
#define RES (HOR * VER * 16)
|
#define RES (HOR * VER * 16)
|
||||||
|
|
||||||
|
@ -112,6 +112,8 @@ painticn(Uint8 *dst, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 blend)
|
||||||
for(v = 0; v < 8; v++)
|
for(v = 0; v < 8; v++)
|
||||||
for(h = 0; h < 8; h++) {
|
for(h = 0; h < 8; h++) {
|
||||||
Uint8 ch1 = ((sprite[v] >> (7 - h)) & 0x1);
|
Uint8 ch1 = ((sprite[v] >> (7 - h)) & 0x1);
|
||||||
|
if(ch1 == 0 && (blend == 0x05 || blend == 0x0a || blend == 0x0f))
|
||||||
|
continue;
|
||||||
paintpixel(dst, x + h, y + v, ch1 ? blend % 4 : blend / 4);
|
paintpixel(dst, x + h, y + v, ch1 ? blend % 4 : blend / 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +195,7 @@ drawdebugger(Uint32 *dst, Uxn *u)
|
||||||
Uint8 x = (i % 8) * 3 + 3, y = i / 8 + 3, b = u->ram.dat[i];
|
Uint8 x = (i % 8) * 3 + 3, y = i / 8 + 3, b = u->ram.dat[i];
|
||||||
drawicn(dst, x * 8, y * 8, icons[(b >> 4) & 0xf], 1, 0);
|
drawicn(dst, x * 8, y * 8, icons[(b >> 4) & 0xf], 1, 0);
|
||||||
drawicn(dst, x * 8 + 8, y * 8, icons[b & 0xf], 1, 0);
|
drawicn(dst, x * 8 + 8, y * 8, icons[b & 0xf], 1, 0);
|
||||||
y = i / 8 + 0x11, b = u->wst.dat[i];
|
y = VER - i / 8, b = u->wst.dat[i];
|
||||||
drawicn(dst, x * 8, y * 8, icons[(b >> 4) & 0xf], 1 + (u->wst.ptr == i), 0);
|
drawicn(dst, x * 8, y * 8, icons[(b >> 4) & 0xf], 1 + (u->wst.ptr == i), 0);
|
||||||
drawicn(dst, x * 8 + 8, y * 8, icons[b & 0xf], 1 + (u->wst.ptr == i), 0);
|
drawicn(dst, x * 8 + 8, y * 8, icons[b & 0xf], 1 + (u->wst.ptr == i), 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
:dev/r fff8 ( std read port )
|
:dev/r fff8 ( std read port )
|
||||||
:dev/w fff9 ( std write port )
|
:dev/w fff9 ( std write port )
|
||||||
|
|
||||||
;mousex 2 ;mousey 2 ;lastx 2 ;lasty 2
|
&Point2d { x 2 y 2 }
|
||||||
|
;mouse Point2d
|
||||||
;state 1 ;color 1 ;brush 2
|
;state 1 ;color 1 ;brush 2
|
||||||
|
|
||||||
|0100 @RESET
|
|0100 @RESET
|
||||||
|
@ -21,11 +22,11 @@ BRK
|
||||||
|c000 @FRAME
|
|c000 @FRAME
|
||||||
|
|
||||||
( clear last cursor )
|
( clear last cursor )
|
||||||
#10 ,clear_icn ~lastx ~lasty ,draw-sprite JSR
|
#10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR
|
||||||
( record mouse values )
|
( record mouse values )
|
||||||
#00 IOR2 =mousex #02 IOR2 =mousey
|
#00 IOR2 =mouse.x #02 IOR2 =mouse.y
|
||||||
#04 IOR #11 ADD =state
|
#04 IOR #11 ADD =state
|
||||||
~state ,cursor_icn ~mousex ~mousey ,draw-sprite JSR
|
~state ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR
|
||||||
|
|
||||||
( check click )
|
( check click )
|
||||||
#04 IOR #00 EQU ,end-touch ROT JMP? POP2
|
#04 IOR #00 EQU ,end-touch ROT JMP? POP2
|
||||||
|
@ -47,20 +48,18 @@ BRK
|
||||||
#05 =color BRK
|
#05 =color BRK
|
||||||
@option4
|
@option4
|
||||||
#02 IOR2 #0008 DIV2 #000c NEQ2 ,option5 ROT JMP? POP2
|
#02 IOR2 #0008 DIV2 #000c NEQ2 ,option5 ROT JMP? POP2
|
||||||
#06 =color BRK
|
#0a =color BRK
|
||||||
@option5
|
@option5
|
||||||
#02 IOR2 #0008 DIV2 #000d NEQ2 ,option6 ROT JMP? POP2
|
#02 IOR2 #0008 DIV2 #000d NEQ2 ,option6 ROT JMP? POP2
|
||||||
#07 =color BRK
|
#0f =color BRK
|
||||||
@option6
|
@option6
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
@end-interface
|
@end-interface
|
||||||
|
|
||||||
~color ~brush ~mousex #0004 SUB2 ~mousey #0004 SUB2 ,draw-sprite JSR
|
~color ~brush ~mouse.x #0004 SUB2 ~mouse.y #0004 SUB2 ,draw-sprite JSR
|
||||||
@end-touch
|
@end-touch
|
||||||
|
|
||||||
~mousex =lastx ~mousey =lasty ( update last post )
|
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@draw-interface
|
@draw-interface
|
||||||
|
@ -68,8 +67,8 @@ BRK
|
||||||
#05 ,brush_small #0008 #0028 ,draw-sprite JSR
|
#05 ,brush_small #0008 #0028 ,draw-sprite JSR
|
||||||
#05 ,brush_tiny #0008 #0030 ,draw-sprite JSR
|
#05 ,brush_tiny #0008 #0030 ,draw-sprite JSR
|
||||||
#05 ,brush_large #0008 #0058 ,draw-sprite JSR
|
#05 ,brush_large #0008 #0058 ,draw-sprite JSR
|
||||||
#06 ,brush_large #0008 #0060 ,draw-sprite JSR
|
#0a ,brush_large #0008 #0060 ,draw-sprite JSR
|
||||||
#07 ,brush_large #0008 #0068 ,draw-sprite JSR
|
#0f ,brush_large #0008 #0068 ,draw-sprite JSR
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@draw-sprite
|
@draw-sprite
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
( blank )
|
|
||||||
|
|
||||||
:dev/r fff8 ( std read port )
|
|
||||||
:dev/w fff9 ( std write port )
|
|
||||||
|
|
||||||
&Rect2d { x 2 y 2 width 2 height 2 }
|
|
||||||
&ColorRGB { r 1 g 1 b 1 }
|
|
||||||
|
|
||||||
;rc1 Rect2d
|
|
||||||
;red ColorRGB
|
|
||||||
|
|
||||||
|0100 @RESET
|
|
||||||
|
|
||||||
( byte mode )
|
|
||||||
#ff =red.r
|
|
||||||
~red.r
|
|
||||||
|
|
||||||
( short mode )
|
|
||||||
#1234 =rc1.x
|
|
||||||
#abcd =rc1.height
|
|
||||||
~rc1.height
|
|
||||||
|
|
||||||
BRK
|
|
||||||
|
|
||||||
|c000 @FRAME BRK
|
|
||||||
|d000 @ERROR BRK
|
|
||||||
|
|
||||||
|FFF0 [ 0f32 0f32 0f32 ] ( palette )
|
|
||||||
|FFFA .RESET .FRAME .ERROR
|
|
|
@ -3,9 +3,13 @@
|
||||||
:dev/r fff8 ( std read port )
|
:dev/r fff8 ( std read port )
|
||||||
:dev/w fff9 ( std write port )
|
:dev/w fff9 ( std write port )
|
||||||
|
|
||||||
|
&Point2d { x 2 y 2 }
|
||||||
|
|
||||||
|
;mouse Point2d
|
||||||
|
|
||||||
( window ) ;wx1 2 ;wy1 2 ;wx2 2 ;wy2 2
|
( window ) ;wx1 2 ;wy1 2 ;wx2 2 ;wy2 2
|
||||||
( drawing ) ;color 1 ;x1 2 ;x2 2 ;y1 2 ;y2 2
|
( drawing ) ;color 1 ;x1 2 ;x2 2 ;y1 2 ;y2 2
|
||||||
( mouse ) ;mousex 2 ;mousey 2 ;state 1
|
( mouse ) ;state 1
|
||||||
|
|
||||||
|0100 @RESET
|
|0100 @RESET
|
||||||
|
|
||||||
|
@ -22,9 +26,9 @@ BRK
|
||||||
|c000 @FRAME
|
|c000 @FRAME
|
||||||
|
|
||||||
( clear last cursor )
|
( clear last cursor )
|
||||||
#10 ,clear_icn ~mousex ~mousey ,draw-sprite JSR
|
#10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR
|
||||||
( record mouse positions )
|
( record mouse positions )
|
||||||
#00 IOR2 =mousex #02 IOR2 =mousey
|
#00 IOR2 =mouse.x #02 IOR2 =mouse.y
|
||||||
( record mouse state )
|
( record mouse state )
|
||||||
#04 IOR #11 ADD =state
|
#04 IOR #11 ADD =state
|
||||||
|
|
||||||
|
@ -33,7 +37,7 @@ BRK
|
||||||
@no-touch
|
@no-touch
|
||||||
|
|
||||||
( draw mouse )
|
( draw mouse )
|
||||||
~state ,cursor_icn ~mousex ~mousey ,draw-sprite JSR
|
~state ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue