JOEY_TOOLS define now allows using JoeyLib inside modern tool programs.

This commit is contained in:
Scott Duensing 2021-03-26 19:33:45 -05:00
parent 5207c8f77a
commit 379ba1318a
2 changed files with 36 additions and 108 deletions

View file

@ -24,6 +24,7 @@
#include "SDL/SDL_mixer.h"
#include "joey.h"
#include "jPixBuf.h"
static SDL_Surface *_jlScreen = NULL;
@ -33,67 +34,6 @@ void jlDisplayPresent(void) {
}
void jlDrawBlit8x8(jlSurfaceT source, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2) {
(void)source;
(void)cx1;
(void)cy1;
(void)cx2;
(void)cy2;
}
void jlDrawBlit8x8a(jlSurfaceT source, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte offset) {
(void)source;
(void)cx1;
(void)cy1;
(void)cx2;
(void)cy2;
(void)offset;
}
void jlDrawBlitMap(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, jlSurfaceT source) {
(void)startX;
(void)startY;
(void)width;
(void)height;
(void)mapData;
(void)stride;
(void)source;
}
void jlDrawClear(void) {
}
byte jlDrawPixelGet(jint16 x, jint16 y) {
(void)x;
(void)y;
return 0;
}
void jlDrawPixelSet(jint16 x, jint16 y) {
(void)x;
(void)y;
}
jlSurfaceT jlDrawSurfaceGet(void) {
return _jlDrawTarget;
}
void jlDrawSurfaceSet(jlSurfaceT target) {
_jlDrawTarget = target;
if (target == NULL) {
_jlDrawTargetActual = NULL;
}
}
jint16 jlGameGetAxis(byte which) {
(void)which;
@ -118,19 +58,6 @@ char jlKeyRead(void) {
}
void jlPaletteSet(byte index, byte r, byte g, byte b) {
(void)index;
(void)r;
(void)g;
(void)b;
}
void jlPaletteSetFromSta(jlStaT *sta) {
(void)sta;
}
void jlSoundFree(jlSoundT *sound) {
(void)sound;
}
@ -178,18 +105,6 @@ void jlSoundPlay(jlSoundT *sound) {
}
bool _jlStaCreate(jlStaT **sta) {
(void)sta;
return false;
}
void jlStaDisplay(jlStaT *sta) {
(void)sta;
}
void jlUtilIdle(void) {
}
@ -199,32 +114,24 @@ bool jlUtilMustExit(void) {
}
void jlUtilNibbleSwap(byte *mem, jint16 count, byte old, byte new) {
(void)mem;
(void)count;
(void)old;
(void)new;
juint16 jlUtilTimer(void) {
return 0;
}
void jlUtilShutdown(void) {
SDL_FreeSurface(_jlScreen);
jlSoundMusicStop();
Mix_CloseAudio();
Mix_Quit();
SDL_Quit();
jlUtilDie("Clean Exit.");
void jlUtilTitleSet(char *title) {
#ifdef JOEY_LINUX
SDL_WM_SetCaption(title, NULL);
#endif
}
void jlUtilStartup(char *appTitle) {
int main(void) {
Uint32 vflags;
int mflags;
int result;
(void)appTitle;
// Start low-level tools
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
jlUtilDie(SDL_GetError());
@ -242,18 +149,25 @@ void jlUtilStartup(char *appTitle) {
// Set up video
vflags = SDL_HWSURFACE;
#ifdef JOEY_LINUX
SDL_WM_SetCaption(appTitle, NULL);
#else
vflags |= SDL_FULLSCREEN;
#endif
_jlScreen = SDL_SetVideoMode(320, 200, 16, vflags);
if (!_jlScreen) {
jlUtilDie(SDL_GetError());
}
jPixBufStart();
// Run the main loop.
joeyMain();
jPixBufStop();
SDL_FreeSurface(_jlScreen);
jlSoundMusicStop();
Mix_CloseAudio();
Mix_Quit();
SDL_Quit();
jlUtilDie("Clean Exit.");
}
juint16 jlUtilTimer(void) {
return 0;
}

View file

@ -453,6 +453,20 @@ bool _jlVecLoad(jlVecT **vec, char *filename);
void joeyMain(void);
#ifdef JOEY_TOOLS
#undef JL_HAS_DISPLAYPRESENT
#undef JL_HAS_GAMEGETAXIS
#undef JL_HAS_GAMEGETBUTTON
#undef JL_HAS_KEYPRESSED
#undef JL_HAS_KEYREAD
#undef JL_HAS_UTILMUSTEXIT
#undef JL_HAS_UTILTIMER
#include "jPixBuf.h"
#define jlToolsStart jPixBufStart
#define jlToolsStop jPixBufStop
#endif
#ifdef JOEY_IIGS
// Inlined functions - asm code
extern void asmB88(jlSurfaceT target, jlSurfaceT source, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);