Пример #1
0
        protected override void OnRegistered()
        {
            layer = new asd.Layer2D();
            AddLayer(layer);

            // 下地
            var background = new asd.GeometryObject2D();

            layer.AddObject(background);
            var bgRect = new asd.RectangleShape();

            bgRect.DrawingArea = new asd.RectF(0, 0, 1800, 1000);
            background.Shape   = bgRect;

            foreach (var c in gameData.Battle.GetAliveCityList())
            {
                var maps = c.GetMaps();
                foreach (var m in maps)
                {
                    m.AddLayer(layer);
                }
            }

            var info = Singleton.InfomationWindow;

            info.AddLayer(layer);
            var info2 = Singleton.GameProcessInfomation;

            info2.AddLayer(layer);
        }
Пример #2
0
        public Cloud(asd.Vector2DF position, TypeOfCloud typeOfCloud)
        {
            Position        = position;
            SizeOfCloud     = typeOfCloud;
            ShapeOfCollige  = new asd.RectangleShape();
            DrawingPriority = 2;

            switch (SizeOfCloud)
            {
            case TypeOfCloud.Small:
                Texture = TextureOfCloud_S;
                break;

            case TypeOfCloud.Medium:
                Texture = TextureOfCloud_M;
                break;

            case TypeOfCloud.Large:
                Texture = TextureOfCloud_L;
                break;
            }
            CenterPosition             = Texture.Size.To2DF() / 2.0f;
            ShapeOfCollige.DrawingArea =
                new asd.RectF(Position + new asd.Vector2DF(10.0f, 10.0f) - Texture.Size.To2DF() / 2.0f, Texture.Size.To2DF() - new asd.Vector2DF(10.0f, 10.0f));

            Count = 0;
        }
Пример #3
0
    public asd.RectangleShape GetArea()
    {
        var area = new asd.RectangleShape();

        area.DrawingArea = new asd.RectF(Position.X, Position.Y, Size.X, Size.Y);
        return(area);
    }
Пример #4
0
        }                                                //衝突判定

        public Wall(asd.Vector2DF position)
        {
            Position       = position;
            Texture        = TextureOfWall;
            CenterPosition = Texture.Size.To2DF() / 2.0f;

            ShapeOfCollige             = new asd.RectangleShape();
            ShapeOfCollige.DrawingArea = new asd.RectF(Position - CenterPosition, Texture.Size.To2DF());
        }
Пример #5
0
        public BackGround()
        {
            BackGroundColor = new asd.Color(242, 220, 223, 255);
            Color           = BackGroundColor;
            var rect = new asd.RectangleShape();

            rect.DrawingArea = new asd.RectF(0, 0, Program.WindowSizeX, Program.WindowSizeY);
            Shape            = rect;
        }
Пример #6
0
        public PlayerRect()
        {
            width  = 12;
            height = 60;

            rectShape             = new asd.RectangleShape();
            rectShape.DrawingArea = new asd.RectF(-width / 2, -height / 2, width, height);

            Shape            = rectShape;
            Color            = new asd.Color(255, 255, 255, 128);
            direction        = new asd.Vector2DF(1, 0);
            direction.Degree = Angle;
        }
Пример #7
0
        /// <summary>
        /// キーボードで反応するボタン的なのをつくる、便利だがくそコード
        /// </summary>
        /// <param name="text">ボタンのテキスト</param>
        /// <param name="pos">位置</param>
        /// <param name="width">幅</param>
        /// <param name="height">高さ</param>
        private Button(string text, asd.Vector2DF pos, int width, int height, int fontSize)
        {
            MovingSpeed = 12;
            Position    = pos;
            ChildText   = new GeneralText(new asd.Vector2DF(0, 0), text, fontSize, new asd.Color(2, 20, 20, 200), 2, new asd.Color(222, 222, 222, 200));
            var rect = new asd.RectangleShape();

            rect.DrawingArea = new asd.RectF(-width / 2, -height / 2, width, height);
            Back             = new asd.GeometryObject2D();
            Back.Shape       = rect;
            AddChild(Back, asd.ChildManagementMode.RegistrationToLayer, asd.ChildTransformingMode.All);
            AddChild(ChildText, asd.ChildManagementMode.RegistrationToLayer, asd.ChildTransformingMode.All);
        }
Пример #8
0
        public PlayerRect()
        {
            width = 12;
            height = 60;

            rectShape = new asd.RectangleShape();
            rectShape.DrawingArea = new asd.RectF(-width/2, -height/2, width, height);

            Shape = rectShape;
            Color = new asd.Color(255, 255, 255, 128);
            direction = new asd.Vector2DF(1, 0);
            direction.Degree = Angle;
        }
Пример #9
0
        public Corridor(asd.Vector2DF pos, asd.Vector2DF size, float N)
        {
            Position  = pos;
            this.size = size;

            rect = new asd.RectangleShape
            {
                DrawingArea = new asd.RectF(-size / 2, size)
            };
            Shape = rect;

            Color = new asd.Color(50, 50, 50, 255);

            lu = Position - size / 2;
            rd = Position + size / 2;

            this.N = N;
        }
Пример #10
0
        public Message()
        {
            var obj  = new asd.GeometryObject2D();
            var rect = new asd.RectangleShape();

            // TODO
            rect.DrawingArea = new asd.RectF(-300, -80, 600, 160);
            obj.Shape        = rect;
            obj.Position     = new asd.Vector2DF(320, 390);
            obj.Color        = new asd.Color(50, 50, 150);
            AddObject(obj);

            messageLabel.Font     = Resource.Font;
            messageLabel.Position = obj.Position + new asd.Vector2DF(-300, -80) + new asd.Vector2DF(32, 32);
            AddObject(messageLabel);

            IsUpdated = false;
            IsDrawn   = false;
        }
Пример #11
0
        public TextArea()
        {
            var obj  = new asd.GeometryObject2D();
            var rect = new asd.RectangleShape();

            rect.DrawingArea   = new asd.RectF(-Size / 2, Size);
            obj.Shape          = rect;
            obj.CenterPosition = Resource.Window.Size.To2DF() / 2;
            obj.Position       = Resource.Window.Size.To2DF() / 2 + new asd.Vector2DF(0, 120);
            obj.Color          = new asd.Color(255, 255, 0);
            AddObject(obj);

            nameLabel.Font     = Resource.Font;
            nameLabel.Position = obj.Position - Size / 2 + new asd.Vector2DF(16, 16);
            AddObject(nameLabel);

            textLabel.Font     = Resource.Font;
            textLabel.Position = obj.Position - Size / 2 + new asd.Vector2DF(32, 48);
            AddObject(textLabel);
        }
Пример #12
0
        public Dialog()
        {
            _dialog       = new asd.GeometryObject2D();
            _dialog.Color = new asd.Color(255, 255, 255);

            var dialogRect = new asd.RectangleShape();

            dialogRect.DrawingArea = new asd.RectF(300, 400, 600, 200);
            _dialog.Shape          = dialogRect;

            _valueText          = new asd.TextObject2D();
            _valueText.Position = new asd.Vector2DF(310, 410);
            _valueText.Font     = Singleton.Font;

            _okButton          = new asd.TextureObject2D();
            _okButton.Texture  = Singleton.ImageOK;
            _okButton.Position = new asd.Vector2DF(310, 500);

            _cancelButton          = new asd.TextureObject2D();
            _cancelButton.Texture  = Singleton.ImageCancel;
            _cancelButton.Position = new asd.Vector2DF(620, 500);
        }
Пример #13
0
        public void Run()
        {
            asd.Engine.Initialize("ピクロス解析ツール", 1800, 1000, new asd.EngineOption());

            // 下地
            var background = new asd.GeometryObject2D();

            asd.Engine.AddObject2D(background);
            var bgRect = new asd.RectangleShape();

            bgRect.DrawingArea = new asd.RectF(0, 0, 1800, 1000);
            background.Shape   = bgRect;

            // 数字の入力するマス
            for (int row = 0; row < 10; row++)
            {
                NumberSquare square = new NumberSquare(row, -1);
                square.SetValue("0");
                asd.Engine.AddObject2D(square.getBackTexture());
                asd.Engine.AddObject2D(square.getTextObject());
                List <NumberSquare> rowList = new List <NumberSquare>();
                rowList.Add(square);
                rowNumberSquare.Add(rowList);
            }
            for (int col = 0; col < 10; col++)
            {
                NumberSquare square = new NumberSquare(-1, col);
                square.SetValue("0");
                asd.Engine.AddObject2D(square.getBackTexture());
                asd.Engine.AddObject2D(square.getTextObject());
                List <NumberSquare> colList = new List <NumberSquare>();
                colList.Add(square);
                colNumberSquare.Add(colList);
            }

            // 色を塗るマス
            for (int row = 0; row < 10; row++)
            {
                List <DrawSquare> rowList = new List <DrawSquare>();
                for (int col = 0; col < 10; col++)
                {
                    var square = new DrawSquare(row, col);
                    asd.Engine.AddObject2D(square.getBackTexture());
                    rowList.Add(square);
                }
                drawSquares.Add(rowList);
            }

            // サイズ変更ダイアログ
            Dialog dialog = new Dialog();

            dialog.SetEngine();
            dialog.SetAction(() =>
            {
                dialog.Hide();
                int row = dialog.GetRowValue();
                int col = dialog.GetColValue();
                while (row != drawSquares.Count)
                {
                    if (drawSquares.Count > row)
                    {
                        deleteRow();
                        deleteRowNumber();
                    }
                    else
                    {
                        addRow();
                        addRowNumber();
                    }
                }
                while (col != drawSquares[0].Count)
                {
                    if (drawSquares[0].Count > col)
                    {
                        deleteCol();
                        deleteColNumber();
                    }
                    else
                    {
                        addCol();
                        addColNumber();
                    }
                }
            });

            // パレット
            Palette palette = new Palette();

            palette.SetEngine();
            palette.Hide();

            // サイズ変更ボタン
            List <Button> buttons    = new List <Button>();
            var           sizeButton = new Button(10, 10, "サイズ変更");

            sizeButton.Show();
            asd.Engine.AddObject2D(sizeButton.getBackTexture());
            asd.Engine.AddObject2D(sizeButton.getTextObject());
            buttons.Add(sizeButton);
            sizeButton.SetAction(() =>
            {
                dialog.Show();
            });

            // 解析ボタン
            var anlyzeButton = new Button(10, 50, "解析");

            anlyzeButton.Show();
            asd.Engine.AddObject2D(anlyzeButton.getBackTexture());
            asd.Engine.AddObject2D(anlyzeButton.getTextObject());
            buttons.Add(anlyzeButton);
            anlyzeButton.SetAction(() =>
            {
                PicrossAnalyze picross = new PicrossAnalyze(rowNumberSquare, colNumberSquare);
                var ret = picross.Run();
                for (int row = 0; row < rowNumberSquare.Count; row++)
                {
                    for (int col = 0; col < colNumberSquare.Count; col++)
                    {
                        if (ret[row, col].IsPainted())
                        {
                            drawSquares[row][col].Paint();
                        }
                        else if (ret[row, col].IsMasked())
                        {
                            drawSquares[row][col].Mask();
                        }
                    }
                }
            });

            // セーブボタン
            var saveButton = new Button(10, 90, "セーブ");

            saveButton.Show();
            asd.Engine.AddObject2D(saveButton.getBackTexture());
            asd.Engine.AddObject2D(saveButton.getTextObject());
            buttons.Add(saveButton);
            saveButton.SetAction(() =>
            {
                FileAccess.Save(rowNumberSquare, colNumberSquare);
            });

            // ロードボタン
            var loadButton = new Button(10, 130, "ロード");

            loadButton.Show();
            asd.Engine.AddObject2D(loadButton.getBackTexture());
            asd.Engine.AddObject2D(loadButton.getTextObject());
            buttons.Add(loadButton);
            loadButton.SetAction(() =>
            {
                FileAccess.Load(ref rowNumberSquare, ref colNumberSquare);
                int row = rowNumberSquare.Count();
                int col = colNumberSquare.Count();
                while (row != drawSquares.Count)
                {
                    if (drawSquares.Count > row)
                    {
                        deleteRow();
                    }
                    else
                    {
                        addRow();
                    }
                }
                while (col != drawSquares[0].Count)
                {
                    if (drawSquares[0].Count > col)
                    {
                        deleteCol();
                    }
                    else
                    {
                        addCol();
                    }
                }
            });

            while (asd.Engine.DoEvents())
            {
                asd.Vector2DF pos = asd.Engine.Mouse.Position;
                if (!dialog.IsShow())
                {
                    if (!palette.IsShow())
                    {
                        foreach (var rowList in rowNumberSquare)
                        {
                            foreach (var s in rowList)
                            {
                                s.UpdateTexture(pos);
                            }
                        }
                        foreach (var colList in colNumberSquare)
                        {
                            foreach (var s in colList)
                            {
                                s.UpdateTexture(pos);
                            }
                        }
                        foreach (Button button in buttons)
                        {
                            button.UpdateTexture(pos);
                        }
                    }
                    else
                    {
                        palette.UpdateTexture(pos);
                    }
                }
                else
                {
                    dialog.UpdateTexture(pos);
                }

                if (asd.Engine.Mouse.LeftButton.ButtonState == asd.ButtonState.Push)
                {
                    if (!dialog.IsShow())
                    {
                        if (!palette.IsShow())
                        {
                            int rowIndex;
                            int colIndex;
                            rowIndex = 0;
                            foreach (var rowList in rowNumberSquare)
                            {
                                colIndex = -1;
                                foreach (var s in rowList)
                                {
                                    if (s.IsClick(pos))
                                    {
                                        selectedNumberSquare = s;
                                        selectedRowIndex     = rowIndex;
                                        selectedColIndex     = colIndex;
                                        palette.Show(pos, selectedNumberSquare.GetValue().ToString());
                                    }
                                    colIndex--;
                                }
                                rowIndex++;
                            }
                            colIndex = 0;
                            foreach (var colList in colNumberSquare)
                            {
                                rowIndex = -1;
                                foreach (var s in colList)
                                {
                                    if (s.IsClick(pos))
                                    {
                                        selectedNumberSquare = s;
                                        selectedRowIndex     = rowIndex;
                                        selectedColIndex     = colIndex;
                                        palette.Show(pos, selectedNumberSquare.GetValue().ToString());
                                    }
                                    rowIndex--;
                                }
                                colIndex++;
                            }
                            foreach (Button button in buttons)
                            {
                                if (button.IsClick(pos))
                                {
                                    button.OnClick();
                                }
                            }
                        }
                        else
                        {
                            if (palette.IsClick(pos))
                            {
                                string value = string.Empty;
                                palette.OnClick(pos);
                                if (palette.IsClickEnter())
                                {
                                    palette.Hide();
                                    if (selectedNumberSquare != null)
                                    {
                                        selectedNumberSquare.SetValue(palette.GetValue());
                                        if (selectedNumberSquare.GetStringValue() != string.Empty)
                                        {
                                            if (selectedRowIndex >= 0)
                                            {
                                                if (Math.Abs(selectedColIndex - 1) > rowNumberSquare[selectedRowIndex].Count)
                                                {
                                                    var square = new NumberSquare(selectedRowIndex, selectedColIndex - 1);
                                                    asd.Engine.AddObject2D(square.getBackTexture());
                                                    asd.Engine.AddObject2D(square.getTextObject());
                                                    rowNumberSquare[selectedRowIndex].Add(square);
                                                }
                                            }
                                            else if (selectedColIndex >= 0)
                                            {
                                                if (Math.Abs(selectedRowIndex - 1) > colNumberSquare[selectedColIndex].Count)
                                                {
                                                    var square = new NumberSquare(selectedRowIndex - 1, selectedColIndex);
                                                    asd.Engine.AddObject2D(square.getBackTexture());
                                                    asd.Engine.AddObject2D(square.getTextObject());
                                                    colNumberSquare[selectedColIndex].Add(square);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (selectedRowIndex >= 0)
                                            {
                                                if (Math.Abs(selectedColIndex - 1) <= rowNumberSquare[selectedRowIndex].Count)
                                                {
                                                    asd.Engine.RemoveObject2D(rowNumberSquare[selectedRowIndex][Math.Abs(selectedColIndex + 1)].getBackTexture());
                                                    asd.Engine.RemoveObject2D(rowNumberSquare[selectedRowIndex][Math.Abs(selectedColIndex + 1)].getTextObject());
                                                    rowNumberSquare[selectedRowIndex].RemoveAt(Math.Abs(selectedColIndex + 1));
                                                    for (int col = selectedColIndex + 1; Math.Abs(col) < rowNumberSquare[selectedRowIndex].Count; col--)
                                                    {
                                                        rowNumberSquare[selectedRowIndex][Math.Abs(col)].SetPosition(selectedRowIndex, col - 1);
                                                    }
                                                }
                                            }
                                            else if (selectedColIndex >= 0)
                                            {
                                                if (Math.Abs(selectedRowIndex - 1) <= colNumberSquare[selectedColIndex].Count)
                                                {
                                                    asd.Engine.RemoveObject2D(colNumberSquare[selectedColIndex][Math.Abs(selectedRowIndex + 1)].getBackTexture());
                                                    asd.Engine.RemoveObject2D(colNumberSquare[selectedColIndex][Math.Abs(selectedRowIndex + 1)].getTextObject());
                                                    colNumberSquare[selectedColIndex].RemoveAt(Math.Abs(selectedRowIndex + 1));
                                                    for (int row = selectedRowIndex + 1; Math.Abs(row) < colNumberSquare[selectedColIndex].Count; row--)
                                                    {
                                                        colNumberSquare[selectedColIndex][Math.Abs(row)].SetPosition(row - 1, selectedColIndex);
                                                    }
                                                }
                                            }
                                            selectedNumberSquare.SetValue("0");
                                        }
                                        selectedNumberSquare = null;
                                    }
                                }
                            }
                            else
                            {
                                palette.Hide();
                            }
                        }
                    }
                    else
                    {
                        dialog.OnClick(pos);
                    }
                }
                asd.Engine.Update();
            }
            asd.Engine.Terminate();
        }
Пример #14
0
    public void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("Collision2D_Geometries", 640, 480, new asd.EngineOption());

        // 図形描画オブジェクトのインスタンスを生成する。
        asd.GeometryObject2D geometryObj0 = new asd.GeometryObject2D();
        asd.GeometryObject2D geometryObj1 = new asd.GeometryObject2D();
        asd.GeometryObject2D geometryObj2 = new asd.GeometryObject2D();
        asd.GeometryObject2D geometryObj3 = new asd.GeometryObject2D();

        // マウスによって動かす円。
        asd.CircleShape selfCircle;

        // 停止している円、三角形、矩形。
        asd.CircleShape    circle;
        asd.TriangleShape  triangle;
        asd.RectangleShape rect;


        // 図形描画オブジェクトをエンジンに追加する。
        asd.Engine.AddObject2D(geometryObj0);
        asd.Engine.AddObject2D(geometryObj1);
        asd.Engine.AddObject2D(geometryObj2);
        asd.Engine.AddObject2D(geometryObj3);

        // マウスによって動かす円の形状と描画の設定を行う。
        {
            // 円の外径を指定する。
            selfCircle = new asd.CircleShape();
            selfCircle.OuterDiameter = 100;

            // マウスによって動かす円を描画する図形として設定する。
            geometryObj0.Shape = selfCircle;
        }

        // 停止している円の形状と描画の設定を行う。
        {
            // 円の外径、中心位置を指定する。
            circle = new asd.CircleShape();
            circle.OuterDiameter = 100;
            circle.Position      = new asd.Vector2DF(400, 100);

            // 円を描画する図形として設定する。
            geometryObj1.Shape = circle;
        }

        // 停止している三角形の形状と描画の設定を行う。
        {
            // 三角形の各頂点の位置を指定する。
            triangle = new asd.TriangleShape();
            triangle.SetPointByIndex(new asd.Vector2DF(440, 350), 0);
            triangle.SetPointByIndex(new asd.Vector2DF(340, 450), 1);
            triangle.SetPointByIndex(new asd.Vector2DF(580, 450), 2);

            // 停止している三角形を描画する図形として設定する。
            geometryObj2.Shape = triangle;
        }

        // 停止している矩形の形状と描画の設定を行う。
        {
            rect             = new asd.RectangleShape();
            rect.DrawingArea = new asd.RectF(70, 110, 300, 200);
            rect.Angle       = 15;

            // 停止している矩形を描画する図形として設定する。
            geometryObj3.Shape = rect;
        }


        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // マウスによって制御される円の中心位置をマウスの位置とする。
            selfCircle.Position = asd.Engine.Mouse.Position;

            // 停止している円・三角形・矩形のいずれかに、マウスによって動く円が衝突した時に円を赤く変化させる。
            // そうでない時は白く変化させる。
            if (selfCircle.GetIsCollidedWith(circle) ||
                selfCircle.GetIsCollidedWith(triangle) ||
                selfCircle.GetIsCollidedWith(rect))
            {
                geometryObj0.Color = new asd.Color(255, 0, 0, 255);
            }
            else
            {
                geometryObj0.Color = new asd.Color(255, 255, 255, 255);
            }

            Recorder.CaptureScreen("Collision2D_Geometries", 30, 120, 0.5f, 0.5f);

            // Altseedを更新する。
            asd.Engine.Update();
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
Пример #15
0
        protected override void OnStart()
        {
            var scene        = new asd.Scene();
            var layer        = new asd.Layer2D();
            var texture      = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Sample1.png");
            var geometryObj1 = new asd.GeometryObject2D();
            var geometryObj2 = new asd.GeometryObject2D();
            var geometryObj3 = new asd.GeometryObject2D();
            var geometryObj4 = new asd.GeometryObject2D();
            var geometryObj5 = new asd.GeometryObject2D();
            var geometryObj6 = new asd.GeometryObject2D();

            layer.AddObject(geometryObj1);
            layer.AddObject(geometryObj2);
            layer.AddObject(geometryObj3);
            layer.AddObject(geometryObj4);
            layer.AddObject(geometryObj5);
            layer.AddObject(geometryObj6);

            scene.AddLayer(layer);
            asd.Engine.ChangeScene(scene);

            {
                var circle = new asd.CircleShape();
                circle.OuterDiameter   = 100.0f;
                circle.InnerDiameter   = 10.0f;
                circle.NumberOfCorners = 96;
                circle.Position        = new asd.Vector2DF(100, 50);

                geometryObj1.Shape    = circle;
                geometryObj1.Texture  = texture;
                geometryObj1.Position = new asd.Vector2DF(0, 0);
            }

            {
                var arc = new asd.ArcShape();
                arc.OuterDiameter   = 100;
                arc.InnerDiameter   = 10;
                arc.NumberOfCorners = 96;
                arc.Position        = new asd.Vector2DF(300, 50);
                arc.StartingCorner  = 90;
                arc.EndingCorner    = 5;

                geometryObj2.Shape    = arc;
                geometryObj2.Texture  = texture;
                geometryObj2.Position = new asd.Vector2DF(0, 0);
            }

            {
                var line = new asd.LineShape();
                line.StartingPosition = new asd.Vector2DF(410, 50);
                line.EndingPosition   = new asd.Vector2DF(630, 50);
                line.Thickness        = 5.0f;

                geometryObj3.Shape    = line;
                geometryObj3.Position = new asd.Vector2DF(0, 0);
            }

            {
                var rect = new asd.RectangleShape();
                rect.DrawingArea = new asd.RectF(10, 110, 300, 200);
                rect.UV          = new asd.RectF(0.0f, 0.0f, 0.5f, 0.5f);

                geometryObj4.Shape    = rect;
                geometryObj4.Texture  = texture;
                geometryObj4.Position = new asd.Vector2DF(0, 0);
            }

            {
                var triangle = new asd.TriangleShape();
                triangle.SetPointByIndex(new asd.Vector2DF(320, 350), 0);
                triangle.SetPointByIndex(new asd.Vector2DF(100, 450), 1);
                triangle.SetPointByIndex(new asd.Vector2DF(540, 450), 2);

                triangle.SetUVByIndex(new asd.Vector2DF(0.5f, 0.2f), 0);
                triangle.SetUVByIndex(new asd.Vector2DF(0.1f, 0.5f), 1);
                triangle.SetUVByIndex(new asd.Vector2DF(0.9f, 0.7f), 2);

                geometryObj5.Shape    = triangle;
                geometryObj5.Texture  = texture;
                geometryObj5.Position = new asd.Vector2DF(0, 0);
            }

            {
                var polygon = new asd.PolygonShape();

                for (int i = 0; i < 10; ++i)
                {
                    asd.Vector2DF vec = new asd.Vector2DF(1, 0);
                    vec.Degree = i * 36;
                    vec.Length = (i % 2 == 0) ? 100 : 55;
                    polygon.AddVertex(vec + new asd.Vector2DF(500, 250));
                }

                geometryObj6.Shape    = polygon;
                geometryObj6.Texture  = texture;
                geometryObj6.Position = new asd.Vector2DF(0, 0);
            }
        }
Пример #16
0
        public GameMgr(int bestscore, bool isrestart)
        {
            //レイヤー登録
            {
                LayerOfBackGround = new asd.Layer2D();
                AddLayer(LayerOfBackGround);
                LayerOfBackGround_A = new asd.Layer2D();
                AddLayer(LayerOfBackGround_A);
                LayerOfMain = new asd.Layer2D();
                AddLayer(LayerOfMain);
                CameraOfMain     = new asd.CameraObject2D();
                CameraOfMain.Src = new asd.RectI(0, 0, asd.Engine.WindowSize.X, asd.Engine.WindowSize.Y);
                CameraOfMain.Dst = new asd.RectI(0, 0, asd.Engine.WindowSize.X, asd.Engine.WindowSize.Y);
                LayerOfMain.AddObject(CameraOfMain);
                LayerOfStatus = new asd.Layer2D();
                AddLayer(LayerOfStatus);
            }

            //オブジェクト配置

            //背景
            {
                BackGround         = new asd.TextureObject2D();
                BackGround.Texture = asd.Engine.Graphics.CreateTexture2D("Image/BackGround.png");
                LayerOfBackGround.AddObject(BackGround);

                BackGround_A = new asd.MapObject2D();
                for (int i = 0; i < 200; i++)
                {
                    asd.Chip2D chip = new asd.Chip2D();
                    chip.Texture  = asd.Engine.Graphics.CreateTexture2D("Image/Back_A.png");
                    chip.Position = new asd.Vector2DF(i * 640.0f, 0.0f);
                    BackGround_A.AddChip(chip);
                }
                CameraOfBackGround_A     = new asd.CameraObject2D();
                CameraOfBackGround_A.Src = new asd.RectI(0, 0, 640, 480);
                CameraOfBackGround_A.Dst = new asd.RectI(0, 0, 640, 480);
                LayerOfBackGround_A.AddObject(BackGround_A);
                LayerOfBackGround_A.AddObject(CameraOfBackGround_A);
            }

            //メイン
            {
                Airplane = new Player();
                LayerOfMain.AddObject(Airplane);
                BestScoreLine                 = new asd.GeometryObject2D();
                BoxOfBestScore                = new asd.RectangleShape();
                BoxOfBestScore.DrawingArea    = new asd.RectF(bestscore * 50.0f, 0, 5, 480);
                BestScoreLine.Shape           = BoxOfBestScore;
                BestScoreLine.Color           = new asd.Color(255, 255, 0);
                BestScoreLine.DrawingPriority = 3;
                LayerOfMain.AddObject(BestScoreLine);
                Walls   = new List <Wall>();
                Clouds  = new List <Cloud>();
                Rains   = new List <Rain>();
                Healers = new List <Healer>();
                Winds   = new List <Wind>();
            }

            //ステータス
            {
                HPBar                  = new asd.GeometryObject2D();
                BoxOfHPBar             = new asd.RectangleShape();
                BoxOfHPBar.DrawingArea = new asd.RectF(120, 440, Airplane.HP / Airplane.MaxHP * WidthOfHPBar, 20);
                HPBar.Shape            = BoxOfHPBar;
                HPBar.Color            = new asd.Color(255, 255, 255, 100);

                TextOfHP                = new asd.TextObject2D();
                TextOfHP.Font           = asd.Engine.Graphics.CreateDynamicFont("", 20, new asd.Color(255, 255, 255, 100), 0, new asd.Color(255, 255, 255, 100));
                TextOfHP.Text           = "HP";
                TextOfHP.Color          = new asd.Color(255, 255, 255, 100);
                TextOfHP.CenterPosition = TextOfHP.Font.CalcTextureSize(TextOfHP.Text, asd.WritingDirection.Horizontal).To2DF() / 2.0f;
                TextOfHP.Position       = new asd.Vector2DF(70.0f, 450.0f);

                TextOfScore          = new asd.TextObject2D();
                TextOfScore.Font     = asd.Engine.Graphics.CreateDynamicFont("", 20, new asd.Color(255, 255, 255), 0, new asd.Color(0, 0, 0));
                TextOfScore.Text     = "SCORE : 0";
                TextOfScore.Position = new asd.Vector2DF(10.0f, 10.0f);

                LayerOfStatus.AddObject(HPBar);
                LayerOfStatus.AddObject(TextOfHP);
                LayerOfStatus.AddObject(TextOfScore);
            }

            //スタート
            {
                LayerOfStart               = new asd.Layer2D();
                TextOfTitle                = new asd.TextObject2D();
                TextOfTitle.Font           = asd.Engine.Graphics.CreateDynamicFont("", 60, new asd.Color(255, 255, 255), 0, new asd.Color(255, 255, 255));
                TextOfTitle.Text           = "KAMI HIKOKI";
                TextOfTitle.CenterPosition = TextOfTitle.Font.CalcTextureSize(TextOfTitle.Text, asd.WritingDirection.Horizontal).To2DF() / 2.0f;
                TextOfTitle.Position       = new asd.Vector2DF(asd.Engine.WindowSize.X / 2.0f, asd.Engine.WindowSize.Y / 2.0f);
                TextOfPAK                = new asd.TextObject2D();
                TextOfPAK.Font           = asd.Engine.Graphics.CreateDynamicFont("", 20, new asd.Color(255, 255, 255), 0, new asd.Color(255, 255, 255));
                TextOfPAK.Text           = "Press Any Key";
                TextOfPAK.CenterPosition = TextOfPAK.Font.CalcTextureSize(TextOfPAK.Text, asd.WritingDirection.Horizontal).To2DF() / 2.0f;
                TextOfPAK.Position       = new asd.Vector2DF(asd.Engine.WindowSize.X / 2.0f, 430);
                LayerOfStart.AddObject(TextOfTitle);
                LayerOfStart.AddObject(TextOfPAK);
            }

            //ゲームオーバー
            {
                LayerOfGameOver               = new asd.Layer2D();
                TextOfGameOver                = new asd.TextObject2D();
                TextOfGameOver.Font           = asd.Engine.Graphics.CreateDynamicFont("", 100, new asd.Color(0, 0, 0), 0, new asd.Color(255, 255, 255));
                TextOfGameOver.Text           = "Game Over";
                TextOfGameOver.CenterPosition = TextOfGameOver.Font.CalcTextureSize(TextOfGameOver.Text, asd.WritingDirection.Horizontal).To2DF() / 2.0f;
                TextOfGameOver.Position       = new asd.Vector2DF(320.0f, 600.0f);

                LayerOfGameOver.AddObject(TextOfGameOver);

                CountOfGameOver = 0;
            }

            PairsOfWall = new SortedList <float, float>();
            Level       = 1;
            Count       = 0;
            Score       = 0;
            BestScore   = bestscore;
            IsRestart   = isrestart;

            if (!IsRestart)
            {
                AddLayer(LayerOfStart);
                LayerOfStatus.IsDrawn         = false;
                LayerOfMain.IsUpdated         = false;
                LayerOfBackGround_A.IsUpdated = false;
            }
            else
            {
                LayerOfStart.IsUpdated = false;

                // 音声ファイルを読み込む。BGMの場合、第2引数を false に設定することで、再生しながらファイルを解凍することが推奨されている。
                BGM = asd.Engine.Sound.CreateSoundSource("Sound/PaperPlane_Stage0.ogg", false);

                // 音声のループを有効にする。
                BGM.IsLoopingMode = true;

                // 音声のループ始端を1秒に、ループ終端を6秒に設定する。
                BGM.LoopStartingPoint = 2.0f;
                BGM.LoopEndPoint      = 15.714f;

                // 音声を再生する。
                id_BGM = asd.Engine.Sound.Play(BGM);
            }

            //LoadMap("MapData/Map.csv");
            MakeMap(100.0f);
        }
Пример #17
0
        protected override void OnStart()
        {
            var scene = new asd.Scene();
            var layer = new asd.Layer2D();
            var texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Sample1.png");
            var geometryObj1 = new asd.GeometryObject2D();
            var geometryObj2 = new asd.GeometryObject2D();
            var geometryObj3 = new asd.GeometryObject2D();
            var geometryObj4 = new asd.GeometryObject2D();
            var geometryObj5 = new asd.GeometryObject2D();
            var geometryObj6 = new asd.GeometryObject2D();

            layer.AddObject(geometryObj1);
            layer.AddObject(geometryObj2);
            layer.AddObject(geometryObj3);
            layer.AddObject(geometryObj4);
            layer.AddObject(geometryObj5);
            layer.AddObject(geometryObj6);

            scene.AddLayer(layer);
            asd.Engine.ChangeScene(scene);

            {
                var circle = new asd.CircleShape();
                circle.OuterDiameter = 100.0f;
                circle.InnerDiameter = 10.0f;
                circle.NumberOfCorners = 96;
                circle.Position = new asd.Vector2DF(100, 50);

                geometryObj1.Shape = circle;
                geometryObj1.Texture = texture;
                geometryObj1.Position = new asd.Vector2DF(0, 0);
            }

            {
                var arc = new asd.ArcShape();
                arc.OuterDiameter = 100;
                arc.InnerDiameter = 10;
                arc.NumberOfCorners = 96;
                arc.Position = new asd.Vector2DF(300, 50);
                arc.StartingCorner = 90;
                arc.EndingCorner = 5;

                geometryObj2.Shape = arc;
                geometryObj2.Texture = texture;
                geometryObj2.Position = new asd.Vector2DF(0, 0);
            }

            {
                var line = new asd.LineShape();
                line.StartingPosition = new asd.Vector2DF(410, 50);
                line.EndingPosition = new asd.Vector2DF(630, 50);
                line.Thickness = 5.0f;

                geometryObj3.Shape = line;
                geometryObj3.Position = new asd.Vector2DF(0, 0);
            }

            {
                var rect = new asd.RectangleShape();
                rect.DrawingArea = new asd.RectF(10, 110, 300, 200);
                rect.UV = new asd.RectF(0.0f, 0.0f, 0.5f, 0.5f);

                geometryObj4.Shape = rect;
                geometryObj4.Texture = texture;
                geometryObj4.Position = new asd.Vector2DF(0, 0);
            }

            {
                var triangle = new asd.TriangleShape();
                triangle.SetPointByIndex(new asd.Vector2DF(320, 350), 0);
                triangle.SetPointByIndex(new asd.Vector2DF(100, 450), 1);
                triangle.SetPointByIndex(new asd.Vector2DF(540, 450), 2);

                triangle.SetUVByIndex(new asd.Vector2DF(0.5f, 0.2f), 0);
                triangle.SetUVByIndex(new asd.Vector2DF(0.1f, 0.5f), 1);
                triangle.SetUVByIndex(new asd.Vector2DF(0.9f, 0.7f), 2);

                geometryObj5.Shape = triangle;
                geometryObj5.Texture = texture;
                geometryObj5.Position = new asd.Vector2DF(0, 0);
            }

            {
                var polygon = new asd.PolygonShape();

                for (int i = 0; i < 10; ++i)
                {
                    asd.Vector2DF vec = new asd.Vector2DF(1, 0);
                    vec.Degree = i * 36;
                    vec.Length = (i % 2 == 0) ? 100 : 55;
                    polygon.AddVertex(vec + new asd.Vector2DF(500, 250));

                }

                geometryObj6.Shape = polygon;
                geometryObj6.Texture = texture;
                geometryObj6.Position = new asd.Vector2DF(0, 0);
            }
        }
Пример #18
0
    public void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("Collision2D_Geometries", 640, 480, new asd.EngineOption());

        // 図形描画オブジェクトのインスタンスを生成する。
        asd.GeometryObject2D geometryObj0 = new asd.GeometryObject2D();
        asd.GeometryObject2D geometryObj1 = new asd.GeometryObject2D();
        asd.GeometryObject2D geometryObj2 = new asd.GeometryObject2D();
        asd.GeometryObject2D geometryObj3 = new asd.GeometryObject2D();

        // マウスによって動かす円。
        asd.CircleShape selfCircle;

        // 停止している円、三角形、矩形。
        asd.CircleShape circle;
        asd.TriangleShape triangle;
        asd.RectangleShape rect;

        // 図形描画オブジェクトをエンジンに追加する。
        asd.Engine.AddObject2D(geometryObj0);
        asd.Engine.AddObject2D(geometryObj1);
        asd.Engine.AddObject2D(geometryObj2);
        asd.Engine.AddObject2D(geometryObj3);

        // マウスによって動かす円の形状と描画の設定を行う。
        {
            // 円の外径を指定する。
            selfCircle = new asd.CircleShape();
            selfCircle.OuterDiameter = 100;

            // マウスによって動かす円を描画する図形として設定する。
            geometryObj0.Shape = selfCircle;
        }

        // 停止している円の形状と描画の設定を行う。
        {
            // 円の外径、中心位置を指定する。
            circle = new asd.CircleShape();
            circle.OuterDiameter = 100;
            circle.Position = new asd.Vector2DF(400, 100);

            // 円を描画する図形として設定する。
            geometryObj1.Shape = circle;
        }

        // 停止している三角形の形状と描画の設定を行う。
        {
            // 三角形の各頂点の位置を指定する。
            triangle = new asd.TriangleShape();
            triangle.SetPointByIndex(new asd.Vector2DF(440, 350), 0);
            triangle.SetPointByIndex(new asd.Vector2DF(340, 450), 1);
            triangle.SetPointByIndex(new asd.Vector2DF(580, 450), 2);

            // 停止している三角形を描画する図形として設定する。
            geometryObj2.Shape = triangle;
        }

        // 停止している矩形の形状と描画の設定を行う。
        {
            rect = new asd.RectangleShape();
            rect.DrawingArea = new asd.RectF(70, 110, 300, 200);
            rect.Angle = 15;

            // 停止している矩形を描画する図形として設定する。
            geometryObj3.Shape = rect;
        }

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // マウスによって制御される円の中心位置をマウスの位置とする。
            selfCircle.Position = asd.Engine.Mouse.Position;

            // 停止している円・三角形・矩形のいずれかに、マウスによって動く円が衝突した時に円を赤く変化させる。
            // そうでない時は白く変化させる。
            if (selfCircle.GetIsCollidedWith(circle)
                || selfCircle.GetIsCollidedWith(triangle)
                || selfCircle.GetIsCollidedWith(rect))
            {
                geometryObj0.Color = new asd.Color(255, 0, 0, 255);
            }
            else
            {
                geometryObj0.Color = new asd.Color(255, 255, 255, 255);
            }

            Recorder.CaptureScreen("Collision2D_Geometries", 30, 120, 0.5f, 0.5f);

            // Altseedを更新する。
            asd.Engine.Update();
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
Пример #19
0
        protected override void OnRegistered()
        {
            var layer = new asd.Layer2D();

            AddLayer(layer);

            // 下地
            var background = new asd.GeometryObject2D();

            layer.AddObject(background);
            var bgRect = new asd.RectangleShape();

            bgRect.DrawingArea = new asd.RectF(0, 0, 1800, 1000);
            background.Shape   = bgRect;

            var label = new asd.TextObject2D();

            label.Font     = Singleton.LargeFont;
            label.Text     = "VS";
            label.Position = new asd.Vector2DF(470, 400);
            layer.AddObject(label);

            var attackCityLabel = new asd.TextObject2D();

            attackCityLabel.Font     = Singleton.LargeFont;
            attackCityLabel.Text     = _attack.Name;
            attackCityLabel.Position = new asd.Vector2DF(450, 650);
            layer.AddObject(attackCityLabel);

            var deffenceCityLabel = new asd.TextObject2D();

            deffenceCityLabel.Font     = Singleton.LargeFont;
            deffenceCityLabel.Text     = _deffence.Name;
            deffenceCityLabel.Position = new asd.Vector2DF(450, 150);
            layer.AddObject(deffenceCityLabel);

            _attackParam          = new asd.TextObject2D();
            _attackParam.Font     = Singleton.LargeFont;
            _attackParam.Text     = "戦闘力:" + _attackPower;
            _attackParam.Position = new asd.Vector2DF(700, 650);
            layer.AddObject(_attackParam);

            _deffenceParam          = new asd.TextObject2D();
            _deffenceParam.Font     = Singleton.LargeFont;
            _deffenceParam.Text     = "戦闘力:" + _deffencePower;
            _deffenceParam.Position = new asd.Vector2DF(700, 150);
            layer.AddObject(_deffenceParam);

            _image_gu_attack = new BattleIcon(BattleIcon.Icon.Gu, BattleIcon.Position.Attack);
            _image_gu_attack.AddLayer(layer);
            _image_gu_attack.Hide();
            _image_choki_attack = new BattleIcon(BattleIcon.Icon.Choki, BattleIcon.Position.Attack);
            _image_choki_attack.AddLayer(layer);
            _image_choki_attack.Hide();
            _image_par_attack = new BattleIcon(BattleIcon.Icon.Par, BattleIcon.Position.Attack);
            _image_par_attack.AddLayer(layer);
            _image_par_attack.Hide();
            _image_gu_deffence = new BattleIcon(BattleIcon.Icon.Gu, BattleIcon.Position.Deffence);
            _image_gu_deffence.AddLayer(layer);
            _image_gu_deffence.Hide();
            _image_choki_deffence = new BattleIcon(BattleIcon.Icon.Choki, BattleIcon.Position.Deffence);
            _image_choki_deffence.AddLayer(layer);
            _image_choki_deffence.Hide();
            _image_par_deffence = new BattleIcon(BattleIcon.Icon.Par, BattleIcon.Position.Deffence);
            _image_par_deffence.AddLayer(layer);
            _image_par_deffence.Hide();
            _attackResult = new BattleIcon(BattleIcon.Icon.Choki, BattleIcon.Position.Attack);
            _attackResult.AddLayer(layer);
            _attackResult.Hide();
            _deffenceResult = new BattleIcon(BattleIcon.Icon.Choki, BattleIcon.Position.Deffence);
            _deffenceResult.AddLayer(layer);
            _deffenceResult.Hide();
        }