\ graphics 98.11.18 5:09 pm NAB
: line ( y2 x2 y1 x1 --) WinDrawLine ;
: point ( y x -- ) 2dup WinDrawLine ;
variable cx variable cy
: rpoint ( y x --)
cx @ + swap cy @ + swap point ;
: point2 ( y x -- y x)
2dup 2dup swap rpoint rpoint ;
: point4 ( y x -- y -x)
point2 negate point2 ;
: point8 ( y x --)
point4 swap negate swap point4
2drop ;
: circle ( radius cy cx --)
cx ! cy !
dup negate >r 0 swap
begin
2dup > invert while
2dup point8
over 2* 1+ r> + >r
r@ 0 > if 1- r> over 2* - >r then
swap 1+ swap
repeat 2drop r> drop ;
: rounded-rectangle
( height width y x corner-radius --)
>r sp@ r> rot rot
WinDrawRectangle
2drop 2drop ;
: rectangle ( height width y x --)
0 rounded-rectangle ;
: erase-rounded-rectangle
( height width y x corner-radius -- )
>r sp@ r> rot rot
WinEraseRectangle 2drop 2drop ;
: erase-rectangle
( height width y x --)
0 erase-rounded-rectangle ;
create fb 4 cells allot
: frame
( height width y x frame-type --)
>r fb ! fb cell+ ! fb 2 cells + !
fb 3 cells + ! fb >abs
r> WinDrawRectangleFrame ;
\ Frame types:
(hex) 0000 constant noFrame
(hex) 0001 constant simpleFrame
(hex) 0001 constant rectangleFrame
(hex) 0401 constant roundFrame
(hex) 0702
constant boldRoundFrame
(hex) 0205 constant popupFrame
(hex) 0302 constant dialogFrame
popupFrame constant menuFrame
: at ( y x --) currentx ! currenty ! ;
: cursor-position ( -- y x )
currenty @ currentx @ ;