OK I am finally getting somewhere now. I decided to begin with learning MUI instead of Reaction, as I can't find any documentation on Reaction.
I have successfully made a program which opens some libraries including muimaster, generates some objects, enters a loop and closes them. However there is one 'warning' that is giving me trouble when compiling:
warning: implicit declaration of function 'int DoMethod(...)'
This function is essential for MUI. According to the docs I have, it is defined in amiga.lib. However the location of the prototype isn't mentioned. I would assume that it were in
or but including these does not solve the problem. Here is my code in full so someone can point out if I'm doing anything else wrong.
(and yes I realise I don't do any error checking
)
-- main.h
void InitLibs(void);
void FreeLibs(void);
void InitMasterLoop(void);
void InitInterface(void);
extern Object * Application;
extern Object * AppWindow;
-- main.c
#include
#include
#include
#include
#include
#include
#include
#include "main.h"
struct IntuitionBase * IntuitionBase;
struct Library * MUIMasterBase;
Object * Application;
Object * AppWindow;
int main(int argc, char ** argv)
{
InitLibs(); // Load runtime libraries
InitInterface(); // Define MUI Objects
SetAttrs(AppWindow, MUIA_Window_Open, TRUE);
InitMasterLoop(); // Begin main loop
SetAttrs(AppWindow, MUIA_Window_Open, FALSE);
MUI_DisposeObject(Application);
FreeLibs();
return 0;
}
void InitLibs(void)
{
MUIMasterBase = OpenLibrary("muimaster.library", 19);
}
void FreeLibs(void);
{
CloseLibrary(MUIMasterBase);
}
void InitMasterLoop(void)
{
ULONG sigs = 0;
while(DoMethod(Application, MUIM_Application_NewInput, &sigs) != MUIV_Application_ReturnID_Quit)
{
if(sigs)
{
sigs = Wait(sigs | SIGBREAKF_CTRL_C);
if(sigs & SIGBREAKF_CTRL_C) break;
}
}
}
void InitInterface(void)
{
Application = MUI_NewObject(MUIC_Application,
MUIA_Application_Title, "MUITest",
MUIA_Application_Version, "0",
MUIA_Application_Copyright, "",
MUIA_Application_Author, ""
MUIA_Application_Description, "",
MUIA_Application_Base, ""
MUIA_Application_Window,
(AppWindow = MUI_NewObject(MUIC_Window,
MUIA_Window_Activate, TRUE,
MUIA_Window_AppWindow, TRUE,
TAG_DONE)),
TAG_DONE);
}
// And that's it!