I don't even know what I'm doing anymore.
This commit is contained in:
parent
9eb2fff01a
commit
5d5cf0fe5d
5 changed files with 95 additions and 104 deletions
|
@ -267,36 +267,7 @@ void jlSoundModStop(void) {
|
|||
}
|
||||
|
||||
|
||||
void jlUtilShutdown(void) {
|
||||
// Clear the display.
|
||||
jlDrawColorSet(0);
|
||||
jlDrawClear();
|
||||
|
||||
// Restore Border
|
||||
jlDisplayBorder((jlBorderColorsE)_jlBorderSaved);
|
||||
jlDisplayPresent();
|
||||
|
||||
// SHR Off
|
||||
asmGrOff();
|
||||
|
||||
asmStop();
|
||||
|
||||
// Shutdown tools
|
||||
NTPShutDown(); // NinjaTracker
|
||||
UnloadOneTool(222);
|
||||
MSShutDown(); // MIDI Synth
|
||||
UnloadOneTool(35);
|
||||
SoundShutDown(); // Sound Tool Set
|
||||
MTShutDown(); // Misc Tools
|
||||
DisposeAll(userid());
|
||||
MMShutDown(userid()); // Memory Manager
|
||||
TLShutDown(); // Tool Locator
|
||||
|
||||
jlUtilDie("Clean Exit.");
|
||||
}
|
||||
|
||||
|
||||
void jlUtilStartup(char *appTitle) {
|
||||
int main(void) {
|
||||
|
||||
handle tempHandle;
|
||||
ptr ZeroPagePtr;
|
||||
|
@ -304,8 +275,6 @@ void jlUtilStartup(char *appTitle) {
|
|||
char *temp;
|
||||
_jlPascalStringT toolFile;
|
||||
|
||||
(void)appTitle; // Unused on IIgs
|
||||
|
||||
TLStartUp(); // Tool Locator
|
||||
JOEY_CHECK_TOOL_ERROR("TLStartUp")
|
||||
MMStartUp(); // Memory Manager
|
||||
|
@ -374,6 +343,34 @@ void jlUtilStartup(char *appTitle) {
|
|||
jlDrawColorSet(0);
|
||||
jlDrawClear();
|
||||
jlDrawColorSet(15);
|
||||
|
||||
jlDisplayPresent();
|
||||
|
||||
// Run the main loop.
|
||||
joeyMain();
|
||||
|
||||
// Clear the display.
|
||||
jlDrawColorSet(0);
|
||||
jlDrawClear();
|
||||
|
||||
// Restore Border
|
||||
jlDisplayBorder((jlBorderColorsE)_jlBorderSaved);
|
||||
jlDisplayPresent();
|
||||
|
||||
// SHR Off
|
||||
asmGrOff();
|
||||
|
||||
asmStop();
|
||||
|
||||
// Shutdown tools
|
||||
NTPShutDown(); // NinjaTracker
|
||||
UnloadOneTool(222);
|
||||
MSShutDown(); // MIDI Synth
|
||||
UnloadOneTool(35);
|
||||
SoundShutDown(); // Sound Tool Set
|
||||
MTShutDown(); // Misc Tools
|
||||
DisposeAll(userid());
|
||||
MMShutDown(userid()); // Memory Manager
|
||||
TLShutDown(); // Tool Locator
|
||||
|
||||
jlUtilDie("Clean Exit.");
|
||||
}
|
||||
|
|
|
@ -561,36 +561,29 @@ bool jlUtilMustExit(void) {
|
|||
}
|
||||
|
||||
|
||||
void jlUtilShutdown(void) {
|
||||
int x;
|
||||
|
||||
SDL_RemoveTimer(_jlTimerId);
|
||||
for (x=0; x<_jlControllerCount; x++) {
|
||||
SDL_GameControllerClose(_jlControllers[x]);
|
||||
}
|
||||
_jlControllerCount = 0;
|
||||
jlFree(_jlControllers);
|
||||
jlImgFree(_jlBackingStore);
|
||||
//***TODO*** Sound effects stop?
|
||||
jlSoundModStop();
|
||||
jlSoundMidiStop();
|
||||
Mix_CloseAudio();
|
||||
Mix_Quit();
|
||||
SDL_FreeFormat(_jlPixelFormat);
|
||||
SDL_DestroyTexture(_jlTexture);
|
||||
SDL_DestroyRenderer(_jlRenderer);
|
||||
SDL_DestroyWindow(_jlWindow);
|
||||
SDL_Quit();
|
||||
jlUtilDie("Clean Exit.");
|
||||
Uint32 _jlUtilTimer(Uint32 interval, void *param) {
|
||||
(void)param;
|
||||
_jlTimerValue++;
|
||||
return(interval);
|
||||
}
|
||||
|
||||
|
||||
void jlUtilStartup(char *appTitle) {
|
||||
juint16 jlUtilTimer(void) {
|
||||
return _jlTimerValue;
|
||||
}
|
||||
|
||||
int flags;
|
||||
int result;
|
||||
int joysticks;
|
||||
int x;
|
||||
|
||||
void jlUtilTitleSet(char *title) {
|
||||
SDL_SetWindowTitle(_jlWindow, title);
|
||||
}
|
||||
|
||||
|
||||
int main(void) {
|
||||
|
||||
int flags;
|
||||
int result;
|
||||
int joysticks;
|
||||
int x;
|
||||
|
||||
// Start low-level tools
|
||||
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
|
||||
|
@ -617,7 +610,7 @@ void jlUtilStartup(char *appTitle) {
|
|||
}
|
||||
|
||||
// Create a window and renderer using SDL
|
||||
_jlWindow = SDL_CreateWindow(appTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 400, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
||||
_jlWindow = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 400, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
||||
_jlRenderer = SDL_CreateRenderer(_jlWindow, -1, SDL_RENDERER_SOFTWARE);
|
||||
_jlTexture = SDL_CreateTexture(_jlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
|
||||
_jlPixelFormat = SDL_AllocFormat(SDL_GetWindowPixelFormat(_jlWindow));
|
||||
|
@ -633,16 +626,26 @@ void jlUtilStartup(char *appTitle) {
|
|||
|
||||
// Start 1/60th second timer
|
||||
_jlTimerId = SDL_AddTimer(1000 / 60, _jlUtilTimer, NULL);
|
||||
}
|
||||
|
||||
|
||||
Uint32 _jlUtilTimer(Uint32 interval, void *param) {
|
||||
(void)param;
|
||||
_jlTimerValue++;
|
||||
return(interval);
|
||||
}
|
||||
|
||||
|
||||
juint16 jlUtilTimer(void) {
|
||||
return _jlTimerValue;
|
||||
|
||||
// Run the main loop.
|
||||
joeyMain();
|
||||
|
||||
SDL_RemoveTimer(_jlTimerId);
|
||||
for (x=0; x<_jlControllerCount; x++) {
|
||||
SDL_GameControllerClose(_jlControllers[x]);
|
||||
}
|
||||
_jlControllerCount = 0;
|
||||
jlFree(_jlControllers);
|
||||
jlImgFree(_jlBackingStore);
|
||||
//***TODO*** Sound effects stop?
|
||||
jlSoundModStop();
|
||||
jlSoundMidiStop();
|
||||
Mix_CloseAudio();
|
||||
Mix_Quit();
|
||||
SDL_FreeFormat(_jlPixelFormat);
|
||||
SDL_DestroyTexture(_jlTexture);
|
||||
SDL_DestroyRenderer(_jlRenderer);
|
||||
SDL_DestroyWindow(_jlWindow);
|
||||
SDL_Quit();
|
||||
jlUtilDie("Clean Exit.");
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
|
||||
#define JOEY_MAIN
|
||||
#include "joey.h"
|
||||
|
||||
|
||||
|
@ -1099,14 +1100,6 @@ void jlUtilRandomSeedSet(juint32 seed) {
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef JL_HAS_UTILSHUTDOWN
|
||||
__attribute__((noreturn))
|
||||
void jlUtilShutdown(void) {
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef JL_HAS_UTILSLEEP
|
||||
void jlUtilSleep(juint16 sixtieths) {
|
||||
juint16 t = jlUtilTimer();
|
||||
|
@ -1145,13 +1138,6 @@ void _jlUtilStackPush(jlStackT **stack, void *data) {
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef JL_HAS_UTILSTARTUP
|
||||
void jlUtilStartup(char *appTitle) {
|
||||
(void)appTitle;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef JL_HAS_UTILTIMER
|
||||
juint16 jlUtilTimer(void) {
|
||||
return 0;
|
||||
|
@ -1170,6 +1156,13 @@ juint16 jlUtilTimeSpan(juint16 past, juint16 current) {
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef JL_HAS_UTILHASTITLESET
|
||||
void jlUtilTitleSet(char *title) {
|
||||
(void)title;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef JL_HAS_VECDISPLAY
|
||||
void jlVecDisplay(jlVecT *vec, jint16 ox, jint16 oy) {
|
||||
jint16 command;
|
||||
|
|
|
@ -102,9 +102,8 @@ typedef unsigned int juint32;
|
|||
#define JL_HAS_SOUNDPLAY
|
||||
#define JL_HAS_UTILIDLE
|
||||
#define JL_HAS_UTILMUSTEXIT
|
||||
#define JL_HAS_UTILSHUTDOWN
|
||||
#define JL_HAS_UTILSTARTUP
|
||||
#define JL_HAS_UTILTIMER
|
||||
#define JL_HAS_UTILHASTITLESET
|
||||
|
||||
#elif _WIN32
|
||||
|
||||
|
@ -144,9 +143,8 @@ typedef unsigned int juint32;
|
|||
#define JL_HAS_SOUNDPLAY
|
||||
#define JL_HAS_UTILIDLE
|
||||
#define JL_HAS_UTILMUSTEXIT
|
||||
#define JL_HAS_UTILSHUTDOWN
|
||||
#define JL_HAS_UTILSTARTUP
|
||||
#define JL_HAS_UTILTIMER
|
||||
#define JL_HAS_UTILHASTITLESET
|
||||
|
||||
#elif __APPLE__
|
||||
|
||||
|
@ -186,9 +184,8 @@ typedef unsigned int juint32;
|
|||
#define JL_HAS_SOUNDPLAY
|
||||
#define JL_HAS_UTILIDLE
|
||||
#define JL_HAS_UTILMUSTEXIT
|
||||
#define JL_HAS_UTILSHUTDOWN
|
||||
#define JL_HAS_UTILSTARTUP
|
||||
#define JL_HAS_UTILTIMER
|
||||
#define JL_HAS_UTILHASTITLESET
|
||||
|
||||
#elif __ORCAC__
|
||||
|
||||
|
@ -232,8 +229,6 @@ typedef unsigned long juint32;
|
|||
#define JL_HAS_SOUNDMODPLAY
|
||||
#define JL_HAS_SOUNDMODSTOP
|
||||
#define JL_HAS_UTILNIBBLESWAP
|
||||
#define JL_HAS_UTILSHUTDOWN
|
||||
#define JL_HAS_UTILSTARTUP
|
||||
#define JL_HAS_UTILTIMER
|
||||
|
||||
#elif AMIGA
|
||||
|
@ -439,15 +434,14 @@ void jlUtilNibbleSwap(byte *mem, jint16 count, byte old, byte new);
|
|||
juint16 jlUtilRandom(void);
|
||||
juint32 jlUtilRandomSeedGet(void);
|
||||
void jlUtilRandomSeedSet(juint32 seed);
|
||||
void jlUtilShutdown(void) __attribute__((noreturn));
|
||||
void jlUtilSleep(juint16 sixtieths);
|
||||
#define jlUtilStackPop(stack) _jlUtilStackPop((jlStackT **)&(stack)) // Syntatic Sugar
|
||||
void *_jlUtilStackPop(jlStackT **stack);
|
||||
#define jlUtilStackPush(stack, data) _jlUtilStackPush((jlStackT **)&(stack), data) // Syntatic Sugar
|
||||
void _jlUtilStackPush(jlStackT **stack, void *data);
|
||||
void jlUtilStartup(char *appTitle);
|
||||
juint16 jlUtilTimer(void);
|
||||
juint16 jlUtilTimeSpan(juint16 past, juint16 current);
|
||||
void jlUtilTitleSet(char *title);
|
||||
|
||||
void jlVecDisplay(jlVecT *vec, jint16 x, jint16 y);
|
||||
void jlVecFree(jlVecT *vec);
|
||||
|
@ -455,6 +449,10 @@ void jlVecFree(jlVecT *vec);
|
|||
bool _jlVecLoad(jlVecT **vec, char *filename);
|
||||
|
||||
|
||||
// Must be provided by application
|
||||
void joeyMain(void);
|
||||
|
||||
|
||||
#ifdef JOEY_IIGS
|
||||
// Inlined functions - asm code
|
||||
extern void asmB88(jlSurfaceT target, jlSurfaceT source, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <assert.h>
|
||||
|
||||
|
||||
#define JOEY_MAIN
|
||||
#include "joey.h"
|
||||
#ifdef JOEY_IIGS
|
||||
segment "testapp";
|
||||
|
@ -437,17 +436,18 @@ void timerTest(void) {
|
|||
}
|
||||
|
||||
|
||||
int main(void) {
|
||||
jlUtilStartup("JoeyLib Test");
|
||||
void joeyMain(void) {
|
||||
|
||||
jlUtilTitleSet("JoeyLib Test");
|
||||
|
||||
//blitTest();
|
||||
//exerciseAPI();
|
||||
//grid();
|
||||
grid();
|
||||
//lineTest();
|
||||
//musicTest();
|
||||
showStencil();
|
||||
//showStencil();
|
||||
//stencilTest();
|
||||
//timerTest();
|
||||
|
||||
jlUtilShutdown();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue