diff --git a/ueforth/Makefile b/ueforth/Makefile index 7efa973..80e08db 100644 --- a/ueforth/Makefile +++ b/ueforth/Makefile @@ -190,7 +190,8 @@ COMMON_PHASE2 = common/tasks.fs common/utils.fs common/locals.fs \ common/filetools.fs common/including.fs \ common/streams.fs common/blocks.fs -COMMON_DESKTOP = common/ansi.fs common/desktop.fs common/grf.fs common/heart.fs +COMMON_DESKTOP = common/ansi.fs common/desktop.fs \ + common/grf.fs common/grf_utils.fs common/heart.fs POSIX_BOOT = $(COMMON_PHASE1) \ posix/posix.fs posix/allocation.fs posix/termios.fs \ diff --git a/ueforth/common/grf.fs b/ueforth/common/grf.fs index d401213..55fb318 100644 --- a/ueforth/common/grf.fs +++ b/ueforth/common/grf.fs @@ -54,7 +54,6 @@ vocabulary internals 0 value event 0 value width 0 value height -0 value color internals definitions @@ -64,25 +63,6 @@ grf definitions also internals : pixel ( w h -- a ) width * + 4* backbuffer + ; -internals definitions - -: hline { x y w } - x y pixel w 1- for color over l! 4 + next drop ; - -grf definitions also internals - -: box { left top w h } - left w + top h + { right bottom } - left 0 max to left - top 0 max to top - right width min to right - bottom height min to bottom - left right >= top bottom >= or if exit then - right left - to w - bottom top - to h - top h 1- for left over w hline 1+ next drop -; - -( Rest of definitions per platform. ) +( Rest of the core definitions per platform. ) only forth definitions diff --git a/ueforth/common/grf_utils.fs b/ueforth/common/grf_utils.fs new file mode 100644 index 0000000..8a8d64b --- /dev/null +++ b/ueforth/common/grf_utils.fs @@ -0,0 +1,44 @@ +\ Copyright 2022 Bradley D. Nelson +\ +\ Licensed under the Apache License, Version 2.0 (the "License"); +\ you may not use this file except in compliance with the License. +\ You may obtain a copy of the License at +\ +\ http://www.apache.org/licenses/LICENSE-2.0 +\ +\ Unless required by applicable law or agreed to in writing, software +\ distributed under the License is distributed on an "AS IS" BASIS, +\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +\ See the License for the specific language governing permissions and +\ limitations under the License. + +( Graphics Utilities ) +\ Pen: +\ ( n ) to color +\ Drawing: +\ box ( x y w h -- ) + +grf definitions + +0 value color + +internals definitions + +: hline { x y w } + x y pixel w 1- for color over l! 4 + next drop ; + +grf definitions also internals + +: box { left top w h } + left w + top h + { right bottom } + left 0 max to left + top 0 max to top + right width min to right + bottom height min to bottom + left right >= top bottom >= or if exit then + right left - to w + bottom top - to h + top h 1- for left over w hline 1+ next drop +; + +only forth definitions diff --git a/ueforth/common/heart.fs b/ueforth/common/heart.fs index cbba7aa..2f34f81 100644 --- a/ueforth/common/heart.fs +++ b/ueforth/common/heart.fs @@ -12,6 +12,10 @@ \ See the License for the specific language governing permissions and \ limitations under the License. +( Graphics Heart ) +\ Drawing: +\ heart ( x y h -- ) + grf internals definitions \ For t = 0 to 2pi