Пример #1
0
 private void DrawWallPicture()
 {
     DDDraw.DrawRect(
         this.WallPicture,
         DDUtils.AdjustRectExterior(this.WallPicture.GetSize().ToD2Size(), new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H))
         );
 }
Пример #2
0
        public static void Draw(IEnumerable <DDCrash> crashes, I3Color color, double a = 1.0)
        {
            DDDraw.SetAlpha(a);
            DDDraw.SetBright(color);

            Draw(crashes);

            DDDraw.Reset();
        }
Пример #3
0
        public void Draw(IEnumerable <DDCrash> crashes, I3Color color)
        {
            DDDraw.SetBright(color);

            using (this.MyScreen.Section())
            {
                Queue <IEnumerable <DDCrash> > q = new Queue <IEnumerable <DDCrash> >();

                q.Enqueue(crashes);

                while (1 <= q.Count)
                {
                    foreach (DDCrash crash in q.Dequeue())
                    {
                        switch (crash.Kind)
                        {
                        case DDCrashUtils.Kind_e.NONE:
                            break;

                        case DDCrashUtils.Kind_e.POINT:
                            DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, crash.Pt.X - DDGround.ICamera.X, crash.Pt.Y - DDGround.ICamera.Y);
                            DDDraw.DrawSetSize(POINT_WH, POINT_WH);
                            DDDraw.DrawEnd();
                            break;

                        case DDCrashUtils.Kind_e.CIRCLE:
                            DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, crash.Pt.X - DDGround.ICamera.X, crash.Pt.Y - DDGround.ICamera.Y);
                            DDDraw.DrawSetSize(crash.R * 2.0, crash.R * 2.0);
                            DDDraw.DrawEnd();
                            break;

                        case DDCrashUtils.Kind_e.RECT:
                            DDDraw.DrawRect(
                                Ground.I.Picture.WhiteBox,
                                crash.Rect.L - DDGround.ICamera.X,
                                crash.Rect.T - DDGround.ICamera.Y,
                                crash.Rect.W,
                                crash.Rect.H
                                );
                            break;

                        case DDCrashUtils.Kind_e.MULTI:
                            q.Enqueue(crash.Crashes);
                            break;

                        default:
                            throw null;                                     // never
                        }
                    }
                }
            }
            DDDraw.Reset();
        }
Пример #4
0
        public static void DrawDummyScreenAll()
        {
            DDPicture picture = Ground.I.Picture.DummyScreen;

            foreach (DDSubScreen subScreen in SubScreens)
            {
                using (subScreen.Section())
                {
                    DDDraw.DrawRect(
                        picture,
                        DDUtils.AdjustRectExterior(picture.GetSize().ToD2Size(), new D4Rect(new D2Point(0, 0), subScreen.GetSize().ToD2Size()))
                        );
                }
            }
        }
Пример #5
0
        public static void DrawCurtain(double whiteLevel = -1.0)
        {
            if (whiteLevel == 0.0)
            {
                return;
            }

            whiteLevel = SCommon.ToRange(whiteLevel, -1.0, 1.0);

            if (whiteLevel < 0.0)
            {
                DDDraw.SetAlpha(-whiteLevel);
                DDDraw.SetBright(0.0, 0.0, 0.0);
            }
            else
            {
                DDDraw.SetAlpha(whiteLevel);
            }

            DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
            DDDraw.Reset();
        }
Пример #6
0
        public void PadConfig(bool keyMode = false)
        {
            ButtonInfo[] btnInfos = new ButtonInfo[]
            {
#if false // 例
                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.A, "Aボタン"),
                new ButtonInfo(DDInput.B, "Bボタン"),
                new ButtonInfo(DDInput.C, "Cボタン"),
                //new ButtonInfo(DDInput.D, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.E, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.F, ""), // 使用しないボタン
                new ButtonInfo(DDInput.L, "Lボタン"),
                new ButtonInfo(DDInput.R, "Rボタン"),
                //new ButtonInfo(DDInput.PAUSE, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.START, ""), // 使用しないボタン
#else
                // アプリ固有の設定 >

                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.A, "低速/決定"),
                new ButtonInfo(DDInput.B, "ショット/キャンセル"),
                new ButtonInfo(DDInput.C, "ボム"),
                //new ButtonInfo(DDInput.D, ""),
                //new ButtonInfo(DDInput.E, ""),
                //new ButtonInfo(DDInput.F, ""),
                new ButtonInfo(DDInput.L, "会話スキップ"),
                new ButtonInfo(DDInput.R, "当たり判定表示(デバッグ用)"),
                new ButtonInfo(DDInput.PAUSE, "ポーズボタン"),
                //new ButtonInfo(DDInput.START, ""),

                // < アプリ固有の設定
#endif
            };

            foreach (ButtonInfo btnInfo in btnInfos)
            {
                btnInfo.Button.Backup();
            }

            bool?mouseDispModeBk = null;

            try
            {
                if (keyMode)
                {
                    mouseDispModeBk = DDUtils.GetMouseDispMode();
                    DDUtils.SetMouseDispMode(true);

                    foreach (ButtonInfo btnInfo in btnInfos)
                    {
                        btnInfo.Button.KeyId = -1;
                    }

                    DDCurtain.SetCurtain();
                    DDEngine.FreezeInput();

                    int currBtnIndex = 0;

                    while (currBtnIndex < btnInfos.Length)
                    {
                        if (DDMouse.R.GetInput() == -1)
                        {
                            return;
                        }
                        if (DDMouse.L.GetInput() == -1)
                        {
                            currBtnIndex++;
                            goto endInput;
                        }

                        {
                            int pressKeyId = -1;

                            foreach (KeyInfo keyInfo in KeyInfos)
                            {
                                if (DDKey.GetInput(keyInfo.KeyId) == 1)
                                {
                                    pressKeyId = keyInfo.KeyId;
                                }
                            }

                            for (int c = 0; c < currBtnIndex; c++)
                            {
                                if (btnInfos[c].Button.KeyId == pressKeyId)
                                {
                                    pressKeyId = -1;
                                }
                            }

                            if (pressKeyId != -1)
                            {
                                btnInfos[currBtnIndex].Button.KeyId = pressKeyId;
                                currBtnIndex++;
                            }
                        }
endInput:

                        this.DrawWall();

                        if (this.Color != null)
                        {
                            DDPrint.SetColor(this.Color.Value);
                        }

                        if (this.BorderColor != null)
                        {
                            DDPrint.SetBorder(this.BorderColor.Value);
                        }

                        DDPrint.SetPrint(this.X, this.Y, this.YStep);
                        //DDPrint.SetPrint(16, 16, 32); // old
                        DDPrint.PrintLine("キーボードのキー設定");

                        for (int c = 0; c < btnInfos.Length; c++)
                        {
                            DDPrint.Print(string.Format("[{0}] {1}", currBtnIndex == c ? ">" : " ", btnInfos[c].Name));

                            if (c < currBtnIndex)
                            {
                                int keyId = btnInfos[c].Button.KeyId;

                                DDPrint.Print(" -> ");

                                if (keyId == -1)
                                {
                                    DDPrint.Print("割り当てナシ");
                                }
                                else
                                {
                                    DDPrint.Print(KeyInfos.First(keyInfo => keyInfo.KeyId == keyId).Name);
                                }
                            }
                            DDPrint.PrintRet();
                        }
                        DDPrint.PrintLine("★ カーソルの指す機能に割り当てるキーを押して下さい。");
                        DDPrint.PrintLine("★ 画面を左クリックするとキーの割り当てをスキップします。(非推奨)");
                        DDPrint.PrintLine("★ 画面を右クリックするとキャンセルします。");

                        DDEngine.EachFrame();
                    }
                }
                else
                {
                    foreach (ButtonInfo btnInfo in btnInfos)
                    {
                        btnInfo.Button.BtnId = -1;
                    }

                    DDCurtain.SetCurtain();
                    DDEngine.FreezeInput();

                    int currBtnIndex = 0;

                    while (currBtnIndex < btnInfos.Length)
                    {
                        if (DDKey.GetInput(DX.KEY_INPUT_SPACE) == 1)
                        {
                            return;
                        }
                        if (DDKey.GetInput(DX.KEY_INPUT_Z) == 1)
                        {
                            currBtnIndex++;
                            goto endInput;
                        }

                        {
                            int pressBtnId = -1;

                            for (int padId = 0; padId < DDPad.GetPadCount(); padId++)
                            {
                                for (int btnId = 0; btnId < DDPad.PAD_BUTTON_MAX; btnId++)
                                {
                                    if (DDPad.GetInput(padId, btnId) == 1)
                                    {
                                        pressBtnId = btnId;
                                    }
                                }
                            }

                            for (int c = 0; c < currBtnIndex; c++)
                            {
                                if (btnInfos[c].Button.BtnId == pressBtnId)
                                {
                                    pressBtnId = -1;
                                }
                            }

                            if (pressBtnId != -1)
                            {
                                btnInfos[currBtnIndex].Button.BtnId = pressBtnId;
                                currBtnIndex++;
                            }
                        }
endInput:

                        this.DrawWall();

                        if (this.Color != null)
                        {
                            DDPrint.SetColor(this.Color.Value);
                        }

                        if (this.BorderColor != null)
                        {
                            DDPrint.SetBorder(this.BorderColor.Value);
                        }

                        DDPrint.SetPrint(this.X, this.Y, this.YStep);
                        //DDPrint.SetPrint(16, 16, 32); // old
                        DDPrint.PrintLine("ゲームパッドのボタン設定");

                        for (int c = 0; c < btnInfos.Length; c++)
                        {
                            DDPrint.Print(string.Format("[{0}] {1}", currBtnIndex == c ? ">" : " ", btnInfos[c].Name));

                            if (c < currBtnIndex)
                            {
                                int btnId = btnInfos[c].Button.BtnId;

                                DDPrint.Print(" -> ");

                                if (btnId == -1)
                                {
                                    DDPrint.Print("割り当てナシ");
                                }
                                else
                                {
                                    DDPrint.Print("" + btnId);
                                }
                            }
                            DDPrint.PrintRet();
                        }
                        DDPrint.PrintLine("★ カーソルの指す機能に割り当てるボタンを押して下さい。");
                        DDPrint.PrintLine("★ [Z]キーを押すとボタンの割り当てをスキップします。");
                        DDPrint.PrintLine("★ スペースキーを押すとキャンセルします。");

                        if (this.MouseUsable)
                        {
                            DDPrint.PrintLine("★ 右クリックするとキャンセルします。");

                            if (DDMouse.R.GetInput() == -1)
                            {
                                return;
                            }
                        }

                        DDEngine.EachFrame();
                    }
                }
                btnInfos = null;

                // 最後の画面を維持
                {
                    DDMain.KeepMainScreen();

                    for (int c = 0; c < 30; c++)
                    {
                        DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                        DDEngine.EachFrame();
                    }
                }
            }
            finally
            {
                if (btnInfos != null)
                {
                    foreach (ButtonInfo info in btnInfos)
                    {
                        info.Button.Restore();
                    }
                }

                if (mouseDispModeBk != null)
                {
                    DDUtils.SetMouseDispMode(mouseDispModeBk.Value);
                }

                DDEngine.FreezeInput();
            }
        }
Пример #7
0
        public void PadConfig(bool keyMode = false)
        {
            ButtonInfo[] btnInfos = new ButtonInfo[]
            {
#if false // 例
                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.A, "Aボタン"),
                new ButtonInfo(DDInput.B, "Bボタン"),
                new ButtonInfo(DDInput.C, "Cボタン"),
                //new ButtonInfo(DDInput.D, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.E, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.F, ""), // 使用しないボタン
                new ButtonInfo(DDInput.L, "Lボタン"),
                new ButtonInfo(DDInput.R, "Rボタン"),
                //new ButtonInfo(DDInput.PAUSE, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.START, ""), // 使用しないボタン
#else
                // アプリ固有の設定 >

                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.A, "方向ロック・低速移動/決定"),
                new ButtonInfo(DDInput.B, "攻撃ボタン/キャンセル"),
                new ButtonInfo(DDInput.C, "武器切り替え"),
                //new ButtonInfo(DDInput.D, ""),
                //new ButtonInfo(DDInput.E, ""),
                //new ButtonInfo(DDInput.F, ""),
                new ButtonInfo(DDInput.L, "画面スライド/会話スキップ"),
                new ButtonInfo(DDInput.R, "高速移動"),
                new ButtonInfo(DDInput.PAUSE, "ポーズボタン"),
                //new ButtonInfo(DDInput.START, ""),

                // < アプリ固有の設定
#endif
            };

            foreach (ButtonInfo btnInfo in btnInfos)
            {
                btnInfo.Button.Backup();
            }

            bool?mouseDispModeBk = null;

            try
            {
                if (keyMode)
                {
                    mouseDispModeBk = DDUtils.GetMouseDispMode();
                    DDUtils.SetMouseDispMode(true);

                    foreach (ButtonInfo btnInfo in btnInfos)
                    {
                        btnInfo.Button.KeyId = -1;
                    }

                    DDCurtain.SetCurtain();
                    DDEngine.FreezeInput();

                    int currBtnIndex = 0;

                    while (currBtnIndex < btnInfos.Length)
                    {
                        if (DDMouse.R.GetInput() == -1)
                        {
                            return;
                        }
                        // スキップ禁止
                        //if (DDMouse.L.GetInput() == -1)
                        //{
                        //    currBtnIndex++;
                        //    goto endInput;
                        //}

                        {
                            int pressKeyId = -1;

                            foreach (KeyInfo keyInfo in KeyInfos)
                            {
                                if (DDKey.GetInput(keyInfo.KeyId) == 1)
                                {
                                    pressKeyId = keyInfo.KeyId;
                                }
                            }

                            for (int c = 0; c < currBtnIndex; c++)
                            {
                                if (btnInfos[c].Button.KeyId == pressKeyId)
                                {
                                    pressKeyId = -1;
                                }
                            }

                            if (pressKeyId != -1)
                            {
                                btnInfos[currBtnIndex].Button.KeyId = pressKeyId;
                                currBtnIndex++;
                            }
                        }
                        //endInput:

                        this.WallDrawer();
                        this.ResetPrint();
                        DDPrint.SetPrint(20, 20, 40, 20);
                        DDPrint.PrintLine("キーボードのキー設定");

                        for (int c = 0; c < btnInfos.Length; c++)
                        {
                            DDPrint.Print(string.Format("[{0}] {1}", currBtnIndex == c ? ">" : " ", btnInfos[c].Name));

                            if (c < currBtnIndex)
                            {
                                int keyId = btnInfos[c].Button.KeyId;

                                DDPrint.Print(" >>> ");

                                if (keyId == -1)
                                {
                                    DDPrint.Print("割り当てナシ");
                                }
                                else
                                {
                                    DDPrint.Print(KeyInfos.First(keyInfo => keyInfo.KeyId == keyId).Name);
                                }
                            }
                            DDPrint.PrintRet();
                        }
                        DDPrint.SetPrint(450, 420, 40, 20);
                        //DDPrint.SetPrint(410, 380, 40, 20); // スキップ禁止
                        DDPrint.PrintLine("/// TIPS ///");
                        DDPrint.PrintLine("カーソルの指す機能に割り当てるキーを押して下さい。");
                        //DDPrint.PrintLine("画面を左クリックするとキーの割り当てをスキップします。"); // スキップ禁止
                        DDPrint.SetColor(new I3Color(255, 255, 0));
                        DDPrint.SetBorder(new I3Color(100, 50, 0));
                        DDPrint.PrintLine("画面を右クリックするとキャンセルします。");
                        this.ResetPrint();

                        DDEngine.EachFrame();
                    }
                }
                else
                {
                    foreach (ButtonInfo btnInfo in btnInfos)
                    {
                        btnInfo.Button.BtnId = -1;
                    }

                    DDCurtain.SetCurtain();
                    DDEngine.FreezeInput();

                    int currBtnIndex = 0;

                    while (currBtnIndex < btnInfos.Length)
                    {
                        if (DDKey.GetInput(DX.KEY_INPUT_SPACE) == 1)
                        {
                            return;
                        }
                        if (DDKey.GetInput(DX.KEY_INPUT_Z) == 1)
                        {
                            currBtnIndex++;
                            goto endInput;
                        }

                        {
                            int pressBtnId = -1;

                            for (int padId = 0; padId < DDPad.GetPadCount(); padId++)
                            {
                                for (int btnId = 0; btnId < DDPad.PAD_BUTTON_MAX; btnId++)
                                {
                                    if (DDPad.GetInput(padId, btnId) == 1)
                                    {
                                        pressBtnId = btnId;
                                    }
                                }
                            }

                            for (int c = 0; c < currBtnIndex; c++)
                            {
                                if (btnInfos[c].Button.BtnId == pressBtnId)
                                {
                                    pressBtnId = -1;
                                }
                            }

                            if (pressBtnId != -1)
                            {
                                btnInfos[currBtnIndex].Button.BtnId = pressBtnId;
                                currBtnIndex++;
                            }
                        }
endInput:

                        this.WallDrawer();
                        this.ResetPrint();
                        DDPrint.SetPrint(20, 20, 40, 20);
                        DDPrint.PrintLine("ゲームパッドのボタン設定");

                        for (int c = 0; c < btnInfos.Length; c++)
                        {
                            DDPrint.Print(string.Format("[{0}] {1}", currBtnIndex == c ? ">" : " ", btnInfos[c].Name));

                            if (c < currBtnIndex)
                            {
                                int btnId = btnInfos[c].Button.BtnId;

                                DDPrint.Print(" >>> ");

                                if (btnId == -1)
                                {
                                    DDPrint.Print("割り当てナシ");
                                }
                                else
                                {
                                    DDPrint.Print(btnId.ToString("D2"));
                                }
                            }
                            DDPrint.PrintRet();
                        }
                        DDPrint.SetPrint(430, 380, 40, 20);
                        DDPrint.PrintLine("/// TIPS ///");
                        DDPrint.PrintLine("カーソルの指す機能に割り当てるボタンを押して下さい。");
                        DDPrint.PrintLine("Zキーを押すとボタンの割り当てをスキップします。");
                        DDPrint.SetColor(new I3Color(255, 255, 0));
                        DDPrint.SetBorder(new I3Color(100, 50, 0));

                        if (this.MouseUsable)
                        {
                            DDPrint.PrintLine("スペースキーまたは右クリックするとキャンセルします。");

                            if (DDMouse.R.GetInput() == -1)
                            {
                                return;
                            }
                        }
                        else
                        {
                            DDPrint.PrintLine("スペースキーを押すとキャンセルします。");
                        }

                        this.ResetPrint();

                        DDEngine.EachFrame();
                    }
                }
                btnInfos = null;

                // 最後の画面を維持
                {
                    DDMain.KeepMainScreen();

                    for (int c = 0; c < 30; c++)
                    {
                        DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                        DDEngine.EachFrame();
                    }
                }
            }
            finally
            {
                if (btnInfos != null)
                {
                    foreach (ButtonInfo info in btnInfos)
                    {
                        info.Button.Restore();
                    }
                }

                if (mouseDispModeBk != null)
                {
                    DDUtils.SetMouseDispMode(mouseDispModeBk.Value);
                }

                DDEngine.FreezeInput();
            }
        }
Пример #8
0
 public void DrawToScreen(double a = 0.3)
 {
     DDDraw.SetAlpha(a);
     DDDraw.DrawSimple(this.GetPicture(), 0, 0);
     DDDraw.Reset();
 }