Added interface for grf.

This commit is contained in:
Brad Nelson
2022-02-20 18:30:01 -08:00
parent a82c31c1cb
commit f9b64ef1d2
4 changed files with 79 additions and 2 deletions

View File

@ -186,12 +186,12 @@ $(GEN):
COMMON_PHASE1 = common/boot.fs common/conditionals.fs common/vocabulary.fs \
common/floats.fs common/structures.fs
COMMON_DESKTOP = common/ansi.fs common/desktop.fs
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
POSIX_BOOT = $(COMMON_PHASE1) \
posix/posix.fs posix/allocation.fs posix/termios.fs \
$(COMMON_PHASE2) $(COMMON_DESKTOP) \
@ -210,6 +210,7 @@ WINDOWS_BOOT = $(COMMON_PHASE1) \
windows/windows_messages.fs \
windows/allocation.fs \
$(COMMON_PHASE2) $(COMMON_DESKTOP) \
windows/grf.fs \
posix/autoboot.fs \
common/fini.fs
$(GEN)/windows_boot.h: common/source_to_string.js $(WINDOWS_BOOT) | $(GEN)

View File

@ -438,6 +438,7 @@ e: check-opcodes
;e
e: check-desktop
out: grf
check-args
check-ansi
;e
@ -457,6 +458,8 @@ DEFINED? windows [IF]
e: test-windows-forth-namespace
internals voclist
out: internals
out: grf
out: ansi
out: editor
out: streams
@ -494,6 +497,8 @@ e: test-windows-forth-namespace
e: test-posix-forth-namespace
internals voclist
out: sockets
out: internals
out: grf
out: ansi
out: editor
out: streams

51
ueforth/common/grf.fs Normal file
View File

@ -0,0 +1,51 @@
( ------------------------------------------------------------ )
\ 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.
( Generic Graphics Interface )
\ Startup:
\ window ( w h -- )
\ Drawing region:
\ pixel ( x y -- a ) (format [b g r x])
\ width ( -- n )
\ height ( -- n )
\ flip ( -- )
\ Getting events:
\ wait ( -- )
\ poll ( -- )
\ Event info:
\ mouse-x ( -- n )
\ mouse-y ( -- n )
\ last-key ( -- n )
\ last-keysym ( -- n )
\ last-keycode ( -- n )
\ event ( -- n )
\ Event constants:
\ UNKNOWN TIMEOUT RESIZE EXPOSE
\ MOTION PRESS RELEASE
vocabulary grf grf definitions
vocabulary internals
0 constant UNKNOWN
1 constant TIMEOUT
2 constant RESIZE
3 constant EXPOSE
4 constant MOTION
5 constant PRESS
6 constant RELEASE
( Rest of definitions per platform. )
forth definitions

20
ueforth/windows/grf.fs Normal file
View File

@ -0,0 +1,20 @@
( ------------------------------------------------------------ )
\ 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.
( Expand Graphics for Windows )
grf internals definitions
forth definitions