/* Blackscreen.c - Rob Freundlich */

/* This program is hereby released to the world at large.  Do whatever you want with it. */

#include <stdio.h>

#include <dos/dos.h>
#include <exec/types.h>
#include <intuition/intuition.h>
#include <intuition/screens.h>

#include <clib/dos_protos.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>

struct Library *IntuitionBase;

int main()
{
	struct Screen *s;
	struct ColorSpec cspec[] = {
		{0,0,0,0},
		{0,0,0,0},
		{-1,0,0,0},
	};
	struct Window *w;

	if (IntuitionBase = OpenLibrary("intuition.library",37)) {
		if (s = OpenScreenTags(NULL,
				SA_Depth,1,
				SA_Colors, cspec,
				TAG_DONE)) {
			if (w = OpenWindowTags(NULL,
					WA_CustomScreen,	s,
					WA_Left,	0,
					WA_Top,		0,
					WA_Width,		s->Width,
					WA_Height,	s->Height,
					WA_Flags,		WFLG_BORDERLESS|WFLG_CLOSEGADGET,
					WA_IDCMP,		IDCMP_CLOSEWINDOW,
					TAG_DONE)) {
				struct IntuiMessage *msg;

				WaitPort(w->UserPort);
				msg = (struct IntuiMessage *)GetMsg(w->UserPort);
				ReplyMsg((struct Message *)msg);
				CloseWindow(w);
			}
			else printf("Couldn't open window.\n");
			CloseScreen(s);
		}
		else printf("Couldn't open screen.\n");
		CloseLibrary(IntuitionBase);
	}
	else printf("Couldn't open intuition.library v37\n");
	return 0;
}

