mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-16 03:42:35 +03:00
31a4eb5247
git-svn-id: svn://kolibrios.org@6613 a494cfbc-eb01-0410-851d-a64ba20cac60
54 lines
1.3 KiB
Plaintext
54 lines
1.3 KiB
Plaintext
MODULE HW;
|
|
|
|
IMPORT sys := SYSTEM, KOSAPI;
|
|
|
|
PROCEDURE WindowRedrawStatus(p: INTEGER);
|
|
VAR res: INTEGER;
|
|
BEGIN
|
|
res := KOSAPI.sysfunc2(12, p)
|
|
END WindowRedrawStatus;
|
|
|
|
PROCEDURE DefineAndDrawWindow(x, y, w, h, color, style, hcolor, hstyle, htext: INTEGER);
|
|
VAR res: INTEGER;
|
|
BEGIN
|
|
res := KOSAPI.sysfunc6(0, x * 65536 + w, y * 65536 + h, color + LSL(style, 24), hcolor + LSL(hstyle, 24), htext)
|
|
END DefineAndDrawWindow;
|
|
|
|
PROCEDURE WriteTextToWindow(x, y, color: INTEGER; text: ARRAY OF CHAR);
|
|
VAR res: INTEGER;
|
|
BEGIN
|
|
res := KOSAPI.sysfunc6(4, x * 65536 + y, color + LSL(48, 24), sys.ADR(text[0]), LENGTH(text), 0)
|
|
END WriteTextToWindow;
|
|
|
|
PROCEDURE WaitForEvent(): INTEGER;
|
|
RETURN KOSAPI.sysfunc1(10)
|
|
END WaitForEvent;
|
|
|
|
PROCEDURE ExitApp;
|
|
VAR res: INTEGER;
|
|
BEGIN
|
|
res := KOSAPI.sysfunc1(-1)
|
|
END ExitApp;
|
|
|
|
PROCEDURE draw_window(header, text: ARRAY OF CHAR);
|
|
BEGIN
|
|
WindowRedrawStatus(1);
|
|
DefineAndDrawWindow(200, 200, 200, 100, 0FFFFFFH, 51, 0, 0, sys.ADR(header));
|
|
WriteTextToWindow(10, 10, 0FF0000H, text);
|
|
WindowRedrawStatus(2);
|
|
END draw_window;
|
|
|
|
PROCEDURE Main(header, text: ARRAY OF CHAR);
|
|
BEGIN
|
|
WHILE TRUE DO
|
|
CASE WaitForEvent() OF
|
|
|1: draw_window(header, text)
|
|
|3: ExitApp
|
|
ELSE
|
|
END
|
|
END
|
|
END Main;
|
|
|
|
BEGIN
|
|
Main("HW", "Hello, world!")
|
|
END HW. |