mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-27 08:13:01 +00:00
Noodle drawing from brush size
This commit is contained in:
parent
4633fcf920
commit
261364f20e
2 changed files with 40 additions and 15 deletions
2
build.sh
2
build.sh
|
@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr
|
||||||
# cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator
|
# cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator
|
||||||
|
|
||||||
# run
|
# run
|
||||||
./bin/assembler projects/software/nasu.usm bin/boot.rom
|
./bin/assembler projects/software/noodle.usm bin/boot.rom
|
||||||
./bin/emulator bin/boot.rom
|
./bin/emulator bin/boot.rom
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
app/noodle : illustration program
|
app/noodle : illustration program
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
- Only redraw when mouse has changed
|
- Only draw-canvas when mouse has changed
|
||||||
- Only redraw target tile
|
- Only draw-canvas target tile
|
||||||
)
|
)
|
||||||
|
|
||||||
%RTN { JMP2r }
|
%RTN { JMP2r }
|
||||||
|
@ -18,12 +18,14 @@
|
||||||
;cursor { x 2 y 2 }
|
;cursor { x 2 y 2 }
|
||||||
;rect { x1 2 y1 2 x2 2 y2 2 }
|
;rect { x1 2 y1 2 x2 2 y2 2 }
|
||||||
;color { byte 1 }
|
;color { byte 1 }
|
||||||
;pt { x 2 y 2 }
|
;pos { x 2 y 2 }
|
||||||
|
;pix { x 2 y 2 }
|
||||||
|
;px { x 1 y 1 }
|
||||||
;label { x 2 y 2 color 1 addr 2 } ( remove )
|
;label { x 2 y 2 color 1 addr 2 } ( remove )
|
||||||
|
|
||||||
|0100 @RESET
|
|0100 @RESET
|
||||||
|
|
||||||
#0008 =toolbar.x #0068 =toolbar.y
|
#0038 =toolbar.x #0098 =toolbar.y
|
||||||
|
|
||||||
#0010 =canvas.x1 #0020 =canvas.y1
|
#0010 =canvas.x1 #0020 =canvas.y1
|
||||||
#0026 =canvas.w #0010 =canvas.h ,fit JSR2
|
#0026 =canvas.w #0010 =canvas.h ,fit JSR2
|
||||||
|
@ -44,6 +46,8 @@ BRK
|
||||||
|
|
||||||
~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint JSR2
|
~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint JSR2
|
||||||
|
|
||||||
|
,draw-canvas JSR2
|
||||||
|
|
||||||
$no-paint
|
$no-paint
|
||||||
|
|
||||||
$no-touch
|
$no-touch
|
||||||
|
@ -52,19 +56,40 @@ BRK
|
||||||
|
|
||||||
@paint ( x y )
|
@paint ( x y )
|
||||||
|
|
||||||
=pt.y =pt.x
|
#0004 SUB2 =pos.y #0004 SUB2 =pos.x
|
||||||
|
|
||||||
( get tile addr ) ,data ~pt.x 8/ ~pt.y 8/ ~canvas.w MUL2 ADD2 8* ~pt.y MOD8 ADD2 ADD2
|
#00 =px.x #00 =px.y
|
||||||
|
$ver
|
||||||
|
#00 =px.x
|
||||||
|
$hor
|
||||||
|
( get bit )
|
||||||
|
,size1_icn #00 ~px.y ADD2 LDR #07 ~px.x SUB SHR #01 AND ( get bit )
|
||||||
|
|
||||||
|
#00 EQU ,$no-pixel ROT JMP2?
|
||||||
|
~pos.x #00 ~px.x ADD2 ~pos.y #00 ~px.y ADD2 ,add-pixel JSR2
|
||||||
|
$no-pixel
|
||||||
|
|
||||||
( load ) DUP2 LDR
|
( incr ) ~px.x #01 ADD =px.x
|
||||||
( mask ) #01 #07 ~pt.x MOD8 SWP POP SUB SHL XOR
|
,$hor ~px.x #08 LTH JMP2?
|
||||||
( save ) ROT ROT STR
|
( incr ) ~px.y #01 ADD =px.y
|
||||||
|
,$ver ~px.y #08 LTH JMP2?
|
||||||
,redraw JSR2
|
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
@redraw
|
|
||||||
|
@add-pixel ( x y )
|
||||||
|
|
||||||
|
=pix.y =pix.x
|
||||||
|
|
||||||
|
( get tile addr ) ,data ~pix.x 8/ ~pix.y 8/ ~canvas.w MUL2 ADD2 8* ~pix.y MOD8 ADD2 ADD2
|
||||||
|
|
||||||
|
( load ) DUP2 LDR
|
||||||
|
( mask ) #01 #07 ~pix.x MOD8 SWP POP SUB SHL XOR
|
||||||
|
( save ) ROT ROT STR
|
||||||
|
|
||||||
|
RTN
|
||||||
|
|
||||||
|
@draw-canvas
|
||||||
|
|
||||||
~canvas.y1 =Sprite.y
|
~canvas.y1 =Sprite.y
|
||||||
,data =Sprite.addr
|
,data =Sprite.addr
|
||||||
|
@ -143,7 +168,7 @@ RTN
|
||||||
~canvas.w 8* ~canvas.x1 ADD2 =canvas.x2
|
~canvas.w 8* ~canvas.x1 ADD2 =canvas.x2
|
||||||
~canvas.h 8* ~canvas.y1 ADD2 =canvas.y2
|
~canvas.h 8* ~canvas.y1 ADD2 =canvas.y2
|
||||||
~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #01 ,line-rect JSR2
|
~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #01 ,line-rect JSR2
|
||||||
,redraw JSR2
|
,draw-canvas JSR2
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
|
@ -200,7 +225,7 @@ RTN
|
||||||
@mode_zoomin [ 3245 8284 4834 0200 ]
|
@mode_zoomin [ 3245 8284 4834 0200 ]
|
||||||
|
|
||||||
@blank_icn [ 0000 0000 0000 0000 ]
|
@blank_icn [ 0000 0000 0000 0000 ]
|
||||||
@filepath [ projects/drawings/hello.chr 00 ]
|
@filepath [ projects/drawings/wtf.chr 00 ]
|
||||||
|
|
||||||
@font ( specter8-frag font )
|
@font ( specter8-frag font )
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in a new issue