Small refactoring, handle missing WIND resource, added icons and version resources

This commit is contained in:
Jon Thysell 2021-10-13 17:44:08 -07:00
parent fe307eb9e6
commit b51cf36f80
8 changed files with 50 additions and 20 deletions

View File

@ -1,6 +0,0 @@
// Copyright (c) Jon Thysell <http://jonthysell.com>
// Licensed under the MIT License.
#include "Common.h"
WindowPtr MainWindow;

View File

@ -16,6 +16,4 @@
#define bitToggle(value, bit) ((value) ^= (1UL << (bit)))
#define bitWrite(value, bit, bitValue) ((bitBalue) ? bitSet(value, bit) : bitClear(value, bit))
extern WindowPtr MainWindow;
#endif

10
src/MacCommon.h Normal file
View File

@ -0,0 +1,10 @@
// Copyright (c) Jon Thysell <http://jonthysell.com>
// Licensed under the MIT License.
#ifndef MACCOMMON_H
#define MACCOMMON_H
#define kBaseResID 128
#define kMoveToFront (WindowPtr)-1L
#endif

View File

@ -1,36 +1,42 @@
// Copyright (c) Jon Thysell <http://jonthysell.com>
// Licensed under the MIT License.
#include "Common.h"
#include "MacCommon.h"
#include "MacLO.h"
void InitToolbox()
void InitToolBox()
{
InitGraf(&thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(0L);
InitDialogs(nil);
FlushEvents(everyEvent, 0);
InitCursor();
}
void InitMainWindow()
{
MainWindow = GetNewWindow(128, 0L, (WindowPtr)-1L);
SetPort(MainWindow);
WindowPtr window;
window = GetNewWindow(kBaseResID, nil, kMoveToFront);
if (window == nil)
{
SysBeep(0);
ExitToShell();
}
ShowWindow(window);
SetPort(window);
MoveTo(30, 50);
DrawString("\pHello MacLO");
}
void EventLoop()
void ProcessEvents()
{
while (!Button()) { }
}
void main(void)
{
InitToolbox();
InitMainWindow();
EventLoop();
}

11
src/MacLO.h Normal file
View File

@ -0,0 +1,11 @@
// Copyright (c) Jon Thysell <http://jonthysell.com>
// Licensed under the MIT License.
#ifndef MACLO_H
#define MACLO_H
void InitToolBox();
void InitMainWindow();
void ProcessEvents();
#endif

Binary file not shown.

Binary file not shown.

11
src/main.c Normal file
View File

@ -0,0 +1,11 @@
// Copyright (c) Jon Thysell <http://jonthysell.com>
// Licensed under the MIT License.
#include "MacLO.h"
void main(void)
{
InitToolBox();
InitMainWindow();
ProcessEvents();
}