Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Simple screen and window demo
- Loading branch information
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |