Beispiel #1
0
        public static IEnumerable <bool> Standard(Wall wall, DDPicture picture, int xSpeed, int ySpeed, int xOrigin, int yOrigin, double a_add, double a_max, bool fillable, double brightLevel = 1.0)
        {
            double a = 0.0;

            for (; ;)
            {
                a += a_add;

                if (a_max < a)
                {
                    a = a_max;

                    if (fillable)
                    {
                        wall.Filled = true;
                    }
                }

                xOrigin += xSpeed;
                yOrigin += ySpeed;

                int orig_x = xOrigin % picture.Get_W();
                int orig_y = yOrigin % picture.Get_H();

                if (0 < orig_x)
                {
                    orig_x -= picture.Get_W();
                }
                if (0 < orig_y)
                {
                    orig_y -= picture.Get_H();
                }

                DDDraw.SetAlpha(a);
                DDDraw.SetBright(brightLevel, brightLevel, brightLevel);

                for (int x = orig_x; x < GameConsts.FIELD_W; x += picture.Get_W())
                {
                    for (int y = orig_y; y < GameConsts.FIELD_H; y += picture.Get_H())
                    {
                        DDDraw.DrawSimple(picture, x, y);
                    }
                }
                DDDraw.Reset();

                //DDCurtain.DrawCurtain(darkLevel); // -> SetBright

                yield return(true);
            }
        }
Beispiel #2
0
        public void Test02()
        {
            DDPicture picture = DDCCResource.GetPicture(@"dat\Novel\背景.png");

            DDSubScreen s000 = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen s001 = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen s010 = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen s011 = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen s100 = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen s101 = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen s110 = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen s111 = new DDSubScreen(picture.Get_W(), picture.Get_H());

            Draw(picture, "RRR", s000);
            Draw(picture, "RRG", s001);
            Draw(picture, "RGR", s010);
            Draw(picture, "RGG", s011);
            Draw(picture, "GRR", s100);
            Draw(picture, "GRG", s101);
            Draw(picture, "GGR", s110);
            Draw(picture, "GGG", s111);

            DDSubScreen[] screens = new DDSubScreen[]
            {
                s000,
                s001,
                s010,
                s011,
                s100,
                s101,
                s110,
                s111,
            };

            int displayIndex = 0;

            for (; ;)
            {
                if (DDInput.DIR_8.IsPound())
                {
                    displayIndex--;
                }
                if (DDInput.DIR_2.IsPound())
                {
                    displayIndex++;
                }
                displayIndex += screens.Length;
                displayIndex %= screens.Length;

                DDDraw.DrawSimple(screens[displayIndex].ToPicture(), 0, 0);

                DDEngine.EachFrame();
            }
        }
Beispiel #3
0
        private void DrawWall(DDPicture picture, I3Color color, double xRate, double yRate)
        {
            int xSpan = picture.Get_W() - DDConsts.Screen_W;
            int ySpan = picture.Get_H() - DDConsts.Screen_H;
            int span  = Math.Min(xSpan, ySpan);

            DDDraw.SetBright(color);
            DDDraw.DrawCenter(
                picture,
                DDConsts.Screen_W / 2 - (xRate - 0.5) * span,
                DDConsts.Screen_H / 2 - (yRate - 0.5) * span
                );
            DDDraw.Reset();
        }
Beispiel #4
0
        private static DDTable <DDPicture> GetDerivationTable(DDPicture pic, int w, int h)
        {
            DDTable <DDPicture> table = new DDTable <DDPicture>(w, h);

            int dw = pic.Get_W() / w;
            int dh = pic.Get_H() / h;

            if (dw * w != pic.Get_W())
            {
                throw new DDError();                                    // 2bs
            }
            if (dh * h != pic.Get_H())
            {
                throw new DDError();                                    // 2bs
            }
            for (int x = 0; x < w; x++)
            {
                for (int y = 0; y < h; y++)
                {
                    table[x, y] = DDDerivations.GetPicture(pic, x * dw, y * dh, dw, dh);
                }
            }
            return(table);
        }
Beispiel #5
0
        public void Test01()
        {
            // G,B がほぼ同じなのでバリエーション出ない。

            DDPicture picture = DDCCResource.GetPicture(@"dat\Novel\背景.png");

            DDSubScreen rgb = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen rbg = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen grb = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen gbr = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen brg = new DDSubScreen(picture.Get_W(), picture.Get_H());
            DDSubScreen bgr = new DDSubScreen(picture.Get_W(), picture.Get_H());

            Draw(picture, "RGB", rgb);
            Draw(picture, "RBG", rbg);
            Draw(picture, "GRB", grb);
            Draw(picture, "GBR", gbr);
            Draw(picture, "BRG", brg);
            Draw(picture, "BGR", bgr);

            DDSubScreen[] screens = new DDSubScreen[]
            {
                rgb,
                rbg,
                grb,
                gbr,
                brg,
                bgr,
            };

            int displayIndex = 0;

            for (; ;)
            {
                if (DDInput.DIR_8.IsPound())
                {
                    displayIndex--;
                }
                if (DDInput.DIR_2.IsPound())
                {
                    displayIndex++;
                }
                displayIndex += screens.Length;
                displayIndex %= screens.Length;

                DDDraw.DrawSimple(screens[displayIndex].ToPicture(), 0, 0);

                DDEngine.EachFrame();
            }
        }
Beispiel #6
0
        public void Main01(string rDir, string wDir)
        {
            this.RDir = rDir;
            this.WDir = wDir;

            if (Directory.Exists(this.RDir) == false)
            {
                throw new Exception("no RDir: " + this.RDir);
            }

            FileTools.Delete(this.WDir);
            FileTools.CreateDir(this.WDir);

            DDPicture jacket = DDPictureLoaders.Standard(Path.Combine(this.RDir, "Jacket.jpg"));             // g

            this.SpData = new SpectrumData(Path.Combine(this.RDir, "Spectrum.csv"));

            double a   = -1.0;
            double foa = 0.0;

            double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W();
            double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H();

            double bz1 = Math.Max(xz, yz);
            double bz2 = Math.Min(xz, yz);

            double z1 = 1.0;
            double z2 = 2.0;

            const int JACKET_MARGIN = 10;

            DDSubScreen workScreen   = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);                                         // g
            DDSubScreen jacketScreen = new DDSubScreen(jacket.Get_W() + JACKET_MARGIN * 2, jacket.Get_H() + JACKET_MARGIN * 2, true); // g

            // ---- jacketScreen

            DDSubScreenUtils.ChangeDrawScreen(jacketScreen);
            DX.ClearDrawScreen();

            DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2);

            DDSubScreenUtils.RestoreDrawScreen();

            // ----

            SpectrumScreen0001 spScr = new SpectrumScreen0001();

            while (this.Frame < this.SpData.Rows.Length)
            {
                double[] row = this.SpData.Rows[this.Frame];

                // ---- workScreen

                DDSubScreenUtils.ChangeDrawScreen(workScreen);

                DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(bz1 * z1);
                DDDraw.DrawEnd();

                DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

                DDSubScreenUtils.RestoreDrawScreen();

                // ----

                DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0);

                DDCurtain.DrawCurtain(-0.5);

                DDDraw.DrawBegin(
                    jacketScreen.ToPicture(),
                    //jacket,
                    DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(bz2 * z2);
                DDDraw.DrawEnd();

                DDCurtain.DrawCurtain(Math.Min(a, foa));

                spScr.Draw(this.SpData.Rows[this.Frame]);

                DDDraw.SetAlpha(0.6);                 // ★要調整
                DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - 110);
                DDDraw.Reset();

                if (40 < this.Frame)
                {
                    DDUtils.Approach(ref a, 0.0, 0.985);
                }

                if (this.SpData.Rows.Length - 40 < this.Frame)
                {
                    DDUtils.Approach(ref foa, -1.0, 0.9);
                }

                //DDUtils.Approach(ref z1, 1.2, 0.999);
                z1 += 0.0001;
                DDUtils.Approach(ref z2, 1.0, 0.9985);

                this.MG_EachFrame();
            }
        }
Beispiel #7
0
        public override IEnumerable <bool> E_Draw()
        {
            Game.I.SkipMode = false;

            for (; ;)
            {
                //Game.I.CancelSkipAutoMode();

                if (
                    this.Options.Count < GameConsts.SELECT_OPTION_MIN ||
                    this.Options.Count > GameConsts.SELECT_OPTION_MAX
                    )
                {
                    throw new DDError("選択肢の個数に問題があります。");
                }

                // ---- 入力ここから

                if (!Game.I.BacklogMode)
                {
                    int moving = 0;

                    if (DDInput.DIR_8.IsPound())
                    {
                        moving = -1;
                    }

                    if (DDInput.DIR_2.IsPound())
                    {
                        moving = 1;
                    }

                    if (moving != 0)
                    {
                        int optIndex = this.GetMouseFocusedIndex();

                        if (optIndex == -1)
                        {
                            optIndex = 0;
                        }
                        else
                        {
                            optIndex += this.Options.Count + moving;
                            optIndex %= this.Options.Count;
                        }

                        DDMouse.X =
                            GameConsts.SELECT_FRAME_L +
                            Ground.I.Picture.MessageFrame_Button2.Get_W() * 2 -
                            10;
                        DDMouse.Y =
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * optIndex +
                            Ground.I.Picture.MessageFrame_Button2.Get_H() * 2 -
                            10;

                        DDMouse.PosChanged();
                    }
                }

                // ---- ここから描画

                if (!Hide)
                {
                    for (int index = 0; index < GameConsts.SELECT_FRAME_NUM; index++)
                    {
                        DDPicture picture = Ground.I.Picture.MessageFrame_Button;

                        if (index < this.Options.Count)
                        {
                            picture = Ground.I.Picture.MessageFrame_Button2;

                            if (this.Options[index].MouseFocused)
                            {
                                picture = Ground.I.Picture.MessageFrame_Button3;
                            }
                        }

                        DDDraw.DrawBeginRect(
                            picture,
                            GameConsts.SELECT_FRAME_L,
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * index,
                            picture.Get_W() * 2.0,
                            picture.Get_H() * 2.0
                            );
                        DDCrash drawedCrash = DDDraw.DrawGetCrash();
                        DDDraw.DrawEnd();

                        // フォーカスしている選択項目を再設定
                        {
                            if (index < this.Options.Count)
                            {
                                bool mouseIn = drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y)));

                                this.Options[index].MouseFocused = mouseIn;
                            }
                        }
                    }
                    for (int index = 0; index < this.Options.Count; index++)
                    {
                        const int title_x = 160;
                        const int title_y = 56;

                        DDFontUtils.DrawString(
                            GameConsts.SELECT_FRAME_L + title_x,
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * index + title_y,
                            this.Options[index].Title,
                            DDFontUtils.GetFont("Kゴシック", 32),
                            false,
                            new I3Color(110, 100, 90)
                            );
                    }
                }

                // 隠しているなら選択出来ない。
                if (Hide)
                {
                    foreach (OptionInfo option in this.Options)
                    {
                        option.MouseFocused = false;
                    }
                }

                yield return(true);
            }
        }
Beispiel #8
0
        public void Main01(string rDir, string wRootDir, int spBarNum, int spBarWidth, int spBarHeight, I3Color spBarColor, double spBarAlpha, double z2 = 2.0)
        {
            string wLocalDir = string.Format("Bar={0:D2}_Bar-W={1:D2}_Bar-H={2:D3}_Bar-C={3}_Bar-A={4:F3}", spBarNum, spBarWidth, spBarHeight, spBarColor, spBarAlpha);

            this.RDir = rDir;
            this.WDir = Path.Combine(wRootDir, wLocalDir);

            if (Directory.Exists(this.RDir) == false)
            {
                throw new Exception("no RDir: " + this.RDir);
            }

            FileTools.Delete(this.WDir);
            FileTools.CreateDir(this.WDir);

            DDPicture jacket = DDPictureLoaders.Standard(Path.Combine(this.RDir, "Jacket.jpg"));             // g

            this.SpData = new SpectrumData(Path.Combine(this.RDir, "Spectrum.csv"));

            double a   = -1.0;
            double foa = 0.0;

            double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W();
            double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H();

            double bz1 = Math.Max(xz, yz);
            double bz2 = Math.Min(xz, yz);

            double z1 = 1.0;
            //double z2 = 2.0; // 引数化 @ 2020.7.19

            const int JACKET_MARGIN = 10;

            DDSubScreen workScreen   = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);                                         // g
            DDSubScreen jacketScreen = new DDSubScreen(jacket.Get_W() + JACKET_MARGIN * 2, jacket.Get_H() + JACKET_MARGIN * 2, true); // g

            // ---- jacketScreen

            DDSubScreenUtils.ChangeDrawScreen(jacketScreen);
            DX.ClearDrawScreen();

            DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2);

            DDSubScreenUtils.RestoreDrawScreen();

            // ----

            SpectrumScreen0001 spScr = new SpectrumScreen0001(spBarNum, spBarWidth, spBarHeight, spBarColor);

            while (this.Frame < this.SpData.Rows.Length)
            {
                double[] row = this.SpData.Rows[this.Frame];

                // ---- workScreen

                DDSubScreenUtils.ChangeDrawScreen(workScreen);

                DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(bz1 * z1);
                DDDraw.DrawEnd();

                DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

                DDSubScreenUtils.RestoreDrawScreen();

                // ----

                DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0);

                DDCurtain.DrawCurtain(-0.5);

                DDDraw.DrawBegin(
                    jacketScreen.ToPicture(),
                    //jacket,
                    DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(bz2 * z2);
                DDDraw.DrawEnd();

                DDCurtain.DrawCurtain(Math.Min(a, foa));

                spScr.Draw(this.SpData.Rows[this.Frame]);

                DDDraw.SetAlpha(spBarAlpha);                 // ★要調整
                DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - spBarHeight / 2 - 10);
                DDDraw.Reset();

                if (40 < this.Frame)
                {
                    DDUtils.Approach(ref a, 0.0, 0.985);
                }

                if (this.SpData.Rows.Length - 40 < this.Frame)
                {
                    DDUtils.Approach(ref foa, -1.0, 0.9);
                }

                //DDUtils.Approach(ref z1, 1.2, 0.999);
                //z1 += 0.0001;
                DDUtils.Approach(ref z2, 1.0, 0.9985);

                this.MG_EachFrame();
            }

            // ゴミ内のハンドルだけでも開放する。
            {
                DDPictureUtils.UnloadAll();
                DDSubScreenUtils.UnloadAll();
            }
        }
Beispiel #9
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                double map_w   = Game.I.Map.W * GameConsts.TILE_W;
                double map_h   = Game.I.Map.H * GameConsts.TILE_H;
                double camXMax = map_w - DDConsts.Screen_W;
                double camYMax = map_h - DDConsts.Screen_H;

                // 最背面
                {
                    double xRate = DDGround.Camera.X / camXMax;
                    double yRate = DDGround.Camera.Y / camYMax;

                    DDDraw.DrawSimple(
                        Ground.I.Picture.Stage01_Bg_a01,
                        -(Ground.I.Picture.Stage01_Bg_a01.Get_W() - DDConsts.Screen_W) * xRate,
                        -(Ground.I.Picture.Stage01_Bg_a01.Get_H() - DDConsts.Screen_H) * yRate
                        );
                }

                // 山
                {
                    DDPicture picture    = Ground.I.Picture.Stage01_Bg_a02;
                    double    xSlideRate = 0.2;
                    double    ySlideRate = 0.2;
                    double    x          = -DDGround.Camera.X * xSlideRate;
                    double    y          = (DDConsts.Screen_H - 500.0) + (camYMax - DDGround.Camera.Y) * ySlideRate;
                    int       ix         = (int)x;
                    int       iy         = (int)y;

                    ix %= picture.Get_W();

                    for (int cx = ix; cx < DDConsts.Screen_W; cx += picture.Get_W())
                    {
                        DDDraw.DrawSimple(picture, cx, iy);
                    }
                }

                // 森
                {
                    DDPicture picture    = Ground.I.Picture.Stage01_Bg_a03;
                    double    xSlideRate = 0.3;
                    double    ySlideRate = 0.3;
                    double    x          = -DDGround.Camera.X * xSlideRate;
                    double    y          = (DDConsts.Screen_H - 416.0) + (camYMax - DDGround.Camera.Y) * ySlideRate;
                    int       ix         = (int)x;
                    int       iy         = (int)y;

                    ix %= picture.Get_W();

                    for (int cx = ix; cx < DDConsts.Screen_W; cx += picture.Get_W())
                    {
                        DDDraw.DrawSimple(picture, cx, iy);
                    }
                    iy += picture.Get_H();

                    if (iy < DDConsts.Screen_H)
                    {
                        //DDDraw.SetBright(new I3Color(15, 25, 19));
                        DDDraw.SetBright(new I3Color(16, 48, 16));
                        DDDraw.DrawRect_LTRB(Ground.I.Picture.WhiteBox, 0, iy, DDConsts.Screen_W, DDConsts.Screen_H);
                        DDDraw.Reset();
                    }
                }

                // 木
                {
                    DDPicture picture_01 = Ground.I.Picture.Stage01_Bg_Item01;
                    DDPicture picture_02 = Ground.I.Picture.Stage01_Bg_Item02;

                    const int CYCLE_SPAN = 1000;
                    const int WOOD_01_X  = 200;
                    const int WOOD_02_X  = 700;

                    int x = -DDGround.ICamera.X;
                    int y = (int)(map_h - 96 - DDGround.ICamera.Y);

                    x %= CYCLE_SPAN;
                    x -= CYCLE_SPAN;

                    for (int cx = x; cx < DDConsts.Screen_W; cx += CYCLE_SPAN)
                    {
                        DDDraw.DrawSimple(picture_01, cx + WOOD_01_X, y - picture_01.Get_H());
                        DDDraw.DrawSimple(picture_02, cx + WOOD_02_X, y - picture_02.Get_H());
                    }
                }

                yield return(true);
            }
        }
Beispiel #10
0
        public void Main01(string spectrumFile, DDPicture jacket, string wDir, int spBarNum, int spBarWidth, int spBarHeight, I3Color spBarColor, double spBarAlpha, double z2)
        {
            FileTools.Delete(wDir);
            FileTools.CreateDir(wDir);

            this.SpData = new SpectrumData(spectrumFile);

            double a   = -1.0;
            double foa = 0.0;

            double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W();
            double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H();

            double bz1 = Math.Max(xz, yz);
            double bz2 = Math.Min(xz, yz);

            double z1 = 1.0;
            //double z2 = 2.0;

            const int JACKET_MARGIN = 10;

            using (DDSubScreen pseudoMainScreen = new DDSubScreen(
                       DDConsts.Screen_W,
                       DDConsts.Screen_H
                       ))
                using (DDSubScreen workScreen = new DDSubScreen(
                           DDConsts.Screen_W,
                           DDConsts.Screen_H
                           ))
                    using (DDSubScreen jacketScreen = new DDSubScreen(
                               jacket.Get_W() + JACKET_MARGIN * 2,
                               jacket.Get_H() + JACKET_MARGIN * 2,
                               true
                               ))
                    {
                        // ---- jacketScreen

                        DDSubScreenUtils.ChangeDrawScreen(jacketScreen);
                        DX.ClearDrawScreen();

                        DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2);

                        DDSubScreenUtils.RestoreDrawScreen();

                        // ----

                        SpectrumScreen0001 spScr = new SpectrumScreen0001(spBarNum, spBarWidth, spBarHeight, spBarColor);

                        while (this.Frame < this.SpData.Rows.Length)
                        {
                            double[] row = this.SpData.Rows[this.Frame];

                            spScr.Draw(row);

                            // ---- workScreen

                            DDSubScreenUtils.ChangeDrawScreen(workScreen);

                            DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz1 * z1);
                            DDDraw.DrawEnd();

                            DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

                            //DDSubScreenUtils.RestoreDrawScreen();

                            // ---- pseudoMainScreen

                            DDSubScreenUtils.ChangeDrawScreen(pseudoMainScreen);

                            DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0);

                            DDCurtain.DrawCurtain(-0.5);

                            DDDraw.DrawBegin(
                                jacketScreen.ToPicture(),
                                //jacket,
                                DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz2 * z2);
                            DDDraw.DrawEnd();

                            DDCurtain.DrawCurtain(Math.Min(a, foa));

                            DDDraw.SetAlpha(spBarAlpha);
                            DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - spBarHeight / 2 - 10);
                            DDDraw.Reset();

                            // ここでフレームを保存
                            DX.SaveDrawScreenToJPEG(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.jpg", this.Frame)), Consts.JPEG_QUALITY);
                            //DX.SaveDrawScreen(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.bmp", this.Frame)));

                            DDSubScreenUtils.RestoreDrawScreen();

                            // ---- 以降、フレーム毎の処理

                            if (40 < this.Frame)
                            {
                                DDUtils.Approach(ref a, 0.0, 0.985);
                            }

                            if (this.SpData.Rows.Length - 40 < this.Frame)
                            {
                                DDUtils.Approach(ref foa, -1.0, 0.9);
                            }

                            //DDUtils.Approach(ref z1, 1.2, 0.999);
                            //z1 += 0.0001;
                            DDUtils.Approach(ref z2, 1.0, 0.9985);

                            if (this.Frame % 30 == 0)             // 毎回やる必要は無い。
                            {
                                DDCurtain.DrawCurtain();

                                DDPrint.SetPrint(16, 16, 32);
                                DDPrint.SetBorder(new I3Color(0, 64, 128));

                                DDPrint.PrintLine("ConvGenVideo");
                                //DDPrint.PrintLine("ConvGenVideo [Version " + DDUserDatStrings.Version + "]");
                                DDPrint.PrintLine("映像を生成しています...");
                                DDPrint.PrintLine("右上の[X]ボタンを押すと全ての処理を中止(キャンセル)します。");

                                {
                                    double    rate           = this.Frame * 1.0 / this.SpData.Rows.Length;
                                    const int PROGRESS_BAR_H = 10;

                                    DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, (DDConsts.Screen_H - PROGRESS_BAR_H) / 2, Math.Max(5, DDConsts.Screen_W * rate), PROGRESS_BAR_H);
                                }

                                DDEngine.EachFrame();
                            }
                            this.Frame++;
                        }
                    }
        }
Beispiel #11
0
        public void Main01(string spectrumFile, DDPicture jacket, string wDir, int spBarNum, int spBarWidth, int spBarHeight, I3Color spBarColor, double spBarAlpha, double z2)
        {
            FileTools.Delete(wDir);
            FileTools.CreateDir(wDir);

            this.SpData = new SpectrumData(spectrumFile);

            double a   = -1.0;
            double foa = 0.0;

            double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W();
            double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H();

            double bz1 = Math.Max(xz, yz);
            double bz2 = Math.Min(xz, yz);

            double z1 = 1.0;
            //double z2 = 2.0;

            const int JACKET_MARGIN = 10;

            using (DDSubScreen pseudoMainScreen = new DDSubScreen(
                       DDConsts.Screen_W,
                       DDConsts.Screen_H
                       ))
                using (DDSubScreen workScreen = new DDSubScreen(
                           DDConsts.Screen_W,
                           DDConsts.Screen_H
                           ))
                    using (DDSubScreen jacketScreen = new DDSubScreen(
                               jacket.Get_W() + JACKET_MARGIN * 2,
                               jacket.Get_H() + JACKET_MARGIN * 2,
                               true
                               ))
                    {
                        // ---- jacketScreen

                        DDSubScreenUtils.ChangeDrawScreen(jacketScreen);
                        DX.ClearDrawScreen();

                        DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2);

                        DDSubScreenUtils.RestoreDrawScreen();

                        // ----

                        SpectrumScreen0001 spScr = new SpectrumScreen0001(spBarNum, spBarWidth, spBarHeight, spBarColor);

                        while (this.Frame < this.SpData.Rows.Length)
                        {
                            double[] row = this.SpData.Rows[this.Frame];

                            spScr.Draw(row);

                            // ---- workScreen

                            DDSubScreenUtils.ChangeDrawScreen(workScreen);

                            DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz1 * z1);
                            DDDraw.DrawEnd();

                            DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

                            //DDSubScreenUtils.RestoreDrawScreen();

                            // ---- pseudoMainScreen

                            DDSubScreenUtils.ChangeDrawScreen(pseudoMainScreen);

                            DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0);

                            DDCurtain.DrawCurtain(-0.5);

                            DDDraw.DrawBegin(
                                jacketScreen.ToPicture(),
                                //jacket,
                                DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz2 * z2);
                            DDDraw.DrawEnd();

                            DDCurtain.DrawCurtain(Math.Min(a, foa));

                            DDDraw.SetAlpha(spBarAlpha);
                            DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - spBarHeight / 2 - 10);
                            DDDraw.Reset();

                            // ここでフレームを保存
                            DX.SaveDrawScreen(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.bmp", this.Frame)));

                            DDSubScreenUtils.RestoreDrawScreen();

                            // ---- 実際に表示される画面の描画

                            DDCurtain.DrawCurtain();

                            {
                                double    rate           = this.Frame * 1.0 / this.SpData.Rows.Length;
                                const int PROGRESS_BAR_H = 10;

                                DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, (DDConsts.Screen_H - PROGRESS_BAR_H) / 2, Math.Max(5, DDConsts.Screen_W * rate), PROGRESS_BAR_H);
                            }

                            // ----

                            if (40 < this.Frame)
                            {
                                DDUtils.Approach(ref a, 0.0, 0.985);
                            }

                            if (this.SpData.Rows.Length - 40 < this.Frame)
                            {
                                DDUtils.Approach(ref foa, -1.0, 0.9);
                            }

                            //DDUtils.Approach(ref z1, 1.2, 0.999);
                            //z1 += 0.0001;
                            DDUtils.Approach(ref z2, 1.0, 0.9985);

                            this.MG_EachFrame();
                        }
                    }
        }