Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Simple screen and window demo
  • Loading branch information
steffest committed Oct 24, 2017
1 parent acdac49 commit c034460
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
31 changes: 31 additions & 0 deletions screen/screen.c
@@ -0,0 +1,31 @@
#include <proto/intuition.h>
#include <proto/dos.h>
#include <intuition/screens.h>

#define SCREENWIDTH 320
#define SCREENHEIGHT 200

#define PLANES 5 // 32 colors

#define LORES 0

int main() {
struct NewScreen screenProperties = {
0,0,SCREENWIDTH,SCREENHEIGHT,PLANES,
DETAILPEN, BLOCKPEN,
LORES,
CUSTOMSCREEN | CUSTOMBITMAP,
NULL,
"My Screen",
NULL,
NULL
};
struct Screen *myScreen;
myScreen = OpenScreen(&screenProperties);
ShowTitle(myScreen, FALSE);
Delay(100);
DisplayBeep(myScreen);
Delay(10);
if (myScreen) CloseScreen(myScreen);
return(0);
}
56 changes: 56 additions & 0 deletions window/window.c
@@ -0,0 +1,56 @@
#include <proto/all.h>
#include <exec/types.h>
#include <intuition/intuition.h>
#include <libraries/dos.h>
#include <stdlib.h>

#define screenWidth 320
#define screenHeight 200
#define screenLeft 0
#define screenTop 0

int main() {
struct Window *myWindow;
int hasEnded = FALSE;
struct IntuiMessage *msg;
ULONG msgClass;

// open window on the public workbench screen
struct NewWindow winlayout = {
screenLeft, screenTop,
screenWidth, screenHeight,
0,1,
IDCMP_CLOSEWINDOW,
WFLG_SIZEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_ACTIVATE,
NULL, NULL,
"It's me!",
NULL,NULL,
0,0,
600,400,
WBENCHSCREEN
};
myWindow = OpenWindow(&winlayout);

Move(myWindow->RPort, 40, 40);
Text(myWindow->RPort, "Hello!", 6);

while (hasEnded == FALSE) {
// wait for and event
Wait(1L << myWindow->UserPort->mp_SigBit);

// get message
msg = GT_GetIMsg(myWindow->UserPort);

// get class of message;
msgClass = msg->Class;

// handle message (close it);
GT_ReplyIMsg(msg);

if (msgClass == IDCMP_CLOSEWINDOW) {
CloseWindow(myWindow);
hasEnded = TRUE;
}
}
return(0);
}

0 comments on commit c034460

Please sign in to comment.