Just updating the repo.
This commit is contained in:
parent
bdd7fe6971
commit
8cb979877f
10 changed files with 156 additions and 38 deletions
|
@ -3,4 +3,4 @@ Cross-Platform Game Development Library
|
|||
Targets 16 bit systems like the Apple IIgs, Commodore Amiga, and Atari ST
|
||||
along with modern PCs running Windows, macOS, and Linux.
|
||||
|
||||
https://https://skunkworks.kangaroopunch.com/skunkworks/joeylib
|
||||
https://skunkworks.kangaroopunch.com/skunkworks/joeylib
|
||||
|
|
69
joeylib/build-IIgs.helper.sh
Executable file
69
joeylib/build-IIgs.helper.sh
Executable file
|
@ -0,0 +1,69 @@
|
|||
# --- HERE BE DRAGONS ---
|
||||
|
||||
TARGET=${JOEY}/sdks/iix/IIgs/out/${PROJECT}
|
||||
GSTARGET=31:/out/${PROJECT}
|
||||
CADIUS=${JOEY}/sdks/iix/cadius-git/bin/release/cadius
|
||||
VOL=Import
|
||||
IMPORT=/tmp/IIgs/import.po
|
||||
|
||||
if [ -d ${TARGET} ]; then
|
||||
rm -rf ${TARGET}
|
||||
fi
|
||||
mkdir -p ${TARGET}
|
||||
|
||||
rm /tmp/IIgs/_FileInformation.txt || true 2> /dev/null
|
||||
rm /tmp/IIgs/JLSTATS#040000 || true 2> /dev/null
|
||||
rm ${IMPORT} || true 2> /dev/null
|
||||
|
||||
cp -f ${JOEY}/dist/joey.h .
|
||||
CFILES=($(ls -1 *.c))
|
||||
OFILES=""
|
||||
for F in "${CFILES[@]}"; do
|
||||
O=${F%.*}
|
||||
if [ "${O}" != "main" ]; then
|
||||
OFILES="${OFILES} ${GSTARGET}/${O}"
|
||||
fi
|
||||
echo "Compiling ${F}..."
|
||||
iix compile ${F} keep=${GSTARGET}/${O}
|
||||
done
|
||||
rm joey.h
|
||||
OFILES="${GSTARGET}/main ${OFILES} 13:joeylib"
|
||||
|
||||
cp -f ${JOEY}/dist/IIgs/joeylib#b20000 ${JOEY}/sdks/iix/IIgs/Libraries/joeylib
|
||||
iix chtyp -t lib ${JOEY}/sdks/iix/IIgs/Libraries/joeylib
|
||||
iix -DKeepType=S16 link +L ${OFILES} keep=${GSTARGET}/${PROJECT}#b30000 > ${PROJECT}.map
|
||||
iix dumpobj +D ${GSTARGET}/${PROJECT}#b30000 &> ${PROJECT}.dis || true
|
||||
echo ${OFILES} > ${PROJECT}.lnk
|
||||
|
||||
if [ ! -z $1 ]; then
|
||||
mkdir -p /tmp/IIgs
|
||||
${CADIUS} createvolume ${IMPORT} ${VOL} 32MB > /dev/null
|
||||
${CADIUS} createfolder ${IMPORT} ${VOL}/data > /dev/null
|
||||
${CADIUS} addfile ${IMPORT} ${VOL} ${TARGET}/${PROJECT}#b30000 > /dev/null
|
||||
mkdir -p /tmp/IIgs/data
|
||||
for F in "${DATA[@]}"; do
|
||||
N=/tmp/IIgs/data/`basename ${F}`#060000
|
||||
cp -f ${F} ${N}
|
||||
${CADIUS} addfile ${IMPORT} ${VOL}/data ${N} > /dev/null
|
||||
rm ${N}
|
||||
done
|
||||
|
||||
mkdir -p /tmp/IIgs/source
|
||||
for S in "${SOURCE[@]}"; do
|
||||
for F in `ls -1 ${S}`; do
|
||||
tr "\n" "\r" < ${F} > /tmp/IIgs/source/${F}#040000
|
||||
${CADIUS} addfile ${IMPORT} ${VOL} ${F}#040000 > /dev/null
|
||||
rm /tmp/IIgs/source/${F}#040000
|
||||
done
|
||||
done
|
||||
|
||||
pushd ${JOEY}/sdks/iix/gsplus
|
||||
./gsplus -config IIgsTest.cfg || true
|
||||
popd
|
||||
${CADIUS} extractfile ${IMPORT} ${VOL}/JLSTATS /tmp/IIgs/. > /dev/null
|
||||
if [ -e /tmp/IIgs/JLSTATS#040000 ]; then
|
||||
echo ""
|
||||
cat /tmp/IIgs/JLSTATS#040000 | tr "\r" "\n" 2> /dev/null
|
||||
echo ""
|
||||
fi
|
||||
fi
|
|
@ -25,6 +25,7 @@ iix dumpobj +D 31:/out/joey/test &> test.dis || true
|
|||
php ${JOEY}/sdks/iix/ntconverter.php *.mod
|
||||
popd
|
||||
|
||||
mkdir -p ${JOEY}/dist/IIgs
|
||||
cp -f ${JOEY}/joeylib/joeylib/lib/IIgs/Tool221#ba0000 ${JOEY}/dist/IIgs/.
|
||||
cp -f ${JOEY}/joeylib/joeylib/src/joey.h ${JOEY}/dist/.
|
||||
cp -f ${OUT}/joeylib ${JOEY}/dist/IIgs/joeylib#b20000
|
||||
|
|
|
@ -6,6 +6,9 @@ SRC="${JOEY}/joeylib/joeylib/src"
|
|||
|
||||
|
||||
function doBuild() {
|
||||
|
||||
G_CFLAGS="-Wall -D_REENTRANT_ -I${SRC} -c"
|
||||
|
||||
echo "*** Starting ${DIST}"
|
||||
if [ -d "${BUILD}" ]; then
|
||||
rm -rf "${BUILD}"
|
||||
|
@ -17,17 +20,14 @@ function doBuild() {
|
|||
mkdir -p "${DIST}"
|
||||
|
||||
pushd "${BUILD}"
|
||||
${CC} ${CFLAGS} -c -o jPC.o ${SRC}/jPC.c
|
||||
${CC} ${CFLAGS} -c -o joey.o ${SRC}/joey.c
|
||||
cp -f *.o "${DIST}"/.
|
||||
popd
|
||||
${CC} ${CFLAGS} ${G_CFLAGS} -o jPC.o ${SRC}/jPC.c
|
||||
${CC} ${CFLAGS} ${G_CFLAGS} -o joey.o ${SRC}/joey.c
|
||||
|
||||
pushd ${DIST}
|
||||
ar -x ${INSTALLED}/libSDL2.a
|
||||
ar -x ${INSTALLED}/libSDL2_mixer.a
|
||||
ar -x ${INSTALLED}/libmikmod.a
|
||||
ar rcs joeylib.a *.o
|
||||
rm *.o
|
||||
ar x ${INSTALLED}/libSDL2.a
|
||||
ar x ${INSTALLED}/libSDL2_mixer.a
|
||||
ar x ${INSTALLED}/libmodplug.a
|
||||
|
||||
ar rcs ${DIST}/libjoeylib.a *.o
|
||||
popd
|
||||
|
||||
if [ -d "${BUILD}" ]; then
|
||||
|
@ -36,37 +36,47 @@ function doBuild() {
|
|||
}
|
||||
|
||||
CC="gcc"
|
||||
CFLAGS="-Wall -D_REENTRANT -I${SRC}"
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
DIST="${JOEY}/dist/linux/x64"
|
||||
INSTALLED="${JOEY}/SDL2/installed/linux/x64/lib"
|
||||
doBuild
|
||||
|
||||
:<<SKIP
|
||||
CC="gcc"
|
||||
CFLAGS="-m32 -Wall -D_REENTRANT -I${SRC}"
|
||||
CFLAGS="-m32"
|
||||
LDFLAGS=""
|
||||
DIST="${JOEY}/dist/linux/x86"
|
||||
INSTALLED="${JOEY}/SDL2/installed/linux/x86/lib"
|
||||
doBuild
|
||||
|
||||
CC="x86_64-w64-mingw32-gcc"
|
||||
CFLAGS="-Wall -D_REENTRANT -I${SRC}"
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
DIST="${JOEY}/dist/windows/x64"
|
||||
INSTALLED="${JOEY}/SDL2/installed/windows/x64/lib"
|
||||
doBuild
|
||||
|
||||
CC="i686-w64-mingw32-gcc"
|
||||
CFLAGS="-Wall -D_REENTRANT -I${SRC}"
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
DIST="${JOEY}/dist/windows/x86"
|
||||
INSTALLED="${JOEY}/SDL2/installed/windows/x86/lib"
|
||||
doBuild
|
||||
|
||||
CC="o32-clang"
|
||||
CFLAGS="-Wall -D_REENTRANT -I${SRC}"
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
DIST="${JOEY}/dist/macos/x86"
|
||||
INSTALLED="${JOEY}/SDL2/installed/macos/x86/lib"
|
||||
doBuild
|
||||
|
||||
CC="o64-clang"
|
||||
CFLAGS="-Wall -D_REENTRANT -I${SRC}"
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
DIST="${JOEY}/dist/macos/x64"
|
||||
INSTALLED="${JOEY}/SDL2/installed/macos/x64/lib"
|
||||
doBuild
|
||||
SKIP
|
||||
|
||||
cp -f ${JOEY}/joeylib/joeylib/src/joey.h ${JOEY}/dist/.
|
||||
|
|
|
@ -4,6 +4,8 @@ CONFIG -= \
|
|||
app_bundle \
|
||||
qt
|
||||
|
||||
JOEY = /home/scott/joey
|
||||
|
||||
QMAKE_CFLAGS += \
|
||||
-I$$PWD/src \
|
||||
-D_REENTRANT
|
||||
|
@ -22,24 +24,20 @@ OTHER_FILES += \
|
|||
src/jIIgs.asm \
|
||||
src/jIIgs.macro \
|
||||
build-IIgs.sh \
|
||||
build-IIgs.helper.sh \
|
||||
build-PC.sh
|
||||
|
||||
SDL_LIBS = \
|
||||
-L$$PWD/lib/linux/x64 \
|
||||
-Wl,-rpath,$$PWD/lib/linux/x64 \
|
||||
-L$$JOEY/SDL2/installed/linux/x64/lib \
|
||||
-Wl,--enable-new-dtags \
|
||||
-lSDL2 \
|
||||
-lSDL2_mixer \
|
||||
-lmodplug \
|
||||
-Wl,--no-undefined \
|
||||
-lm \
|
||||
-ldl \
|
||||
-lpthread \
|
||||
-lrt
|
||||
|
||||
SDL_MIXER_LIBS = \
|
||||
-L$$PWD/lib/linux/x64 \
|
||||
-lSDL2_mixer \
|
||||
-lmikmod
|
||||
|
||||
LIBS += \
|
||||
$$SDL_LIBS \
|
||||
$$SDL_MIXER_LIBS
|
||||
$$SDL_LIBS
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#undef true
|
||||
|
||||
|
||||
#define JOEY_LIBRARY
|
||||
#include "joey.h"
|
||||
|
||||
|
||||
|
@ -313,6 +312,8 @@ void jlUtilStartup(char *appTitle) {
|
|||
|
||||
(void)appTitle; // Unused on IIgs
|
||||
|
||||
_jlDebugBorder(BORDER_DEEP_RED);
|
||||
|
||||
// Start up neded tools
|
||||
TLStartUp();
|
||||
_jlMyID = MMStartUp();
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "SDL2/SDL.h"
|
||||
#include "SDL2/SDL_mixer.h"
|
||||
|
||||
#define JOEY_LIBRARY
|
||||
#include "joey.h"
|
||||
|
||||
|
||||
|
@ -434,14 +433,18 @@ void jlUtilIdle(void) {
|
|||
default:
|
||||
_jlLastKey = _jlUtilIdleCheckKey(event.key.keysym.sym);
|
||||
if (_jlLastKey > 0) {
|
||||
_jlNumKeysDown++;
|
||||
//***FIX***
|
||||
//_jlNumKeysDown++;
|
||||
_jlNumKeysDown = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
if (_jlUtilIdleCheckKey(event.key.keysym.sym) > 0) {
|
||||
_jlNumKeysDown--;
|
||||
//***FIX***
|
||||
//_jlNumKeysDown--;
|
||||
_jlNumKeysDown = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -451,6 +454,8 @@ void jlUtilIdle(void) {
|
|||
}
|
||||
}
|
||||
|
||||
//printf("Keys down: %d\n", _jlNumKeysDown);
|
||||
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,17 @@
|
|||
#include <errno.h>
|
||||
|
||||
|
||||
#define JOEY_LIBRARY
|
||||
#include "joey.h"
|
||||
|
||||
|
||||
#include "stddclmr.h"
|
||||
|
||||
|
||||
#ifdef JOEY_IIGS
|
||||
segment "joeylib";
|
||||
#endif
|
||||
|
||||
|
||||
// Vector image file command bytes
|
||||
#define COMMAND_COLOR 1 // C
|
||||
#define COMMAND_CLEAR 2 // E
|
||||
|
@ -167,6 +171,30 @@ void jlDisplayBorder(jlBorderColorsE color) {
|
|||
}
|
||||
|
||||
|
||||
void jlDrawBlitMap(byte startX, byte startY, byte width, byte height, byte *mapData, juint16 stride, jlStaT *tiles) {
|
||||
// startX = start tile for drawing
|
||||
// startY = start tile for drawing
|
||||
// width = tiles to draw horizontally
|
||||
// height = tiles to draw vertically
|
||||
// mapData = pointer to tile x/y pairs to draw
|
||||
// stride = number of tiles to skip in the mapData for every horizontal line
|
||||
// tiles = sta to fetch tile data from
|
||||
byte x;
|
||||
byte y;
|
||||
byte tileX;
|
||||
byte tileY;
|
||||
juint16 offset = 0;
|
||||
|
||||
for (y=startY; y<height; y++) {
|
||||
for (x=startX; x<width; x++) {
|
||||
tileX = mapData[offset++];
|
||||
tileY = mapData[offset++];
|
||||
jlDrawBlit8x8(tiles, tileX & 0x3F, tileY & 0x1F, x, y); //***TODO*** Move masking into bliter code.
|
||||
}
|
||||
offset += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void jlDrawBox(jint16 x1, jint16 y1, jint16 x2, jint16 y2) {
|
||||
jlDrawLine(x1, y1, x2, y1);
|
||||
jlDrawLine(x2, y1, x2, y2);
|
||||
|
|
|
@ -26,11 +26,14 @@
|
|||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
// Determine platform and settings
|
||||
#ifdef __linux__
|
||||
|
||||
#include <linux/limits.h>
|
||||
|
||||
#define JOEY_LINUX
|
||||
#define JOEY_PC
|
||||
#define JOEY_LITLE_ENDIAN
|
||||
|
@ -67,9 +70,8 @@ typedef unsigned short juint16;
|
|||
#define __attribute__(x)
|
||||
typedef int jint16;
|
||||
typedef unsigned int juint16;
|
||||
#ifdef JOEY_LIBRARY
|
||||
#ifndef JOEY_MAIN
|
||||
#pragma noroot
|
||||
segment "joeylib";
|
||||
#endif
|
||||
#pragma memorymodel 1
|
||||
#pragma optimize -1
|
||||
|
@ -205,6 +207,7 @@ void jlDisplayBorder(jlBorderColorsE color);
|
|||
void jlDisplayPresent(void);
|
||||
|
||||
void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
|
||||
void jlDrawBlitMap(byte startX, byte startY, byte width, byte height, byte *mapData, juint16 stride, jlStaT *tiles);
|
||||
void jlDrawBox(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
|
||||
void jlDrawBoxFilled(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
|
||||
void jlDrawCircle(jint16 x, jint16 y, jint16 radius);
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
segment "testapp";
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
// Font hacking!
|
||||
__attribute__((__format__ (__printf__, 4, 0)))
|
||||
void printAt(jlStaT *font, jint16 cx, jint16 cy, const char *what, ...) {
|
||||
|
@ -52,18 +52,21 @@ void printAt(jlStaT *font, jint16 cx, jint16 cy, const char *what, ...) {
|
|||
jlDrawBlit8x8(font, x, y, counter + cx, cy);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
int main(void) {
|
||||
|
||||
/*
|
||||
jlStaT *kanga = NULL;
|
||||
jlStaT *font = NULL;
|
||||
jint16 y;
|
||||
jint16 color = 15;
|
||||
jint16 nextColor = 1;
|
||||
*/
|
||||
|
||||
jlUtilStartup("JoeyLib Test");
|
||||
|
||||
/*
|
||||
if (!jlStaLoad(kanga, "kanga")) jlUtilDie("Unable to load kanga.sta!");
|
||||
if (!jlStaLoad(font, "font")) jlUtilDie("Unable to load font.sta!");
|
||||
|
||||
|
@ -71,7 +74,7 @@ int main(void) {
|
|||
jlDrawColor(1);
|
||||
jlDrawBox(0, 0, 319, 199);
|
||||
|
||||
//jlSoundMusicPlay("music");
|
||||
jlSoundMusicPlay("music");
|
||||
|
||||
jlPaletteSet(15, 15, 15, 15);
|
||||
printAt(font, 1, 16, "X");
|
||||
|
@ -88,11 +91,11 @@ int main(void) {
|
|||
}
|
||||
jlKeyRead();
|
||||
|
||||
//jlSoundMusicStop();
|
||||
jlSoundMusicStop();
|
||||
|
||||
jlStaFree(font);
|
||||
jlStaFree(kanga);
|
||||
*/
|
||||
|
||||
jlUtilShutdown();
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue