public static void GameStart() { foreach (string dllFile in "DxLib.dll:DxLib_x64.dll:DxLibDotNet.dll".Split(':')) // DxLibDotNet.dll 等の存在確認 (1) { if (!File.Exists(dllFile)) { throw new DDError(); } } DX.GetColor(0, 0, 0); // DxLibDotNet.dll 等の存在確認 (2) DDConfig.Load(); // LogFile, LOG_ENABLED 等を含むので真っ先に // Log > File.WriteAllBytes(DDConfig.LogFile, SCommon.EMPTY_BYTES); ProcMain.WriteLog = message => { if (LogCount < DDConfig.LogCountMax) { using (StreamWriter writer = new StreamWriter(DDConfig.LogFile, true, Encoding.UTF8)) { writer.WriteLine("[" + DateTime.Now + "] " + message); } LogCount++; } }; // < Log // *.INIT { DDGround.INIT(); DDResource.INIT(); DDDatStrings.INIT(); DDUserDatStrings.INIT(); DDFontRegister.INIT(); DDKey.INIT(); } DDSaveData.Load(); // DxLib > if (DDConfig.LOG_ENABLED) { DX.SetApplicationLogSaveDirectory(SCommon.MakeFullPath(DDConfig.ApplicationLogSaveDirectory)); } DX.SetOutApplicationLogValidFlag(DDConfig.LOG_ENABLED ? 1 : 0); // DxLib のログを出力 1: する 0: しない DX.SetAlwaysRunFlag(1); // ? 非アクティブ時に 1: 動く 0: 止まる SetMainWindowTitle(); //DX.SetGraphMode(DDConsts.Screen_W, DDConsts.Screen_H, 32); DX.SetGraphMode(DDGround.RealScreen_W, DDGround.RealScreen_H, 32); DX.ChangeWindowMode(1); // 1: ウィンドウ 0: フルスクリーン //DX.SetFullSceneAntiAliasingMode(4, 2); // フルスクリーンを廃止したので不要 DX.SetWindowIconHandle(GetAppIcon()); // ウィンドウ左上のアイコン if (0 <= DDConfig.DisplayIndex) { DX.SetUseDirectDrawDeviceIndex(DDConfig.DisplayIndex); } if (DX.DxLib_Init() != 0) // ? 失敗 { throw new DDError(); } Finalizers.Add(() => { if (DX.DxLib_End() != 0) // ? 失敗 { throw new DDError(); } }); DDUtils.SetMouseDispMode(DDGround.RO_MouseDispMode); // ? マウスを表示する。 DX.SetWindowSizeChangeEnableFlag(0); // ウィンドウの右下をドラッグで伸縮 1: する 0: しない //DX.SetDrawScreen(DX.DX_SCREEN_BACK); DX.SetDrawMode(DDConsts.DEFAULT_DX_DRAWMODE); // これをデフォルトとする。 // < DxLib DDGround.MainScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H); DDGround.MainScreen.ChangeDrawScreen(); DDGround.LastMainScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H); DDGround.KeptMainScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H); if (DDConfig.DisplayIndex == -2) { I2Point mousePt = DDWin32.GetMousePosition(); I4Rect[] monitors = DDWin32.GetAllMonitor(); I4Rect activeMonitor = monitors[0]; // マウス位置のモニタを特定出来ない場合のモニタ foreach (I4Rect monitor in monitors) { if ( monitor.L <= mousePt.X && mousePt.X < monitor.R && monitor.T <= mousePt.Y && mousePt.Y < monitor.B ) { activeMonitor = monitor; break; } } DDGround.MonitorRect = activeMonitor; } else { int l; int t; int w; int h; int p1; int p2; int p3; int p4; DX.GetDefaultState(out w, out h, out p1, out p2, out l, out t, out p3, out p4); if ( w < 1 || SCommon.IMAX < w || h < 1 || SCommon.IMAX < h || l < -SCommon.IMAX || SCommon.IMAX < l || t < -SCommon.IMAX || SCommon.IMAX < t ) { throw new DDError(); } DDGround.MonitorRect = new I4Rect(l, t, w, h); } PostSetScreenSize(DDGround.RealScreen_W, DDGround.RealScreen_H); // Font { //DDFontRegister.Add(@"e20200928_NovelAdv\Font\Genkai-Mincho-font\genkai-mincho.ttf"); //DDFontRegister.Add(@"e20200928_NovelAdv\Font\riitf\RiiT_F.otf"); DDFontRegister.Add(@"dat\Font\K Gothic\K Gothic.ttf"); DDFontRegister.Add(@"dat\Font\焚火フォント\03Takibi-Regular.otf"); //DDFontRegister.Add(@"dat\Font\廻想体\Kaiso-Next-B.otf"); DDFontRegister.Add(@"dat\Font\木漏れ日ゴシック\komorebi-gothic.ttf"); } Ground.I = new Ground(); Ground.I.Picture2 = new ResourcePicture2(); // Ground.I を参照しているので Ground のコンストラクタには書けない。 MainWin.I.PostGameStart_G3(); DDSaveData.Load_Delay(); Finalizers.Add(() => { DDSaveData.Save(); }); }
private void Main4() { // *.INIT { // アプリ固有 > //RippleEffect.INIT(); //画面分割.INIT(); //画面分割_Effect.INIT(); // < アプリ固有 } #region Charge To DDTouch // DDCCResource 等のための Touch //DDTouch.Add(TitleMenu.TouchWallDrawerResources); // 個別に設定 //DDTouch.Add(Ground.I.Picture.XXX); //DDTouch.Add(Ground.I.Music.XXX); //DDTouch.Add(Ground.I.SE.XXX); // 全部設定 //DDTouch.AddAllPicture(); //DDTouch.AddAllMusic(); //DDTouch.AddAllSE(); #endregion //DDTouch.Touch(); // moved -> Logo if (DDConfig.LOG_ENABLED) { DDEngine.DispDebug = () => { DDPrint.SetPrint(); DDPrint.SetBorder(new I3Color(0, 0, 0)); DDPrint.Print(string.Join(" ", DDEngine.FrameProcessingMillis, DDEngine.FrameProcessingMillis_Worst, DDMouse.X, DDMouse.Y // デバッグ表示する情報をここへ追加.. )); DDPrint.Reset(); }; } if (ProcMain.DEBUG) { Main4_Debug(); } else if (ProcMain.ArgsReader.HasArgs()) // シナリオファイルを指定して実行 { string name = ProcMain.ArgsReader.NextArg(); string scenarioRootDir = Path.Combine(ProcMain.SelfDir, DDConsts.ResourceDir_InternalRelease, Scenario.SCENARIO_FILE_PREFIX); scenarioRootDir = SCommon.MakeFullPath(scenarioRootDir); name = SCommon.MakeFullPath(name); name = SCommon.ChangeRoot(name, scenarioRootDir); name = Path.Combine(Path.GetDirectoryName(name), Path.GetFileNameWithoutExtension(name)); // remove extention using (new Game()) { Game.I.Status.Scenario = new Scenario(name); Game.I.Perform(); } } else { Main4_Release(); } }
private void Main4() { // *.INIT { // アプリ固有 > //RippleEffect.INIT(); //画面分割.INIT(); //画面分割_Effect.INIT(); // < アプリ固有 } //DDTouch.Touch(); // moved -> Logo if (DDConfig.LOG_ENABLED) { DDEngine.DispDebug = () => { DDPrint.SetPrint(); DDPrint.SetBorder(new I3Color(0, 0, 0)); DDPrint.Print(string.Join( " ", DDMouse.X, DDMouse.Y, Game.I == null ? "-" : "" + Game.I.Status.CurrPageIndex, // デバッグ表示する情報をここへ追加.. DDEngine.FrameProcessingMillis, DDEngine.FrameProcessingMillis_Worst )); DDPrint.Reset(); }; } if (ProcMain.DEBUG) { Main4_Debug(); } else if (ProcMain.ArgsReader.HasArgs()) // シナリオファイルを指定して実行 { string name = ProcMain.ArgsReader.NextArg(); string scenarioRootDir = Path.Combine(ProcMain.SelfDir, DDConsts.ResourceDir_InternalRelease, Scenario.SCENARIO_FILE_PREFIX); scenarioRootDir = SCommon.MakeFullPath(scenarioRootDir); name = SCommon.MakeFullPath(name); name = SCommon.ChangeRoot(name, scenarioRootDir); name = Path.Combine(Path.GetDirectoryName(name), Path.GetFileNameWithoutExtension(name)); // remove extention using (new Game()) { Game.I.Status.Scenario = new Scenario(name); Game.I.Perform(); } } else { Main4_Release(); } }