private static IntPtr GetAppIcon() { using (MemoryStream mem = new MemoryStream(DDResource.Load(@"dat\General\game_app.ico"))) { return(new Icon(mem).Handle); } }
public static void INIT() { string[] lines = SCommon.TextToLines(SCommon.ENCODING_SJIS.GetString(DDResource.Load(DatStringsFile))); foreach (string line in lines) { int p = line.IndexOf('='); if (p == -1) { throw new DDError(); } string name = line.Substring(0, p); string value = line.Substring(p + 1); Name2Value.Add(name, value); } }
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(); }); }
public DDSound(string file) : this(() => DDResource.Load(file)) { }
public static byte[] File2FileData(string file) { return(DDResource.Load(file)); }
public DDSound(string file, int handleCount) : this(() => DDResource.Load(file), handleCount) { }
public static void Add(string file) { Add(DDResource.Load(file), Path.GetFileName(file)); }