Skip to content

Commit

Permalink
scroll wheel for viewports
Browse files Browse the repository at this point in the history
change rec-shell so that shell commands have to be on the start of the line
  • Loading branch information
forthy42 committed Jun 21, 2018
1 parent fdc1836 commit d178926
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
28 changes: 25 additions & 3 deletions minos2/actors.fs
Expand Up @@ -251,12 +251,20 @@ screen-pwh max s>f FValue drag-rate \ 1 screen/s²
: motion-time ( -- time )
motion-dxy vmotion-dt drag-rate f* f/ ;

: vp-deltaxy ( time -- rx ry )
fdup vmotion-dx f* vpstart-x fswap f-
fswap vmotion-dy f* vpstart-y f+ ;

: vp-motion ( 0..1 addr -- )
>o fdup f**2 f2/ f-
motion-dxy vmotion-dt f**2 drag-rate f* f/ f*
fdup vmotion-dx f* vpstart-x fswap f-
fswap vmotion-dy f* vpstart-y f+
vp-setxy o> ;
vp-deltaxy vp-setxy o> ;

forward sin-t

: vp-scroll ( 0..1 addr -- )
>o sin-t fdup to vmotion-dt
vp-deltaxy vp-setxy o> ;

forward anim-del
forward >animate
Expand All @@ -282,6 +290,20 @@ forward >animate
THEN EXIT THEN
THEN
THEN
over $18 and over 1 and 0= and IF
set-startxy
dup 2 = IF
0e fdup to vmotion-dx
ELSE
vmotion-dt vmotion-dy f*
THEN to vmotion-dy 0e to vmotion-dt
o anim-del
caller-w .vp-w 32e f/ fm*
dup
$08 and IF fdup +to vmotion-dy THEN fnegate
$10 and IF fdup +to vmotion-dy THEN fdrop fdrop fdrop
0.333e o ['] vp-scroll >animate
EXIT THEN
caller-w >o
tx [: act >o [ box-actor :: clicked ] o> ;] vp-needed
vp-need-or o> ; vp-actor is clicked
Expand Down
8 changes: 5 additions & 3 deletions script.fs
Expand Up @@ -21,10 +21,12 @@
: system, slit, postpone >system ;
' >system ' system, ' slit, rectype: rectype-eval

: rec-shell ( addr u -- addr u' r:string )
: rec-shell ( addr u -- addr u' rectype-eval | rectype-null )
\G evaluate string + rest of command line
drop source drop - >in ! source >in @ /string dup >in +!
rectype-eval ;
over source drop = IF
drop source drop - >in ! source >in @ /string dup >in +!
rectype-eval
ELSE 2drop rectype-null THEN ;
' rec-shell get-recognizers 1+ set-recognizers

User sh$ cell uallot drop
Expand Down

0 comments on commit d178926

Please sign in to comment.