You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
general updates
This commit is contained in:
6
config.h
6
config.h
@@ -7,8 +7,10 @@
|
||||
#include "fonts/impact.h"
|
||||
|
||||
// get your font symbols defined here
|
||||
#define s2d_font impact_obj
|
||||
#define s2d_tex impact_tex
|
||||
#define s2d_font impact_obj
|
||||
#define s2d_tex impact_tex
|
||||
#define s2d_kerning_table impact_kerning_table
|
||||
extern char s2d_kerning_table[];
|
||||
|
||||
// Debug: bypass custom matrix setup
|
||||
#define s2d_mat impact_mtx
|
||||
|
||||
@@ -18,6 +18,7 @@ Gfx s2d_text_init_dl[] = {
|
||||
gsDPSetBlendColor(0, 0, 0, 0x01),
|
||||
|
||||
// IA8
|
||||
// TODO: add more formats
|
||||
gsDPSetCombineLERP(0, 0, 0, ENVIRONMENT,
|
||||
0, 0, 0, TEXEL0,
|
||||
0, 0, 0, ENVIRONMENT,
|
||||
@@ -35,7 +36,8 @@ void s2d_rdp_init(void) {
|
||||
gSPObjRenderMode(gdl_head++, G_OBJRM_XLU | G_OBJRM_BILERP);
|
||||
}
|
||||
|
||||
void setup_font(int idx) {
|
||||
void setup_font_texture(int idx) {
|
||||
gDPPipeSync(gdl_head++);
|
||||
gDPSetEnvColor(gdl_head++, s2d_red, s2d_green, s2d_blue, s2d_alpha);
|
||||
gSPObjLoadTxtr(gdl_head++, &s2d_tex[idx]);
|
||||
}
|
||||
@@ -84,12 +86,13 @@ void mtx_pipeline2(uObjMtx *m, int x, int y) {
|
||||
#define CLAMP_0(x) ((x < 0) ? 0 : x)
|
||||
|
||||
void draw_s2d_glyph(char c, int x, int y, uObjMtx *mt) {
|
||||
setup_font(c);
|
||||
setup_font_texture(c);
|
||||
|
||||
// mtx_pipeline(mt, x, y);
|
||||
mtx_pipeline2(mt, x, y);
|
||||
|
||||
if (drop_shadow) {
|
||||
gDPPipeSync(gdl_head++);
|
||||
gDPSetEnvColor(gdl_head++,
|
||||
CLAMP_0(s2d_red - 100),
|
||||
CLAMP_0(s2d_green - 100),
|
||||
|
||||
@@ -11,7 +11,7 @@ extern int s2d_red, s2d_green, s2d_blue, s2d_alpha;
|
||||
|
||||
extern void s2d_rdp_init(void);
|
||||
|
||||
extern void setup_font(int idx);
|
||||
extern void setup_font_texture(int idx);
|
||||
|
||||
extern void mtx_pipeline(uObjMtx *m, int x, int y);
|
||||
|
||||
|
||||
20
s2d_kerning_table.c
Normal file
20
s2d_kerning_table.c
Normal file
@@ -0,0 +1,20 @@
|
||||
char impact_kerning_table[] = {
|
||||
// unprintable characters
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
// start of ascii
|
||||
2, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
};
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
void s2d_snprint(int x, int y, const char *str, uObjMtx *buf, int len) {
|
||||
char *p = str;
|
||||
int tx = 0, ty = 0;
|
||||
int tmp_len = 0;
|
||||
int orig_x = x;
|
||||
int orig_y = y;
|
||||
@@ -73,10 +72,7 @@ void s2d_snprint(int x, int y, const char *str, uObjMtx *buf, int len) {
|
||||
break;
|
||||
default:
|
||||
if (current_char != '\0') {
|
||||
if (myDegrees == 0)
|
||||
draw_s2d_glyph(current_char, (x += (8 * myScale)) + tx, y + ty, (buf++));
|
||||
else
|
||||
draw_s2d_glyph(current_char, (x += ((8 * myScale))) + tx, y + ty, (buf++));
|
||||
draw_s2d_glyph(current_char, (x += (s2d_kerning_table[current_char] * myScale)), y, (buf++));
|
||||
}
|
||||
}
|
||||
if (*p == '\0') break;
|
||||
@@ -85,8 +81,6 @@ void s2d_snprint(int x, int y, const char *str, uObjMtx *buf, int len) {
|
||||
} while (tmp_len < len);
|
||||
myScale = 1;
|
||||
myDegrees = 0;
|
||||
tx = 0;
|
||||
ty = 0;
|
||||
}
|
||||
|
||||
void s2d_print(int x, int y, const char *str, uObjMtx *buf) {
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
#define TRANSLATE "\x82" // TRANSLATE (x) (y)
|
||||
#define COLOR "\x83" // COLOR (r) (g) (b) (a)
|
||||
#define DROPSHADOW "\x84" // DROPSHADOW (no params)
|
||||
#define BACKGROUND "\x85" // BACKGROUND (w) (h) (alpha)
|
||||
|
||||
#define CH_SCALE '\x80'
|
||||
#define CH_ROT '\x81'
|
||||
#define CH_TRANSLATE '\x82'
|
||||
#define CH_COLOR '\x83'
|
||||
#define CH_DROPSHADOW '\x84'
|
||||
#define CH_BACKGROUND '\x85'
|
||||
|
||||
// ASCII standard escape codes
|
||||
#define CH_NEWLINE '\n'
|
||||
|
||||
Reference in New Issue
Block a user