Esempio n. 1
0
        public static DDPicture Mirror(string file, I4Rect derRect)
        {
            return(new DDPicture(
                       () =>
            {
                int siHandle = DDPictureLoaderUtils.FileData2SoftImage(DDPictureLoaderUtils.File2FileData(file));
                //int w;
                //int h;

                //DDPictureLoaderUtils.GetSoftImageSize(siHandle, out w, out h);

                {
                    int h2 = DDPictureLoaderUtils.CreateSoftImage(derRect.W * 2, derRect.H);

                    for (int x = 0; x < derRect.W; x++)
                    {
                        for (int y = 0; y < derRect.H; y++)
                        {
                            DDPictureLoaderUtils.Dot dot = DDPictureLoaderUtils.GetSoftImageDot(
                                siHandle,
                                derRect.L + x,
                                derRect.T + y
                                );

                            DDPictureLoaderUtils.SetSoftImageDot(
                                h2,
                                x,
                                y,
                                dot
                                );
                            DDPictureLoaderUtils.SetSoftImageDot(
                                h2,
                                derRect.W * 2 - 1 - x,
                                y,
                                dot
                                );
                        }
                    }
                    DDPictureLoaderUtils.ReleaseSoftImage(siHandle);
                    siHandle = h2;
                }

                return DDPictureLoaderUtils.GraphicHandle2Info(DDPictureLoaderUtils.SoftImage2GraphicHandle(siHandle));
            },
                       DDPictureLoaderUtils.ReleaseInfo,
                       DDPictureUtils.Add
                       ));
        }
Esempio n. 2
0
        public MainWin()
        {
            InitializeComponent();

            this.MinimumSize = this.Size;

            this.OrigSize       = new I2Size(this.Width, this.Height);
            this.OrigChartsRect = I4Rect.LTRB(
                this.MaChart.Left,
                this.MaChart.Top,
                this.DmaChart.Right,
                this.DmaChart.Bottom
                );

            this.South.Text = "";
        }
Esempio n. 3
0
        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();
            });
        }