palmunits: updated hello example, so no coordinates are hardwired. added a copyright header

git-svn-id: trunk@37923 -
This commit is contained in:
Károly Balogh 2018-01-06 15:52:52 +00:00
parent 81b2cf5d65
commit d04a4f3ec3

View File

@ -1,24 +1,47 @@
{
Copyright (c) 2018 Karoly Balogh
Simple "Hello, World!" alike program for PalmOS
Example program for Free Pascal's PalmOS bindings
This example program is in the Public Domain under the terms of
Unlicense: http://unlicense.org/
**********************************************************************}
{$APPID FPHL}
{$APPNAME Hello, FPC}
program hello;
uses
event_, sysevent, systemmgr, window;
event_, sysevent, systemmgr, window, font;
const
message = 'FPC says: Hello, Palm!';
procedure PaintMessage;
var
w, h: smallint;
tw, th: smallint;
begin
tw:=FntCharsWidth(message, length(message));
th:=FntLineHeight;
WinGetWindowExtent(w, h);
WinDrawChars(message, length(message), (w-tw) div 2, (h-th) div 2);
end;
procedure EventLoop;
var
event: EventType;
begin
repeat
PaintMessage;
EvtGetEvent(event, evtWaitForever);
SysHandleEvent(event);
until (event.eType = appStopEvent);
end;
begin
WinDrawChars(message, length(message), 35, 74);
EventLoop;
end.