mirror of
https://frontier.innolan.net/github/amigaos-cross-toolchain6.git
synced 2024-10-19 10:29:55 +00:00
Add MUI example. Modify install-sdk to create static library.
This commit is contained in:
1
examples/.gitignore
vendored
1
examples/.gitignore
vendored
@ -1 +1,2 @@
|
||||
hello
|
||||
hello-mui
|
||||
|
||||
@ -1,13 +1,18 @@
|
||||
CC = m68k-amigaos-gcc -noixemul -s
|
||||
CFLAGS = -Os -Wall -fomit-frame-pointer
|
||||
|
||||
all: hello
|
||||
all: hello hello-mui
|
||||
|
||||
hello: LDLIBS = -lnix13
|
||||
hello: CC += -fbaserel
|
||||
hello: CFLAGS += -m68000 -msmall-code
|
||||
hello: hello.c
|
||||
|
||||
hello-mui: CC += -fbaserel
|
||||
hello-mui: CFLAGS += -m68020 -msmall-code
|
||||
hello-mui: LDLIBS = -lmui
|
||||
hello-mui: hello-mui.c
|
||||
|
||||
clean:
|
||||
rm -f hello
|
||||
rm -f hello hello-mui
|
||||
rm -f *.o *~
|
||||
|
||||
64
examples/hello-mui.c
Normal file
64
examples/hello-mui.c
Normal file
@ -0,0 +1,64 @@
|
||||
/* Taken from: http://aros.sourceforge.net/documentation/developers/zune-application-development.php */
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <libraries/mui.h>
|
||||
|
||||
#include <proto/exec.h>
|
||||
#include <proto/intuition.h>
|
||||
#include <clib/muimaster_protos.h>
|
||||
#include <clib/alib_protos.h>
|
||||
|
||||
/* Otherwise auto open will try version 37, and muimaster.library has version
|
||||
* 19.x for MUI 3.8 */
|
||||
int __oslibversion = 0;
|
||||
|
||||
/* We don't use command line arguments. */
|
||||
int __nocommandline = 1;
|
||||
|
||||
int main(void) {
|
||||
Object *wnd, *app, *but;
|
||||
|
||||
// GUI creation
|
||||
app = ApplicationObject,
|
||||
SubWindow, wnd = WindowObject,
|
||||
MUIA_Window_Title, "Hello world!",
|
||||
WindowContents, VGroup,
|
||||
Child, TextObject,
|
||||
MUIA_Text_Contents, "\33cHello world!\nHow are you?",
|
||||
End,
|
||||
Child, but = SimpleButton("_Ok"),
|
||||
End,
|
||||
End,
|
||||
End;
|
||||
|
||||
if (app != NULL) {
|
||||
ULONG sigs = 0;
|
||||
|
||||
// Click Close gadget or hit Escape to quit
|
||||
DoMethod(wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
|
||||
(APTR)app, 2,
|
||||
MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
|
||||
|
||||
// Click the button to quit
|
||||
DoMethod(but, MUIM_Notify, MUIA_Pressed, FALSE,
|
||||
(APTR)app, 2,
|
||||
MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
|
||||
|
||||
// Open the window
|
||||
set(wnd, MUIA_Window_Open, TRUE);
|
||||
|
||||
while((LONG)DoMethod(app, MUIM_Application_NewInput, (APTR)&sigs)
|
||||
!= MUIV_Application_ReturnID_Quit) {
|
||||
if (sigs) {
|
||||
sigs = Wait(sigs | SIGBREAKF_CTRL_C);
|
||||
if (sigs & SIGBREAKF_CTRL_C)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy our application and all its objects
|
||||
MUI_DisposeObject(app);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user