Add -fontfile option

This commit is contained in:
kichikuou
2019-08-18 18:31:26 +09:00
parent ad05155e70
commit e417118713
5 changed files with 14 additions and 7 deletions
+5 -1
View File
@@ -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)) {
+5 -2
View File
@@ -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)
// フォント
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);
}
// カーソル初期化
for(int i = 0; i < 10; i++) {
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -13,7 +13,7 @@
// 初期化
NACT::NACT()
NACT::NACT(const char* fontfile)
{
mouse_x = mouse_y = 0;
@@ -110,7 +110,7 @@ NACT::NACT()
#endif
// 各種クラス生成
ags = new AGS(this);
ags = new AGS(this, fontfile);
mako = new MAKO(this);
#ifdef USE_JOY
+1 -1
View File
@@ -231,7 +231,7 @@ private:
void release_console();
public:
NACT();
NACT(const char* fontfile);
~NACT();
void mainloop();