4
{ ***********************************************************************
5
* This is an example that shows how to open a p96 PIP Window
6
* to get input events and how to paint in that window.
8
*********************************************************************** }
11
Translated to fpc pascal.
17
nils.sjoholm@mailbox.swipnet.se
20
uses exec, amigados, graphics, intuition, picasso96api, utility,strings;
24
WB : Pchar = 'Workbench';
25
template : Pchar = 'Width=W/N,Height=H/N,Pubscreen=PS/K';
26
vecarray : Array[0..2] of long = (0,0,0);
29
PubScreenName : Array [0..80] Of Char;
43
StrCopy(@PubScreenName,WB);
45
rda:=ReadArgs(template,@vecarray,Nil);
46
If rda<>Nil Then Begin
47
If vecarray[0] <> 0 then width := long(@vecarray[0]);
48
If vecarray[1] <> 0 then height := long(@vecarray[1]);
49
If vecarray[2] <> 0 then StrCopy(@PubScreenName,@vecarray[2]);
54
wd := p96PIP_OpenTags([P96PIP_SourceFormat, long(RGBFB_R5G5B5),
55
P96PIP_SourceWidth,256,
56
P96PIP_SourceHeight,256,
57
WA_Title,'Picasso96 API PIP Test',
64
WA_SimpleRefresh,lTRUE,
67
WA_IDCMP,IDCMP_CLOSEWINDOW,
68
WA_PubScreenName,@PubScreenName,
71
If wd <> Nil Then Begin
75
p96PIP_GetTags(wd,[P96PIP_SourceRPort, @rp, TAG_END]);
77
For y:=0 To (Height-1) Do
78
For x:=0 To (Width-1) Do
79
p96WritePixel (rp,x,y,(x*256+y)*256);
80
End Else Writeln ('No PIP rastport.');
81
While goahead Do Begin
82
WaitPort (wd^.UserPort);
83
imsg := pIntuiMessage(GetMsg (wd^.UserPort));
84
While imsg<>Nil Do Begin
85
If imsg^.IClass=IDCMP_CLOSEWINDOW Then goahead:=False;
86
ReplyMsg (pMessage(imsg));
87
imsg:=pIntuiMessage(GetMsg (wd^.UserPort));
91
End Else Writeln ('Unable to open PIP.');