diff --git a/src/sdlmain.cpp b/src/sdlmain.cpp index e00bf04..b849dae 100644 --- a/src/sdlmain.cpp +++ b/src/sdlmain.cpp @@ -28,15 +28,19 @@ int main(int argc, char *argv[]) g_window = SDL_CreateWindow(buf, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 400, 0); + const char *fontfile = "MTLc3m.ttf"; + for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-antialias") == 0) ags_setAntialiasedStringMode(1); if (strcmp(argv[i], "-savedir") == 0) FILEIO::SetSaveDir(argv[++i]); + if (strcmp(argv[i], "-fontfile") == 0) + fontfile = argv[++i]; } // system3 åˆ�期化 - NACT* nact = new NACT(); + NACT* nact = new NACT(fontfile); _TCHAR title[128]; if(nact->get_title(title, 128)) { diff --git a/src/sys/ags.cpp b/src/sys/ags.cpp index cb959c7..00d9311 100644 --- a/src/sys/ags.cpp +++ b/src/sys/ags.cpp @@ -33,7 +33,7 @@ static SDL_Surface* display_surface; box[n].ey = y2; \ } -AGS::AGS(NACT* parent) : nact(parent) +AGS::AGS(NACT* parent, const char* fontfile) : nact(parent) { sdlRenderer = SDL_CreateRenderer(g_window, -1, 0); SDL_RenderSetLogicalSize(sdlRenderer, 640, 400); @@ -60,12 +60,15 @@ AGS::AGS(NACT* parent) : nact(parent) // ƒtƒHƒ“ƒg TTF_Init(); - const char fontfile[] = "MTLc3m.ttf"; hFont16 = TTF_OpenFont(fontfile, 16); hFont24 = TTF_OpenFont(fontfile, 24); hFont32 = TTF_OpenFont(fontfile, 32); hFont48 = TTF_OpenFont(fontfile, 48); hFont64 = TTF_OpenFont(fontfile, 64); + if (!hFont16 || !hFont24 || !hFont32 || !hFont48 || !hFont64) { + printf("Cannot open font file %s\n", fontfile); + exit(1); + } // ƒJ�[ƒ\ƒ‹�‰Šú‰» for(int i = 0; i < 10; i++) { diff --git a/src/sys/ags.h b/src/sys/ags.h index 6a2f854..983a1bb 100644 --- a/src/sys/ags.h +++ b/src/sys/ags.h @@ -99,7 +99,7 @@ private: uint32 fader_screen[640 * 480]; public: - AGS(NACT* parent); + AGS(NACT* parent, const char* fontfile); ~AGS(); void flush_screen(bool update); diff --git a/src/sys/nact.cpp b/src/sys/nact.cpp index 4ca1f66..08ca0c4 100644 --- a/src/sys/nact.cpp +++ b/src/sys/nact.cpp @@ -13,7 +13,7 @@ // �‰Šú‰» -NACT::NACT() +NACT::NACT(const char* fontfile) { mouse_x = mouse_y = 0; @@ -110,7 +110,7 @@ NACT::NACT() #endif // ŠeŽíƒNƒ‰ƒX�¶�¬ - ags = new AGS(this); + ags = new AGS(this, fontfile); mako = new MAKO(this); #ifdef USE_JOY diff --git a/src/sys/nact.h b/src/sys/nact.h index ea7d1b9..794cb28 100644 --- a/src/sys/nact.h +++ b/src/sys/nact.h @@ -231,7 +231,7 @@ private: void release_console(); public: - NACT(); + NACT(const char* fontfile); ~NACT(); void mainloop();