Ejemplo n.º 1
0
        protected override Scene CreateScene()
        {
            var scene = new Scene("Tiled") { UseLinearSampler = false };
            scene.Add(new ColorLayer("Background", Color.CornflowerBlue));

            var tiledFile = TiledFile.LoadScalable(@"Tiled\untitled.tmx", this.ResourceManager);
            this.tileLayers = tiledFile.TileLayers.ToList();
            scene.AddRange(this.tileLayers);

            var drawingLayer = new DrawingLayer("ObjectLayer");
            foreach (var tiledObject in tiledFile.ObjectLayers.First().TiledObjects)
                drawingLayer.AddRectangle(tiledObject.Position.X, tiledObject.Position.Y, 10, 10, 2, Color.Red);

            scene.Add(drawingLayer);

            return scene;
        }
Ejemplo n.º 2
0
        protected override Scene CreateScene()
        {
            var scene = new Scene("HubScene");
            scene.Add(new ColorLayer("Background", Color.CornflowerBlue));

            var font = this.ResourceManager.GetDrawingFont(@"Sandbox\SpriteFont1");

            var hubMap = new DrawingLayer("HubMap");

            this.sandboxRectangle = hubMap.AddRectangle(10, 10, 200, 200, 1, Color.White);
            this.shootEmUpRectangle = hubMap.AddRectangle(220, 10, 200, 200, 1, Color.White);
            this.tiledRectangle = hubMap.AddRectangle(10, 230, 200, 200, 1, Color.White);
            this.touchRectangle = hubMap.AddRectangle(220, 230, 200, 200, 1, Color.White);
            //hubMap.AddRectangle(10, 230, 200, 200, 1, Color.White);
            //hubMap.AddRectangle(220, 230, 200, 200, 1, Color.White);

            hubMap.AddText(font, "1 - Sandbox sample", new Vector(20, 210), Color.White);
            hubMap.AddText(font, "2 - ShootEmUp sample", new Vector(220, 210), Color.White);
            hubMap.AddText(font, "3 - Tiled sample", new Vector(20, 430), Color.White);
            hubMap.AddText(font, "4 - Touch sample", new Vector(220, 430), Color.White);

            scene.Add(hubMap);

            scene.Add(new MouseCursor(this.InputConfiguration.CreateMouseTracking(this.Camera)));

            return scene;
        }
Ejemplo n.º 3
0
        private DrawingLayer CreateButtonLayer()
        {
            var font = this.ResourceManager.GetDrawingFont(@"Sandbox\SpriteFont1");

            var drawingMap = new DrawingLayer("Button");

            this.visualBackButtonElement = drawingMap.AddRectangle(this.visualBackButton.Rectangle, 2, Color.Blue);
            drawingMap.AddText(font, "Back", this.visualBackButton.Rectangle.Location.Translate(10, 10), Color.White);

            return drawingMap;
        }