Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
emartisoft committed Oct 12, 2016
1 parent da9ec4f commit 657e0ab
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 0 deletions.
Binary file added 01_Window/01_window.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 01_Window/Project
Binary file not shown.
Binary file added 01_Window/Project.info
Binary file not shown.
19 changes: 19 additions & 0 deletions 01_Window/makefile
@@ -0,0 +1,19 @@
#
# Target OS: Amiga OS3.X
# Compiler : GCC
#

objects = project.o
appname = Project
#option = -O3 -m68030
option = -O3 -m68030 -noixemul

project: $(objects)
gcc -o $(appname) $(objects) $(option)

project.o: project.c project.h
gcc -c project.c $(option)

clean:
rm $(objects) $(appname)

62 changes: 62 additions & 0 deletions 01_Window/project.c
@@ -0,0 +1,62 @@
#include "project.h"

int main(int argc,char *argv[])
{
Object *app,*win1;
ULONG signals;
BOOL running = TRUE;

if (!Open_Libs())
{
printf("Cannot open libs\n");
return(0);
}

app = ApplicationObject,
MUIA_Application_Title , "Project",
MUIA_Application_Version , "$VER: Project X.X (XX.XX.XX)",
MUIA_Application_Copyright , " ",
MUIA_Application_Author , " ",
MUIA_Application_Description, " ",
MUIA_Application_Base , " ",

MUIA_Application_Window, win1 = WindowObject,
MUIA_Window_Title, "Window Title",
MUIA_Window_ID , MAKE_ID('E','M','R','T'),
WindowContents, VGroup,
Child, MUI_MakeObject(MUIO_Label,"I am MUI Application on Amiga 3.X",NULL),
End,
End,
End;

if (!app)
{
printf("Cannot create application.\n");
return(0);
}

DoMethod(win1, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);

set(win1,MUIA_Window_Open,TRUE);// open window

while(running)
{
ULONG id = DoMethod(app,MUIM_Application_Input,&signals);

switch(id)
{
case MUIV_Application_ReturnID_Quit:
if((MUI_RequestA(app,0,0,"Quit?","_Yes|_No","\33cAre you sure?",0)) == 1)
running = FALSE;
break;
}
if(running && signals) Wait(signals);
}

set(win1,MUIA_Window_Open,FALSE);

if(app) MUI_DisposeObject(app);
Close_Libs();
exit(TRUE);
}
51 changes: 51 additions & 0 deletions 01_Window/project.h
@@ -0,0 +1,51 @@
#include <libraries/mui.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/muimaster.h>
#include <libraries/gadtools.h>
#include <libraries/iffparse.h>
#include <stdio.h>
#include <proto/intuition.h>
#include <proto/graphics.h>

#define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))

#define IPTR ULONG

struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Library *MUIMasterBase;

BOOL Open_Libs(void)
{
if ( !(IntuitionBase=(struct IntuitionBase *) OpenLibrary("intuition.library",39)) )
return(0);

if ( !(GfxBase=(struct GfxBase *) OpenLibrary("graphics.library",0)) )
{
CloseLibrary((struct Library *)IntuitionBase);
return(0);
}

if ( !(MUIMasterBase=OpenLibrary(MUIMASTER_NAME,19)) )
{
CloseLibrary((struct Library *)GfxBase);
CloseLibrary((struct Library *)IntuitionBase);
return(0);
}

return(1);
}

void Close_Libs(void)
{
if (IntuitionBase)
CloseLibrary((struct Library *)IntuitionBase);

if (GfxBase)
CloseLibrary((struct Library *)GfxBase);

if (MUIMasterBase)
CloseLibrary(MUIMasterBase);
}

Binary file added 01_Window/project.o
Binary file not shown.

0 comments on commit 657e0ab

Please sign in to comment.