home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d09xx
/
d0916.lha
/
ScreenMode
/
source
/
Example.c
next >
Wrap
C/C++ Source or Header
|
1993-10-04
|
4KB
|
114 lines
#include <exec/types.h>
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/intuition_protos.h>
#include <clib/graphics_protos.h>
#include <stdio.h>
#define USM_ERRTXT //--- use the error-text
#include "UserScreenMode.h"
#define INTL struct IntuitionBase *
#define GFXL struct GfxBase *
#define LIBL struct Library *
GFXL GfxBase; //---> Those must be defined,
INTL IntuitionBase; //---> not necessaryly opened.
LIBL GadToolsBase; //---> -*-
PRPT proplist[] =
{ //--- name[16], include, exclude (see graphics/displayinfo.h)
//---------------------------------------------------------------------------
{ "ALL", ~0L, 0L },
{ "PAL ONLY", DIPF_IS_PAL, 0L },
{ "WORKBENCH", DIPF_IS_WB, 0L },
{ "LACE", DIPF_IS_LACE, 0L },
{ "HAM/NOLACE", DIPF_IS_HAM, DIPF_IS_LACE },
{ "NO HAM/EHB", ~0L, DIPF_IS_HAM|DIPF_IS_EXTRAHALFBRITE },
{ "ECS/AA", DIPF_IS_ECS|DIPF_IS_AA, 0L },
{ "FOREIGN", DIPF_IS_FOREIGN, 0L },
};
PRPT *plist[] = //---> this list must be passed!
{
&proplist[0],
&proplist[1],
&proplist[2],
&proplist[3],
&proplist[4],
&proplist[5],
&proplist[6],
&proplist[7],
NULL //---> end with a NULL pointer!
};
UWORD pens1[] = { 1,0,~0 };
UWORD pens2[] = { 1,0,1,2,1,3,1,0,1,~0 };
//-------------------------------------------------------- main
void main(int argc,char **argv)
{
struct Screen *scr;
SCRMODE scrmode;
UWORD *pens;
int testing = 1;
if (GfxBase = (GFXL)OpenLibrary("graphics.library",37))
{
if (IntuitionBase = (INTL)OpenLibrary("intuition.library",37))
{
if (UserScreenMode(NULL,&scrmode,plist))
{
while (testing)
{
pens = (scrmode.Depth) == 1 ? pens1 : pens2;
if (scr = OpenScreenTags (NULL,
SA_Width, scrmode.Width,
SA_Height, scrmode.Height,
SA_Depth, scrmode.Depth,
SA_DisplayID, scrmode.ModeID,
SA_Overscan, scrmode.OScan,
SA_FullPalette, TRUE,
SA_SysFont, 1L,
SA_Type, PUBLICSCREEN,
SA_AutoScroll, TRUE,
SA_PubName, "TestScreen",
SA_Pens, pens,
TAG_END))
{
//-------- show palette
{ register WORD y,w=scrmode.Width-1;
for (y=0; y<scrmode.Height; y++)
{ SetAPen(&scr->RastPort,y);
Move(&scr->RastPort,0,y);
Draw(&scr->RastPort,w,y);
}
}
PubScreenStatus(scr,0);
if (!UserScreenMode("TestScreen",&scrmode,plist))
{
if (USM_Error) printf("ERROR: %s\n",USM_ErrorTxt[USM_Error]);
testing = 0;
}
CloseScreen(scr);
}
else
{
printf("ERROR: Can't open screen.\n");
testing = 0;
}
}
}
else if (USM_Error) printf("ERROR: %s.\n",USM_ERROR);
CloseLibrary((LIBL)IntuitionBase);
}
CloseLibrary((LIBL)GfxBase);
}
}