Simplify ags_drawStringToSurface()

This commit is contained in:
kichikuou
2020-08-08 22:57:22 +09:00
parent 3cecc58607
commit 652e4b9111
5 changed files with 15 additions and 12 deletions
+4 -2
View File
@@ -210,7 +210,8 @@ int nt_scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cTex
// 勝手に出ていいのかな?
if (strlen(cText) == 0) return OK;
agsurface_t *glyph = ags_drawStringToSurface(FONT_GOTHIC, wSize, cText);
ags_setFont(FONT_GOTHIC, wSize);
agsurface_t *glyph = ags_drawStringToSurface(cText);
i = malloc(sizeof(cginfo_t));
i->type = CG_SET;
i->no = wNumCG;
@@ -244,7 +245,8 @@ int nt_scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFi
}
sprintf(s, ss, wValue);
agsurface_t *glyph = ags_drawStringToSurface(FONT_GOTHIC, wSize, s);
ags_setFont(FONT_GOTHIC, wSize);
agsurface_t *glyph = ags_drawStringToSurface(s);
i = malloc(sizeof(cginfo_t));
i->type = CG_SET;
+4 -2
View File
@@ -208,7 +208,8 @@ int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) {
// 勝手に出ていいのかな?
if (v_strlen(wText -1) == 0) return OK;
agsurface_t *glyph = ags_drawStringToSurface(FONT_GOTHIC, wSize, v_str(wText -1));
ags_setFont(FONT_GOTHIC, wSize);
agsurface_t *glyph = ags_drawStringToSurface(v_str(wText -1));
i = malloc(sizeof(cginfo_t));
i->type = CG_SET;
i->no = wNumCG;
@@ -242,7 +243,8 @@ int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs,
}
sprintf(s, ss, wValue);
agsurface_t *glyph = ags_drawStringToSurface(FONT_GOTHIC, wSize, s);
ags_setFont(FONT_GOTHIC, wSize);
agsurface_t *glyph = ags_drawStringToSurface(s);
i = malloc(sizeof(cginfo_t));
i->type = CG_SET;
+4 -2
View File
@@ -60,7 +60,8 @@ int dt_setfont(int type, int size) {
int dt_drawtext(surface_t *sf, int x, int y, char *buf) {
int sx, sy, sw, sh;
agsurface_t *glyph = ags_drawStringToSurface(ftype, fsize, buf);
ags_setFont(ftype, fsize);
agsurface_t *glyph = ags_drawStringToSurface(buf);
if (glyph == NULL) return 0;
sx = x; sy = y;
@@ -89,7 +90,8 @@ int dt_drawtext(surface_t *sf, int x, int y, char *buf) {
int dt_drawtext_col(surface_t *sf, int x, int y, char *buf, int r, int g, int b) {
int sx, sy, sw, sh;
agsurface_t *glyph = ags_drawStringToSurface(ftype, fsize, buf);
ags_setFont(ftype, fsize);
agsurface_t *glyph = ags_drawStringToSurface(buf);
if (glyph == NULL) return 0;
sx = x; sy = y;
+2 -4
View File
@@ -409,11 +409,9 @@ int ags_drawString(int x, int y, const char *src, int col) {
return w;
}
agsurface_t *ags_drawStringToSurface(int type, int size, const char *str) {
FONT *font = nact->ags.font;
font->sel_font(type, size);
agsurface_t *ags_drawStringToSurface(const char *str) {
char *utf8 = sjis2utf(str);
agsurface_t *sf = font->get_glyph(utf8);
agsurface_t *sf = nact->ags.font->get_glyph(utf8);
free(utf8);
return sf;
}
+1 -2
View File
@@ -224,7 +224,6 @@ extern void ags_whiteOut(int rate, boolean flg);
extern void ags_fader_callback();
/* フォント関連 */
typedef enum {
FONT_X11,
FONT_FT2,
@@ -236,6 +235,7 @@ enum FontType {
FONT_MINCHO,
};
extern void ags_setFont(int type, int size);
extern agsurface_t *ags_drawStringToSurface(const char *str);
/* カーソル関係 */
extern void ags_setCursorType(int type);
@@ -249,7 +249,6 @@ extern void ags_setAntialiasedStringMode(boolean mode);
extern boolean ags_getAntialiasedStringMode();
extern void ags_fader(ags_faderinfo_t *);
extern void ags_autorepeat(boolean bool);
extern agsurface_t *ags_drawStringToSurface(int type, int size, const char *str);
#define RGB_RMASK15 0x7c00
#define RGB_GMASK15 0x03e0