Add enable_zb option for enabling ZB command

By default it is disabled and normal weight is always used.

Issue: https://github.com/kichikuou/xsystem35-sdl2/issues/44
This commit is contained in:
kichikuou
2024-01-18 08:27:46 +09:00
parent 183ceb614a
commit 47e2fcaec0
10 changed files with 34 additions and 13 deletions
+4 -1
View File
@@ -120,7 +120,7 @@ boolean ags_check_param_xy(int *x, int *y) {
return TRUE;
}
void ags_init(const char *render_driver) {
void ags_init(const char *render_driver, bool enable_zb) {
nact->ags.mouse_warp_enabled = true;
nact->ags.world_size.width = SYS35_DEFAULT_WIDTH;
nact->ags.world_size.height = SYS35_DEFAULT_HEIGHT;
@@ -129,6 +129,9 @@ void ags_init(const char *render_driver) {
nact->ags.view_area.y = 0;
nact->ags.view_area.w = SYS35_DEFAULT_WIDTH;
nact->ags.view_area.h = SYS35_DEFAULT_HEIGHT;
nact->ags.enable_zb = enable_zb;
nact->ags.font_weight = enable_zb ? FONT_WEIGHT_BOLD : FONT_WEIGHT_NORMAL;
sdl_Initialize(render_driver);
font_init();
+4 -1
View File
@@ -113,7 +113,10 @@ struct _ags {
agsurface_t *dib; /* main surface */
void (*eventcb)(agsevent_t *e); /* deliver event */
int font_weight;
bool mouse_warp_enabled;
bool enable_zb;
boolean noantialias; /* antialias を使用しない */
boolean noimagecursor; /* リソースファイルのカーソルを読みこまない */
};
@@ -122,7 +125,7 @@ typedef struct _ags ags_t;
/* 初期化関係 */
void ags_init(const char *render_driver);
void ags_init(const char *render_driver, bool enable_zb);
void ags_remove(void);
void ags_reset(void);
+2 -2
View File
@@ -115,8 +115,8 @@ void commandZB() {
/* メッセージ文字を太さを設定 */
int weight = getCaliValue();
nact->msg.MsgFontWeight = weight;
nact->sel.MsgFontWeight = weight;
if (nact->ags.enable_zb)
nact->ags.font_weight = weight;
DEBUG_COMMAND("ZB %d:", weight);
}
+1
View File
@@ -32,6 +32,7 @@
#define FONTTYPEMAX 2
#define FONT_WEIGHT_NORMAL 4
#define FONT_WEIGHT_BOLD 7
extern void font_init(void);
extern void font_set_name_and_index(int type, const char *name, int index);
+4 -4
View File
@@ -64,9 +64,8 @@ static void msgget_at_a();
void msg_init() {
/* メッセージフォントの大きさ */
msg.MsgFontSize = 16;
msg.MsgFontWeight = 7;
msg.MsgFont = FONT_GOTHIC;
msg.MsgFontSize = 16;
msg.MsgFont = FONT_GOTHIC;
/* 各種色 */
msg.MsgFontColor = 255;
@@ -141,7 +140,8 @@ void msg_putMessage(const char *m) {
// fprintf(stdout, "x=%d, y = %d, msg=%s\n", msgcur.x,msgcur.y,msg);
if (!msg.mg_dspMsg) return;
ags_setFontWithWeight(msg.MsgFont, msg.MsgFontSize, msg.MsgFontWeight);
ags_setFontWithWeight(msg.MsgFont, msg.MsgFontSize, nact->ags.font_weight);
switch(msgDecorateType) {
case 0:
default:
-1
View File
@@ -44,7 +44,6 @@ extern void msg_mg6_command(int cmd);
struct __message {
/* メッセージフォントの大きさ */
int MsgFontSize;
int MsgFontWeight;
int MsgFont;
/* 各種色 */
+1 -2
View File
@@ -93,7 +93,6 @@ void sel_init() {
/* メッセージフォントの大きさ */
sel.MsgFontSize = 16;
sel.MsgFontWeight = 7;
/* 各種色 */
sel.MsgFontColor = 255;
@@ -302,7 +301,7 @@ static void init_selwindow() {
NOTICE("frameType is Default");
break;
}
ags_setFontWithWeight(FONT_GOTHIC, sel.MsgFontSize, sel.MsgFontWeight);
ags_setFontWithWeight(FONT_GOTHIC, sel.MsgFontSize, nact->ags.font_weight);
for (i = 0; i < regnum; i++) {
DEBUG_MESSAGE("%d:%s\n", i +1, elm[i]);
ags_drawString(r.x +2, r.y + i * (sel.MsgFontSize +2) +1, elm[i], sel.MsgFontColor);
-1
View File
@@ -55,7 +55,6 @@ struct _selection {
/* メッセージフォントの大きさ */
int MsgFontSize;
int MsgFontWeight;
/* 各種色 */
int MsgFontColor;
+11 -1
View File
@@ -97,6 +97,7 @@ static char *fontname_tt[FONTTYPEMAX] = {DEFAULT_GOTHIC_TTF, DEFAULT_MINCHO_TTF}
static char fontface[FONTTYPEMAX];
static boolean font_noantialias;
static bool enable_zb = false;
static bool integer_scaling = false;
/* fullscreen on from command line */
static boolean fs_on;
@@ -210,7 +211,7 @@ static void sys35_init() {
v_init();
ags_init(render_driver);
ags_init(render_driver, enable_zb);
for (i = 0; i < FONTTYPEMAX; i++)
font_set_name_and_index(i, fontname_tt[i], fontface[i]);
@@ -293,6 +294,8 @@ static void sys35_ParseOption(int *argc, char **argv) {
fs_on = TRUE;
} else if (0 == strcmp(argv[i], "-noantialias")) {
font_noantialias = TRUE;
} else if (0 == strcmp(argv[i], "-enable_zb")) {
enable_zb = TRUE;
} else if (0 == strcmp(argv[i], "-ttfont_gothic")) {
if (argv[i + 1] != NULL) {
fontname_tt[FONT_GOTHIC] = argv[i + 1];
@@ -354,6 +357,13 @@ static void check_profile() {
font_noantialias = TRUE;
}
}
/* Enable ZB command (font weight) */
param = get_profile("enable_zb");
if (param) {
if (0 == strcmp(param, "Yes")) {
enable_zb = TRUE;
}
}
/* Audio buffer size */
param = get_profile("audio_buffer_size");
if (param) {
+7
View File
@@ -97,3 +97,10 @@
#no_imagecursor: Yes
# -----------------------------------------------------------
# Enables the ZB command (change the font weight). It is disabled by default
# because it makes the text too bold with our default fonts.
# This option is experimental and may be removed in the future. See
# https://github.com/kichikuou/xsystem35-sdl2/issues/44 for details.
#enable_zb: Yes