Added field accessors.

This commit is contained in:
Brad Nelson
2024-11-30 23:21:34 -08:00
parent 9ae74fa183
commit 0823c179fa
7 changed files with 106 additions and 45 deletions

View File

@ -15,7 +15,7 @@
( Expand Graphics for Windows )
graphics internals definitions
also windows
also windows also structures
z" GrfClass" constant GrfClassName
z" uEforth" constant GrfWindowTitle
@ -35,12 +35,12 @@ cell allocate throw to backbuffer
backbuffer w h * 4* resize throw to backbuffer
backbuffer w h * 4* 255 fill
binfo BITMAPINFO erase
BITMAPINFOHEADER binfo ->bmiHeader ->biSize l!
w binfo ->bmiHeader ->biWidth l!
h negate binfo ->bmiHeader ->biHeight l!
1 binfo ->bmiHeader ->biPlanes w!
32 binfo ->bmiHeader ->biBitCount w!
BI_RGB binfo ->bmiHeader ->biCompression l!
BITMAPINFOHEADER binfo ->bmiHeader !field ->biSize
w binfo ->bmiHeader !field ->biWidth
h negate binfo ->bmiHeader !field ->biHeight
1 binfo ->bmiHeader !field ->biPlanes
32 binfo ->bmiHeader !field ->biBitCount
BI_RGB binfo ->bmiHeader !field ->biCompression
RESIZED to event
;
@ -119,6 +119,7 @@ cell allocate throw to backbuffer
graphics definitions
also internals
also windows
also structures
: window { width height }
width 0< { fullscreen }
@ -128,11 +129,11 @@ also windows
1 1 rescale
pad WINDCLASSA erase
WindowProcShim pad ->lpfnWndProc !
hinstance pad ->hInstance !
GrfClassName pad ->lpszClassName !
NULL IDC_ARROW LoadCursorA pad ->hCursor !
hinstance IDI_MAIN_ICON LoadIconA pad ->hIcon !
WindowProcShim pad !field ->lpfnWndProc
hinstance pad !field ->hInstance
GrfClassName pad !field ->lpszClassName
NULL IDC_ARROW LoadCursorA pad !field ->hCursor
hinstance IDI_MAIN_ICON LoadIconA pad !field ->hIcon
pad RegisterClassA to GrfClass
0 GrfClass GrfWindowTitle WS_OVERLAPPEDWINDOW
@ -161,7 +162,7 @@ also windows
event FINISHED = if exit then
IDLE to event
msgbuf NULL 0 0 PM_REMOVE PeekMessageA if
WM_QUIT msgbuf ->message ul@ = if
WM_QUIT msgbuf @field ->message = if
FINISHED to event
exit
then

View File

@ -46,10 +46,10 @@ $80000013 constant DC_PEN
z" StretchDIBits" 13 Gdi32 StretchDIBits
struct RGBQUAD
i8 field ->rgbBlue
i8 field ->rgbGreen
i8 field ->rgbRed
i8 field ->rgbReserved
u8 field ->rgbBlue
u8 field ->rgbGreen
u8 field ->rgbRed
u8 field ->rgbReserved
struct BITMAPINFOHEADER
i16 field ->biSize
i32 field ->biWidth

View File

@ -12,7 +12,7 @@
\ See the License for the specific language governing permissions and
\ limitations under the License.
also windows also internals
also windows also internals also structures
z" MyClass" constant MyClassName
z" Test Window" constant MyWindowTitle
@ -20,11 +20,11 @@ z" Test Window" constant MyWindowTitle
NULL GetModuleHandleA constant hinst
pad WINDCLASSA erase
WindowProcShim pad ->lpfnWndProc !
hinst pad ->hInstance !
MyClassName pad ->lpszClassName !
NULL IDC_ARROW LoadCursorA pad ->hCursor !
hinst IDI_MAIN_ICON LoadIconA pad ->hIcon !
WindowProcShim pad !field ->lpfnWndProc
hinst pad !field ->hInstance
MyClassName pad !field ->lpszClassName
NULL IDC_ARROW LoadCursorA pad !field ->hCursor
hinst IDI_MAIN_ICON LoadIconA pad !field ->hIcon
pad RegisterClassA constant myclass
create ps PAINTSTRUCT allot
@ -42,8 +42,8 @@ side 0 0 200 100 SetRect
then
WM_PAINT msg = if
hwnd ps BeginPaint drop
ps ->hdc @ ps ->rcPaint orange FillRect drop
ps ->hdc @ side green FillRect drop
ps @field ->hdc ps ->rcPaint orange FillRect drop
ps @field ->hdc side green FillRect drop
hwnd ps EndPaint drop
0 exit
then
@ -61,7 +61,7 @@ hwnd SetForegroundWindow drop
create mymsg msg allot
: pump
begin mymsg NULL 0 0 GetMessageA while
\ mymsg ->message @ WM_>name type cr
\ mymsg @field ->message WM_>name type cr
mymsg TranslateMessage drop
mymsg DispatchMessageA drop
repeat

View File

@ -134,7 +134,7 @@ struct PAINTSTRUCT
RECT field ->rcPaint
i32 field ->fRestore
i32 field ->fIncUpdate
32 i8 * field ->rgbReserved
32 u8 * field ->rgbReserved
z" FillRect" 3 User32 FillRect
z" PostQuitMessage" 1 User32 PostQuitMessage