summaryrefslogtreecommitdiff
path: root/packages/extra/amunits/otherlibs/picasso/examples/requestmodeid.pas
blob: 2765342b4e8e9caedea570ad892f808ad1f828e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Program RequestModeID;


{ ***********************************************************************
  * This is example shows how to use p96RequestModeIDTagList()
  *
  * tabt (Sat Dec 28 03:44:35 1996)
  *********************************************************************** }

{
    Translated to fpc pascal.
    3 Mars 2001.

    Updated for fpc 1.0.7
    08 Jan 2003.

    nils.sjoholm@mailbox.swipnet.se
}

uses exec, amigados, graphics, intuition, picasso96api, utility;

Const
    template    :   pchar = 'Width=W/N,Height=H/N,Depth=D/N';

    vecarray    :   Array[0..2] of longint = (0,0,0);

Var
    width,
    height,
    depth,
    DisplayID   :   longint;
    dim         :   tDimensionInfo;
    rda         :   pRDArgs;


Begin
    width:=640;
    height:=480;
    depth:=15;

    rda:=ReadArgs (template,@vecarray,Nil);
    If rda<>Nil Then Begin
       If vecarray[0] <> 0 then width := long(@vecarray[0]);
       If vecarray[1] <> 0 then height := long(@vecarray[1]);
       If vecarray[2] <> 0 then depth := long(@vecarray[2]);
       FreeArgs(rda);
    End;

    DisplayID := p96RequestModeIDTags([P96MA_MinWidth, width,
                                       P96MA_MinHeight, height,
                                       P96MA_MinDepth, depth,
                                       P96MA_WindowTitle, 'RequestModeID Test',
                                       P96MA_FormatsAllowed, (RGBFF_CLUT or RGBFF_R5G6B5 or RGBFF_R8G8B8 or RGBFF_A8R8G8B8),
                                       TAG_DONE]);

    Writeln ('DisplayID:', hexstr(DisplayID,8));

    If DisplayID <> INVALID_ID Then Begin
        If GetDisplayInfoData(Nil, @dim ,SizeOf(tDimensionInfo),DTAG_DIMS,DisplayID) <> 0 Then
            Writeln('Dimensions: ',dim.Nominal.MaxX-dim.Nominal.MinX+1,'x',dim.Nominal.MaxY-dim.Nominal.MinY+1,'x',dim.MaxDepth)
        Else
            Writeln('No Dimensioninfo.');
    End Else Writeln('DisplayID invalid.');
End.