alsa.audio: use correct name of libasound so file
[AROS.git] / workbench / demos / screenmodereq.c
blob572d3af58ed48deb4bf2a2292373bbb4fff50237
1 ;/* filereq.c - Execute me to compile me with SASC 5.10
2 LC -b1 -cfistq -v -y -j73 filereq.c
3 Blink FROM LIB:c.o,filereq.o TO filereq LIBRARY LIB:LC.lib,LIB:Amiga.lib
4 quit
5 */
7 /*
8 Copyright (c) 1992 Commodore-Amiga, Inc.
10 This example is provided in electronic form by Commodore-Amiga, Inc. for
11 use with the "Amiga ROM Kernel Reference Manual: Libraries", 3rd Edition,
12 published by Addison-Wesley (ISBN 0-201-56774-1).
14 The "Amiga ROM Kernel Reference Manual: Libraries" contains additional
15 information on the correct usage of the techniques and operating system
16 functions presented in these examples. The source and executable code
17 of these examples may only be distributed in free electronic form, via
18 bulletin board or as part of a fully non-commercial and freely
19 redistributable diskette. Both the source and executable code (including
20 comments) must be included, without modification, in any copy. This
21 example may not be published in printed form or distributed with any
22 commercial product. However, the programming techniques and support
23 routines set forth in these examples may be used in the development
24 of original executable software products for Commodore Amiga computers.
26 All other rights reserved.
28 This example is provided "as-is" and is subject to change; no
29 warranties are made. All use is at your own risk. No liability or
30 responsibility is assumed.
34 #include <exec/types.h>
35 #include <exec/libraries.h>
36 #include <graphics/displayinfo.h>
37 #include <libraries/asl.h>
38 #ifndef __AROS__
39 #include <clib/exec_protos.h>
40 #include <clib/asl_protos.h>
41 #else
42 #include <proto/exec.h>
43 #include <proto/asl.h>
44 #endif
45 #include <stdio.h>
47 #ifdef LATTICE
48 int CXBRK(void) { return(0); } /* Disable Lattice CTRL/C handling */
49 void chkabort(void) { return; } /* really */
50 #endif
52 UBYTE *vers = "$VER: filereq 37.0";
54 #define MYLEFTEDGE 0
55 #define MYTOPEDGE 0
56 #define MYWIDTH 320
57 #define MYHEIGHT 400
59 struct Library *AslBase = NULL;
61 struct DisplayMode custommode =
63 {},
66 DTAG_DIMS,
67 0xFFFF0000,
68 TAG_SKIP,
69 sizeof(struct DimensionInfo) / sizeof(struct TagItem),
72 32,
73 32,
74 16000,
75 16000,
76 {0,0,319,199},
77 {-10,-10,329,209},
78 {-15,-15,334,214},
79 {0,0,319,199},
80 {-5,-5,324,204}
85 struct List customlist;
87 struct TextAttr mytextattr =
89 "arial.font", 13, 0, 0
92 struct TagItem smtags[] =
94 { ASLSM_TextAttr, (IPTR)&mytextattr},
95 { ASLSM_TitleText, (IPTR)"Custom Positive and Negative text" },
96 { ASLSM_PositiveText, (IPTR)"Use Screenmode" },
97 { ASLSM_NegativeText, (IPTR)"Forget it" },
98 { ASLSM_CustomSMList, (IPTR)&customlist },
99 { TAG_DONE, 0 }
102 struct TagItem smtags2[] =
104 { ASLSM_TextAttr, (IPTR)&mytextattr},
105 { ASLSM_TitleText, (IPTR)"DoOverscanType" },
106 { ASLSM_DoOverscanType, TRUE},
107 { ASLSM_CustomSMList, (IPTR)&customlist },
108 { TAG_DONE, 0 }
111 struct TagItem smtags3[] =
113 { ASLSM_TextAttr, (IPTR)&mytextattr},
114 { ASLSM_TitleText, (IPTR)"DoWidth" },
115 { ASLSM_DoWidth, TRUE},
116 { ASLSM_CustomSMList, (IPTR)&customlist },
117 { TAG_DONE, 0 }
120 struct TagItem smtags4[] =
122 { ASLSM_TextAttr, (IPTR)&mytextattr},
123 { ASLSM_TitleText, (IPTR)"DoHeight" },
124 { ASLSM_DoHeight, TRUE},
125 { ASLSM_CustomSMList, (IPTR)&customlist },
126 { TAG_DONE, 0 }
129 struct TagItem smtags5[] =
131 { ASLSM_TextAttr, (IPTR)&mytextattr},
132 { ASLSM_TitleText, (IPTR)"DoDepth" },
133 { ASLSM_DoDepth, TRUE},
134 { ASLSM_CustomSMList, (IPTR)&customlist },
135 { TAG_DONE, 0 }
138 struct TagItem smtags6[] =
140 { ASLSM_TextAttr, (IPTR)&mytextattr},
141 { ASLSM_TitleText, (IPTR)"DoAutoScroll" },
142 { ASLSM_DoAutoScroll, TRUE},
143 { ASLSM_CustomSMList, (IPTR)&customlist },
144 { TAG_DONE, 0 }
148 struct TagItem smtags7[] =
150 { ASLSM_TextAttr, (IPTR)&mytextattr},
151 { ASLSM_TitleText, (IPTR)"DoAll" },
152 { ASLSM_DoOverscanType, TRUE},
153 { ASLSM_DoWidth, TRUE},
154 { ASLSM_DoHeight, TRUE},
155 { ASLSM_DoDepth, TRUE},
156 { ASLSM_DoAutoScroll, TRUE},
157 { ASLSM_CustomSMList, (IPTR)&customlist },
158 { TAG_DONE, 0 }
161 static void showrequester(char *msg, struct TagItem *tags)
163 struct ScreenModeRequester *sm;
165 NEWLIST(&customlist);
166 custommode.dm_Node.ln_Name = "*** CUSTOM MODE ***";
167 AddTail(&customlist, &custommode.dm_Node);
169 printf("\n%s:\n",msg ? msg : "");
171 if ((sm = (struct ScreenModeRequester *)AllocAslRequest(ASL_ScreenModeRequest, tags)))
173 if (AslRequest(sm, NULL))
175 printf("\n-------------------------------------------------------\n\n");
176 printf("DisplayID = 0x%08lx\n", (long)sm->sm_DisplayID);
177 printf("DisplayWidth = %ld\n", (long)sm->sm_DisplayWidth);
178 printf("DisplayHeight = %ld\n", (long)sm->sm_DisplayHeight);
179 printf("DisplayDepth = %d\n", sm->sm_DisplayDepth);
180 printf("OverscanType = %d\n", sm->sm_OverscanType);
181 printf("AutoScroll = %d\n", sm->sm_AutoScroll);
182 printf("BitMapWidth = %ld\n", (long)sm->sm_BitMapWidth);
183 printf("BitMapHeight = %ld\n", (long)sm->sm_BitMapHeight);
185 } else printf("\nRequester was aborted\n");
186 FreeAslRequest(sm);
188 else printf("Could not alloc FileRequester\n");
191 int main(int argc, char **argv)
193 if ((AslBase = OpenLibrary("asl.library", 37L)))
195 showrequester("Default requester with no tags", NULL);
196 showrequester(NULL, smtags);
197 showrequester(NULL, smtags2);
198 showrequester(NULL, smtags3);
199 showrequester(NULL, smtags4);
200 showrequester(NULL, smtags5);
201 showrequester(NULL, smtags6);
202 showrequester(NULL, smtags7);
204 CloseLibrary(AslBase);
205 } else {
206 puts("Could not open asl.library!\n");
208 return 0;