Inheritance: SpriteDrawableBase
        protected override void Initialize()
        {
            DebugInfoEnabled = true;
            DebugInfo.RefreshForcesRender = false;
            DrawEngine2d.ClearColor = Colors.Blue;

            TiledTexture tt = DrawEngine2d.TiledTextures.CreateTiledTexture("/Application/TwinStickShooter/Images/Ship64.png");
            ColumnKey key = tt.CreateColumnIndex(1).GetKey(0);

            LayerBase l2 = DrawEngine2d.Layers.GetOrCreateWorldLayer(1);

            Ship1 = new Sprite(l2, key);
            Ship1.SetPosition(100f, 100f);

            Sprite testSprite = new Sprite(l2,key);
            testSprite.SetDimensionsProportionallyByWidth(200f);
            testSprite.SetPosition(l2.Camera.Center);
        }
Esempio n. 2
0
        private void InitializeLayersAndSprites()
        {
            //Create the layer to draw sprites into.
            ScreenLayer ScreenLayer = DrawEngine2d.Layers.GetOrCreateScreenLayer(2);

            Single logoPstnX = ScreenLayer.Camera.Center.X;
            Single logoPstnY = ScreenLayer.Camera.Top + ScreenLayer.Camera.Height * 0.23f;
            Single logoH = ScreenLayer.Camera.Height * 0.15f;

            Single rowHeight = ScreenLayer.Camera.Height * 0.1f;

            Single buttonRight = ScreenLayer.Camera.Width * 0.2f;
            Single modeLeft = buttonRight + ScreenLayer.Camera.Width * 0.05f;

            Single row1 = rowHeight * 3.2f;
            Single row2 = rowHeight * 4.7f;
            Single row3 = rowHeight * 6.2f;
            Single row4 = rowHeight * 7.7f;

            //Create the Psm Logo
            TiledTexture logoTT = DrawEngine2d.TiledTextures.CreateTiledTexture(Assets.PsmLogo);
            ColumnKey logoKey = logoTT.CreateColumnIndex(1).GetKey(0);
            Sprite Logo = new Sprite(ScreenLayer, logoKey);
            Logo.SetDimensionsProportionallyByHeight(logoH);
            Logo.SetPosition(logoPstnX, logoPstnY, PsmFramework.Engines.DrawEngine2d.Support.RelativePosition.Bottom);

            TiledTexture crossTT = DrawEngine2d.TiledTextures.CreateTiledTexture(Assets.ButtonCross);
            ColumnKey crossKey = crossTT.CreateColumnIndex(1).GetKey(0);
            Sprite cross = new Sprite(ScreenLayer, crossKey);
            cross.SetDimensionsProportionallyByHeight(rowHeight);
            cross.SetPosition(buttonRight, row1, PsmFramework.Engines.DrawEngine2d.Support.RelativePosition.Right);

            TiledTexture squareTT = DrawEngine2d.TiledTextures.CreateTiledTexture(Assets.ButtonSquare);
            ColumnKey squareKey = squareTT.CreateColumnIndex(1).GetKey(0);
            Sprite square = new Sprite(ScreenLayer, squareKey);
            square.SetDimensionsProportionallyByHeight(rowHeight);
            square.SetPosition(buttonRight, row2, PsmFramework.Engines.DrawEngine2d.Support.RelativePosition.Right);

            TiledTexture triangleTT = DrawEngine2d.TiledTextures.CreateTiledTexture(Assets.ButtonTriangle);
            ColumnKey triangleKey = triangleTT.CreateColumnIndex(1).GetKey(0);
            Sprite triangle = new Sprite(ScreenLayer, triangleKey);
            triangle.SetDimensionsProportionallyByHeight(rowHeight);
            triangle.SetPosition(buttonRight, row3, PsmFramework.Engines.DrawEngine2d.Support.RelativePosition.Right);

            TiledTexture circleTT = DrawEngine2d.TiledTextures.CreateTiledTexture(Assets.ButtonCircle);
            ColumnKey circleKey = circleTT.CreateColumnIndex(1).GetKey(0);
            Sprite circle = new Sprite(ScreenLayer, circleKey);
            circle.SetDimensionsProportionallyByHeight(rowHeight);
            circle.SetPosition(buttonRight, row4, PsmFramework.Engines.DrawEngine2d.Support.RelativePosition.Right);

            TiledTexture modesTT = DrawEngine2d.TiledTextures.CreateTiledTexture(Assets.Modes);
            GridIndex modesIndex = modesTT.CreateGridIndex(1,4);

            GridKey tssKey = modesIndex.GetKey(0, 0);
            Sprite tss = new Sprite(ScreenLayer, tssKey);
            tss.SetDimensionsProportionallyByHeight(rowHeight);
            tss.SetPosition(modeLeft, row1,RelativePosition.Left);

            GridKey isoKey = modesIndex.GetKey(0, 1);
            Sprite iso = new Sprite(ScreenLayer, isoKey);
            iso.SetDimensionsProportionallyByHeight(rowHeight);
            iso.SetPosition(modeLeft, row2,RelativePosition.Left);

            GridKey ge2dKey = modesIndex.GetKey(0, 2);
            Sprite ge2d = new Sprite(ScreenLayer, ge2dKey);
            ge2d.SetDimensionsProportionallyByHeight(rowHeight);
            ge2d.SetPosition(modeLeft, row3,RelativePosition.Left);

            GridKey testKey = modesIndex.GetKey(0, 3);
            Sprite test = new Sprite(ScreenLayer, testKey);
            test.SetDimensionsProportionallyByHeight(rowHeight);
            test.SetPosition(modeLeft, row4,RelativePosition.Left);

            //Experimenting
            //			Font f = new Font(FontAlias.System, (Int32)rowHeight, FontStyle.Regular);
            //			Int32 i = f.Metrics.Height;
            //String t = "test";
        }
 protected override void Cleanup()
 {
     Ship1.Dispose();
     Ship1 = null;
 }