mirror of
https://github.com/jonthysell/MacLO.git
synced 2024-06-25 16:29:53 +00:00
Small refactoring, handle missing WIND resource, added icons and version resources
This commit is contained in:
parent
fe307eb9e6
commit
b51cf36f80
|
@ -1,6 +0,0 @@
|
|||
// Copyright (c) Jon Thysell <http://jonthysell.com>
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
WindowPtr MainWindow;
|
|
@ -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
10
src/MacCommon.h
Normal 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
|
30
src/MacLO.c
30
src/MacLO.c
|
@ -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
11
src/MacLO.h
Normal 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
|
BIN
src/MacLO.pi.bin
BIN
src/MacLO.pi.bin
Binary file not shown.
Binary file not shown.
11
src/main.c
Normal file
11
src/main.c
Normal 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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user