STA renamed IMG.
This commit is contained in:
parent
9690c278b0
commit
7b7dffad7a
5 changed files with 219 additions and 112 deletions
|
@ -31,7 +31,7 @@
|
|||
|
||||
static SDL_Window *_jlWindow = NULL;
|
||||
static SDL_Renderer *_jlRenderer = NULL;
|
||||
static jlStaT *_jlBackingStore = NULL; // 4 bit representation
|
||||
static jlImgT *_jlBackingStore = NULL; // 4 bit representation
|
||||
static SDL_Texture *_jlTexture = NULL; // Video card representation in ARGB
|
||||
static SDL_PixelFormat *_jlPixelFormat = NULL; // Pixel format of _jlTexture
|
||||
static bool _jlIsRunning = true;
|
||||
|
@ -164,8 +164,8 @@ void jlDrawBlit8x8(jlSurfaceT source, jint16 sx, jint16 sy, jint16 tx, jint16 ty
|
|||
|
||||
// We mask off unused bits in the source tile location so they can be used to hold other data.
|
||||
o1 = ((sy & 0x1f) * 8 * 160) + ((sx & 0x3f) * 4); // This is in tiles
|
||||
if (jlUtilIsOdd(tx)) tx--; // tx must be even because there are two pixels per byte
|
||||
o2 = ty * 160 + (int)(tx * 0.5); // This is in pixels...
|
||||
if (jlUtilIsOdd(o2)) o2--; //...and must be even
|
||||
|
||||
for (y=0; y<8; y++) {
|
||||
for (x=0; x<4; x++) {
|
||||
|
@ -177,6 +177,7 @@ void jlDrawBlit8x8(jlSurfaceT source, jint16 sx, jint16 sy, jint16 tx, jint16 ty
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
void jlDrawBlit8x8a(jlSurfaceT source, jint16 sx, jint16 sy, jint16 tx, jint16 ty, byte offset) {
|
||||
int mo; // Mask offset
|
||||
int so; // Source Pixel Offset
|
||||
|
@ -192,8 +193,8 @@ void jlDrawBlit8x8a(jlSurfaceT source, jint16 sx, jint16 sy, jint16 tx, jint16 t
|
|||
// We mask off unused bits in the source tile location so they can be used to hold other data.
|
||||
mo = ((sy & 0x1f) * 8 * 160) + (((sx & 0x3f) + offset) * 4); // This is in tiles
|
||||
so = ((sy & 0x1f) * 8 * 160) + ((sx & 0x3f) * 4); // This is in tiles
|
||||
if (jlUtilIsOdd(tx)) tx--; // tx must be even because there are two pixels per byte
|
||||
to = ty * 160 + (int)(tx * 0.5); // This is in pixels...
|
||||
if (jlUtilIsOdd(to)) to--; //...and must be even
|
||||
|
||||
for (y=0; y<8; y++) {
|
||||
for (x=0; x<4; x++) {
|
||||
|
@ -209,6 +210,49 @@ void jlDrawBlit8x8a(jlSurfaceT source, jint16 sx, jint16 sy, jint16 tx, jint16 t
|
|||
to += 156;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void jlDrawBlit8x8a(jlSurfaceT source, jlStnT *stencil, jint16 sx, jint16 sy, jint16 tx, jint16 ty) {
|
||||
int mo; // Mask offset
|
||||
int so; // Source Pixel Offset
|
||||
int to; // Target Pixel Offset
|
||||
int x;
|
||||
int y;
|
||||
byte b; // Mask bit index
|
||||
jlPixelPairT s; // Source Pixel
|
||||
jlPixelPairT t; // Target Pixel
|
||||
jlPixelPairT *pixels = (jlPixelPairT *)source;
|
||||
jlPixelPairT *target = (jlPixelPairT *)_jlDrawTargetActual;
|
||||
|
||||
// We mask off unused bits in the source tile location so they can be used to hold other data.
|
||||
mo = ((sy & 0x1f) * 8 * 40) + (sx & 0x3f); // This is in tiles
|
||||
so = ((sy & 0x1f) * 8 * 160) + ((sx & 0x3f) * 4); // This is in tiles
|
||||
if (jlUtilIsOdd(tx)) tx--; // tx must be even because there are two pixels per byte
|
||||
to = ty * 160 + (int)(tx * 0.5); // This is in pixels...
|
||||
|
||||
for (y=0; y<8; y++) {
|
||||
b = 7;
|
||||
for (x=0; x<4; x++) {
|
||||
t = target[to];
|
||||
s = pixels[so++];
|
||||
|
||||
//***FIX*** Another endian order issue. Left & Right are swapped.
|
||||
if ((stencil->pixels[mo] & (1 << b--)) == 0) {
|
||||
t.r = s.r;
|
||||
}
|
||||
|
||||
if ((stencil->pixels[mo] & (1 << b--)) == 0) {
|
||||
t.l = s.l;
|
||||
}
|
||||
|
||||
target[to++] = t;
|
||||
}
|
||||
mo += 40;
|
||||
so += 156;
|
||||
to += 156;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void jlDrawBlitMap(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, jlSurfaceT source) {
|
||||
|
@ -331,6 +375,32 @@ bool jlGameGetButton(byte which) {
|
|||
}
|
||||
|
||||
|
||||
bool _jlImgCreate(jlImgT **img) {
|
||||
jlImgT *t = (jlImgT *)jlMalloc(sizeof(jlImgT));
|
||||
if (t != NULL) {
|
||||
memset(t, 0, sizeof(jlImgT));
|
||||
t->id[0] = 'I';
|
||||
t->id[1] = 'M';
|
||||
t->id[2] = 'G';
|
||||
t->version = 0;
|
||||
// Backing store does not exist at startup
|
||||
if (_jlBackingStore != NULL) {
|
||||
memcpy(t->palette, _jlBackingStore->palette, sizeof(t->palette));
|
||||
memcpy(t->pixels, _jlBackingStore->pixels, sizeof(t->pixels));
|
||||
}
|
||||
*img = t;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void jlImgDisplay(jlImgT *img) {
|
||||
memcpy(_jlBackingStore->palette, img->palette, sizeof(img->palette));
|
||||
memcpy(_jlBackingStore->pixels, img->pixels, sizeof(img->pixels));
|
||||
}
|
||||
|
||||
|
||||
bool jlKeyPressed(void) {
|
||||
jlUtilIdle();
|
||||
return (_jlNumKeysDown > 0);
|
||||
|
@ -350,8 +420,8 @@ void jlPaletteSet(byte index, byte r, byte g, byte b) {
|
|||
}
|
||||
|
||||
|
||||
void jlPaletteSetFromSta(jlStaT *sta) {
|
||||
memcpy(_jlBackingStore->palette, sta->palette, sizeof(sta->palette));
|
||||
void jlPaletteSetFromImg(jlImgT *img) {
|
||||
memcpy(_jlBackingStore->palette, img->palette, sizeof(img->palette));
|
||||
}
|
||||
|
||||
|
||||
|
@ -434,32 +504,6 @@ void jlSoundPlay(jlSoundT *sound) {
|
|||
}
|
||||
|
||||
|
||||
bool _jlStaCreate(jlStaT **sta) {
|
||||
jlStaT *t = (jlStaT *)jlMalloc(sizeof(jlStaT));
|
||||
if (t != NULL) {
|
||||
memset(t, 0, sizeof(jlStaT));
|
||||
t->id[0] = 'S';
|
||||
t->id[1] = 'T';
|
||||
t->id[2] = 'A';
|
||||
t->version = 0;
|
||||
// Backing store does not exist at startup
|
||||
if (_jlBackingStore != NULL) {
|
||||
memcpy(t->palette, _jlBackingStore->palette, sizeof(t->palette));
|
||||
memcpy(t->pixels, _jlBackingStore->pixels, sizeof(t->pixels));
|
||||
}
|
||||
*sta = t;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void jlStaDisplay(jlStaT *sta) {
|
||||
memcpy(_jlBackingStore->palette, sta->palette, sizeof(sta->palette));
|
||||
memcpy(_jlBackingStore->pixels, sta->pixels, sizeof(sta->pixels));
|
||||
}
|
||||
|
||||
|
||||
char _jlUtilIdleCheckKey(int sym) {
|
||||
|
||||
char key = 0;
|
||||
|
@ -571,7 +615,7 @@ void jlUtilShutdown(void) {
|
|||
}
|
||||
_jlControllerCount = 0;
|
||||
jlFree(_jlControllers);
|
||||
jlStaFree(_jlBackingStore);
|
||||
jlImgFree(_jlBackingStore);
|
||||
jlSoundMusicStop();
|
||||
Mix_CloseAudio();
|
||||
Mix_Quit();
|
||||
|
@ -622,7 +666,7 @@ void jlUtilStartup(char *appTitle) {
|
|||
_jlPixelFormat = SDL_AllocFormat(SDL_GetWindowPixelFormat(_jlWindow));
|
||||
|
||||
// Create backing store
|
||||
jlStaCreate(_jlBackingStore);
|
||||
jlImgCreate(_jlBackingStore);
|
||||
jlPaletteDefault();
|
||||
jlDrawSurfaceSet(JOEY_DISPLAY);
|
||||
jlDrawColorSet(0);
|
||||
|
|
|
@ -460,6 +460,72 @@ void jlDrawLine(jint16 x1, jint16 y1, jint16 x2, jint16 y2) {
|
|||
}
|
||||
|
||||
|
||||
bool _jlImgCopy(jlImgT *source, jlImgT **target) {
|
||||
jlImgT *t = NULL;
|
||||
// Are we copying into a new image?
|
||||
if (*target == NULL) {
|
||||
t = (jlImgT *)jlMalloc(sizeof(jlImgT));
|
||||
if (t == NULL) {
|
||||
return false;
|
||||
}
|
||||
*target = t;
|
||||
}
|
||||
t = (jlImgT *)*target;
|
||||
memcpy(*target, source, sizeof(jlImgT));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void jlImgFree(jlImgT *img) {
|
||||
if (img != NULL) {
|
||||
jlFree(img);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool _jlImgLoad(jlImgT **img, char *filename) {
|
||||
bool result = false;
|
||||
jlImgT *s = NULL;
|
||||
FILE *f = NULL;
|
||||
|
||||
// Are we loading into a new image?
|
||||
if (*img == NULL) {
|
||||
s = (jlImgT *)jlMalloc(sizeof(jlImgT));
|
||||
if (s == NULL) {
|
||||
return result;
|
||||
}
|
||||
*img = s;
|
||||
}
|
||||
s = (jlImgT *)*img;
|
||||
// Load into it.
|
||||
f = fopen(jlUtilMakePathname(filename, "img"), "rb");
|
||||
if (f != NULL) {
|
||||
if (fread(s, sizeof(jlImgT), 1, f) > 0) {
|
||||
// Is this a valid image file?
|
||||
if ((s->id[0] == 'I') && (s->id[1] == 'M') && (s->id[2] == 'G') && (s->version <= 0)) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool jlImgSave(jlImgT *img, char *filename) {
|
||||
bool result = false;
|
||||
FILE *f;
|
||||
|
||||
f = fopen(jlUtilMakePathname(filename, "img"), "wb");
|
||||
if (f != NULL) {
|
||||
if (fwrite(img, sizeof(jlImgT), 1, f) > 0) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void jlKeyWaitForAny(void) {
|
||||
//***TODO*** I don't think this does what we think it does.
|
||||
while (!jlKeyPressed() && !jlUtilMustExit()) ;
|
||||
|
@ -493,49 +559,26 @@ void jlPaletteDefault(void) {
|
|||
}
|
||||
|
||||
|
||||
bool _jlStaCopy(jlStaT *source, jlStaT **target) {
|
||||
jlStaT *t = NULL;
|
||||
// Are we copying into a new image?
|
||||
if (*target == NULL) {
|
||||
t = (jlStaT *)jlMalloc(sizeof(jlStaT));
|
||||
if (t == NULL) {
|
||||
return false;
|
||||
}
|
||||
*target = t;
|
||||
}
|
||||
t = (jlStaT *)*target;
|
||||
memcpy(*target, source, sizeof(jlStaT));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void jlStaFree(jlStaT *sta) {
|
||||
if (sta != NULL) {
|
||||
jlFree(sta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool _jlStaLoad(jlStaT **sta, char *filename) {
|
||||
bool _jlStnLoad(jlStnT **stn, char *filename) {
|
||||
bool result = false;
|
||||
jlStaT *s = NULL;
|
||||
jlStnT *s = NULL;
|
||||
FILE *f = NULL;
|
||||
|
||||
// Are we loading into a new image?
|
||||
if (*sta == NULL) {
|
||||
s = (jlStaT *)jlMalloc(sizeof(jlStaT));
|
||||
// Are we loading into a new stencil?
|
||||
if (*stn == NULL) {
|
||||
s = (jlStnT *)jlMalloc(sizeof(jlStnT));
|
||||
if (s == NULL) {
|
||||
return result;
|
||||
}
|
||||
*sta = s;
|
||||
*stn = s;
|
||||
}
|
||||
s = (jlStaT *)*sta;
|
||||
s = (jlStnT *)*stn;
|
||||
// Load into it.
|
||||
f = fopen(jlUtilMakePathname(filename, "sta"), "rb");
|
||||
f = fopen(jlUtilMakePathname(filename, "stn"), "rb");
|
||||
if (f != NULL) {
|
||||
if (fread(s, sizeof(jlStaT), 1, f) > 0) {
|
||||
// Is this a valid image file?
|
||||
if ((s->id[0] == 'S') && (s->id[1] == 'T') && (s->id[2] == 'A') && (s->version <= 0)) {
|
||||
if (fread(s, sizeof(jlStnT), 1, f) > 0) {
|
||||
// Is this a valid stencil file?
|
||||
if ((s->id[0] == 'S') && (s->id[1] == 'T') && (s->id[2] == 'N') && (s->version <= 0)) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -545,19 +588,11 @@ bool _jlStaLoad(jlStaT **sta, char *filename) {
|
|||
}
|
||||
|
||||
|
||||
bool jlStaSave(jlStaT *sta, char *filename) {
|
||||
bool result = false;
|
||||
FILE *f;
|
||||
|
||||
f = fopen(jlUtilMakePathname(filename, "sta"), "wb");
|
||||
if (f != NULL) {
|
||||
if (fwrite(sta, sizeof(jlStaT), 1, f) > 0) {
|
||||
result = true;
|
||||
void jlStnFree(jlStnT *stn) {
|
||||
if (stn != NULL) {
|
||||
jlFree(stn);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
__attribute__((__format__ (__printf__, 1, 0)))
|
||||
void jlUtilDie(const char *why, ...) {
|
||||
|
|
|
@ -185,7 +185,13 @@ typedef struct {
|
|||
byte version;
|
||||
jlColorT palette[16]; // 4 bits reserved, 4 bits red, 4 green, 4 blue
|
||||
jlPixelPairT pixels[32000]; // 320x200, 4 bits per pixel
|
||||
} jlStaT;
|
||||
} jlImgT;
|
||||
|
||||
typedef struct {
|
||||
char id[3];
|
||||
byte version;
|
||||
byte pixels[8000]; // 320x200, 1 bit per pixel stencil buffer
|
||||
} jlStnT;
|
||||
|
||||
typedef struct _jlStackS {
|
||||
struct _jlStackS *previous;
|
||||
|
@ -233,7 +239,8 @@ void jlDisplayBorder(jlBorderColorsE color);
|
|||
void jlDisplayPresent(void);
|
||||
|
||||
void jlDrawBlit8x8(jlSurfaceT source, jint16 sx, jint16 sy, jint16 tx, jint16 ty);
|
||||
void jlDrawBlit8x8a(jlSurfaceT source, jint16 sx, jint16 sy, jint16 tx, jint16 ty, byte offset);
|
||||
//void jlDrawBlit8x8a(jlSurfaceT source, jint16 sx, jint16 sy, jint16 tx, jint16 ty, byte offset);
|
||||
void jlDrawBlit8x8a(jlSurfaceT source, jlStnT *stencil, jint16 sx, jint16 sy, jint16 tx, jint16 ty);
|
||||
void jlDrawBlitMap(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, jlSurfaceT source);
|
||||
void jlDrawBox(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
|
||||
void jlDrawBoxFilled(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
|
||||
|
@ -253,13 +260,24 @@ void jlDrawSurfaceSet(jlSurfaceT target);
|
|||
jint16 jlGameGetAxis(byte which);
|
||||
bool jlGameGetButton(byte which);
|
||||
|
||||
#define jlImgCopy(source, target) _jlImgCopy(source, (jlImgT **)&(target)) // Syntatic Sugar
|
||||
bool _jlImgCopy(jlImgT *source, jlImgT **target);
|
||||
#define jlImgCreate(img) _jlImgCreate((jlImgT **)&(img)) // Syntatic Sugar
|
||||
bool _jlImgCreate(jlImgT **img);
|
||||
void jlImgDisplay(jlImgT *img);
|
||||
void jlImgFree(jlImgT *img);
|
||||
#define jlImgLoad(img, filename) _jlImgLoad((jlImgT **)&(img), filename) // Syntatic Sugar
|
||||
bool _jlImgLoad(jlImgT **img, char *filename);
|
||||
bool jlImgSave(jlImgT *img, char *filename);
|
||||
#define jlImgSurfaceGet(img) ((jlSurfaceT)img->pixels)
|
||||
|
||||
bool jlKeyPressed(void);
|
||||
char jlKeyRead(void);
|
||||
void jlKeyWaitForAny(void);
|
||||
|
||||
void jlPaletteDefault(void); //***TODO*** Treat palettes like we do "surfaces" - allow changing STAs or display
|
||||
void jlPaletteSet(byte index, byte r, byte g, byte b);
|
||||
void jlPaletteSetFromSta(jlStaT *sta);
|
||||
void jlPaletteSetFromImg(jlImgT *img);
|
||||
|
||||
void jlSoundFree(jlSoundT *sound);
|
||||
bool jlSoundIsPlaying(jlSoundT *sound);
|
||||
|
@ -273,16 +291,9 @@ void jlSoundMusicPlay(char *name);
|
|||
void jlSoundMusicStop(void);
|
||||
void jlSoundPlay(jlSoundT *sound);
|
||||
|
||||
#define jlStaCopy(source, target) _jlStaCopy(source, (jlStaT **)&(target)) // Syntatic Sugar
|
||||
bool _jlStaCopy(jlStaT *source, jlStaT **target);
|
||||
#define jlStaCreate(sta) _jlStaCreate((jlStaT **)&(sta)) // Syntatic Sugar
|
||||
bool _jlStaCreate(jlStaT **sta);
|
||||
void jlStaDisplay(jlStaT *sta);
|
||||
void jlStaFree(jlStaT *sta);
|
||||
#define jlStaLoad(sta, filename) _jlStaLoad((jlStaT **)&(sta), filename) // Syntatic Sugar
|
||||
bool _jlStaLoad(jlStaT **sta, char *filename);
|
||||
bool jlStaSave(jlStaT *sta, char *filename);
|
||||
#define jlStaSurfaceGet(sta) ((jlSurfaceT)sta->pixels)
|
||||
void jlStnFree(jlStnT *stn);
|
||||
#define jlStnLoad(stn, filename) _jlStnLoad((jlStnT **)&(stn), filename) // Syntatic Sugar
|
||||
bool _jlStnLoad(jlStnT **stn, char *filename);
|
||||
|
||||
#define jlUtilByteSwap(twoBytes) ((juint16)((twoBytes) & 0xff) >> 8) | (juint16)((twoBytes) << 8)
|
||||
void jlUtilDie(const char *why, ...) __attribute__((noreturn));
|
||||
|
|
|
@ -33,12 +33,16 @@ segment "testapp";
|
|||
|
||||
|
||||
//extern jint16 asmTest(jlSurfaceT source);
|
||||
#ifdef JOEY_IIGS
|
||||
extern void asmDrawLine(jlSurfaceT target, jint16 color, jint16 x1, jint16 y1, jint16 x2, jint16 y2);
|
||||
#else
|
||||
#define asmDrawLine(s,c,x1,y1,x2,y2) jlDrawLine(x1,y1,x2,y2)
|
||||
#endif
|
||||
|
||||
|
||||
// Font hacking!
|
||||
__attribute__((__format__ (__printf__, 4, 0)))
|
||||
void printAt(jlStaT *font, jint16 cx, jint16 cy, const char *what, ...) {
|
||||
void printAt(jlImgT *font, jint16 cx, jint16 cy, const char *what, ...) {
|
||||
jint16 x;
|
||||
jint16 y;
|
||||
jint16 tx;
|
||||
|
@ -55,9 +59,11 @@ void printAt(jlStaT *font, jint16 cx, jint16 cy, const char *what, ...) {
|
|||
ty = cy * 8;
|
||||
|
||||
for (counter=0; counter<(int)strlen(msg); counter++) {
|
||||
x = (msg[counter] - ' ') % 40;
|
||||
y = (msg[counter] - ' ') / 40;
|
||||
jlDrawBlit8x8(jlStaSurfaceGet(font), x, y, tx, ty);
|
||||
//x = (msg[counter] - ' ') % 40;
|
||||
//y = (msg[counter] - ' ') / 40;
|
||||
x = msg[counter] % 40;
|
||||
y = msg[counter] / 40;
|
||||
jlDrawBlit8x8(jlImgSurfaceGet(font), x, y, tx, ty);
|
||||
tx += 8;
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +71,8 @@ void printAt(jlStaT *font, jint16 cx, jint16 cy, const char *what, ...) {
|
|||
|
||||
void lineTest(void) {
|
||||
|
||||
jlStaT *kanga = NULL;
|
||||
jlStaT *font = NULL;
|
||||
jlImgT *kanga = NULL;
|
||||
jlImgT *font = NULL;
|
||||
jint16 y;
|
||||
jint16 phase = 0;
|
||||
jint16 x2 = 0;
|
||||
|
@ -78,10 +84,10 @@ void lineTest(void) {
|
|||
jint16 nextColor = 1;
|
||||
char what[32];
|
||||
|
||||
if (!jlStaLoad(kanga, "kanga")) jlUtilDie("Unable to load kanga.sta!");
|
||||
if (!jlStaLoad(font, "font")) jlUtilDie("Unable to load font.sta!");
|
||||
if (!jlImgLoad(kanga, "kanga")) jlUtilDie("Unable to load kanga.sta!");
|
||||
if (!jlImgLoad(font, "font")) jlUtilDie("Unable to load font.sta!");
|
||||
|
||||
jlStaDisplay(kanga);
|
||||
jlImgDisplay(kanga);
|
||||
jlDrawColorSet(1);
|
||||
jlDrawBox(0, 0, 319, 199);
|
||||
|
||||
|
@ -162,19 +168,22 @@ void lineTest(void) {
|
|||
|
||||
jlSoundMusicStop();
|
||||
|
||||
jlStaFree(font);
|
||||
jlStaFree(kanga);
|
||||
jlImgFree(font);
|
||||
jlImgFree(kanga);
|
||||
}
|
||||
|
||||
|
||||
void blitTest(void) {
|
||||
jlStaT *font = NULL;
|
||||
jlImgT *font = NULL;
|
||||
jlStnT *stencil = NULL;
|
||||
jint16 y;
|
||||
jint16 x;
|
||||
bool doOnce = true;
|
||||
|
||||
if (!jlStaLoad(font, "font")) jlUtilDie("Unable to load font.sta!");
|
||||
if (!jlImgLoad(font, "font")) jlUtilDie("Unable to load font.sta!");
|
||||
if (!jlStnLoad(stencil, "font")) jlUtilDie("Unable to load font.stn!");
|
||||
|
||||
jlStaDisplay(font);
|
||||
jlImgDisplay(font);
|
||||
jlDisplayPresent();
|
||||
jlKeyWaitForAny();
|
||||
|
||||
|
@ -185,10 +194,18 @@ void blitTest(void) {
|
|||
y = 91;
|
||||
while (!jlKeyPressed()) {
|
||||
for (x=0; x<319-8; x++) {
|
||||
jlDrawBlit8x8(jlStaSurfaceGet(font), 6, 3, x, y);
|
||||
|
||||
if (doOnce) {
|
||||
jlDrawBlit8x8a(jlImgSurfaceGet(font), stencil, 0, 2, 24, 24);
|
||||
jlDrawBlit8x8(jlImgSurfaceGet(font), 0, 2, 40, 24);
|
||||
doOnce = false;
|
||||
}
|
||||
|
||||
jlDrawBlit8x8(jlImgSurfaceGet(font), 1, 0, x, y);
|
||||
printAt(font, 1, 1, "Drawing at %d x %d ", x, y);
|
||||
jlDisplayPresent();
|
||||
jlDrawBlit8x8(jlStaSurfaceGet(font), 0, 0, x, y);
|
||||
jlDrawBlit8x8(jlImgSurfaceGet(font), 0, 0, x, y);
|
||||
jlUtilSleep(1);
|
||||
if (jlKeyPressed()) {
|
||||
break;
|
||||
}
|
||||
|
@ -196,15 +213,16 @@ void blitTest(void) {
|
|||
}
|
||||
jlKeyRead();
|
||||
|
||||
jlStaFree(font);
|
||||
jlStnFree(stencil);
|
||||
jlImgFree(font);
|
||||
}
|
||||
|
||||
|
||||
int main(void) {
|
||||
jlUtilStartup("JoeyLib Test");
|
||||
|
||||
lineTest();
|
||||
//blitTest();
|
||||
//lineTest();
|
||||
blitTest();
|
||||
|
||||
jlUtilShutdown();
|
||||
}
|
||||
|
|
|
@ -48,8 +48,7 @@ else
|
|||
fi
|
||||
|
||||
# Call custom converter
|
||||
#${JOEY}/utils
|
||||
./imgconvert "${FILENAME}-DoNtEvErDoThIs-1.png" "${FILENAME}-DoNtEvErDoThIs-2.png" "${NAME}"
|
||||
${JOEY}/utils/imgconvert "${FILENAME}-DoNtEvErDoThIs-1.png" "${FILENAME}-DoNtEvErDoThIs-2.png" "${NAME}"
|
||||
mv "data/${NAME}.sta" .
|
||||
|
||||
# Remove data folder if we created one
|
||||
|
|
Loading…
Add table
Reference in a new issue