Esempio n. 1
0
        protected override void RenderContent(RenderComposer composer)
        {
            if (ImGui.Button("Choose File"))
            {
                var explorer = new FileExplorer <TextAsset>(LoadFile);
                Parent.AddWindow(explorer);
            }

            ImGui.Text($"Current File: {_file?.Name ?? "None"}");
            if (_file == null)
            {
                return;
            }
            if (ImGui.Button("Reload"))
            {
                LoadFile(FileExplorer <TextAsset> .ExplorerLoadAsset(_file.Name));
            }

            ImGui.Text("Tile Layers");
            for (var i = 0; i < _map.TiledMap.TileLayers.Count; i++)
            {
                TmxLayer curLayer = _map.TiledMap.TileLayers[i];
                ImGui.Text($"{curLayer.Name} {curLayer.Width}x{curLayer.Height}" + (curLayer.Visible ? "" : " Hidden"));
            }

            composer.SetUseViewMatrix(true);
            composer.Render(_map);
        }
Esempio n. 2
0
        public void RenderRichText()
        {
            var asset    = Engine.AssetLoader.Get <FontAsset>("Fonts/1980XX.ttf");
            var testRich = new RichText(new Vector3(20, 20, 0), new Vector2(100, 100), asset.GetAtlas(20));

            testRich.SetText("The quick brown fox jumps over the <color=255-0-0>lazy</> dog.\n123456789!@#$%^&*(0");

            Runner.ExecuteAsLoop(_ =>
            {
                RenderComposer composer = Engine.Renderer.StartFrame();
                composer.Render(testRich);
                Engine.Renderer.EndFrame();
                Runner.VerifyScreenshot(ResultDb.RenderRichText);
            }).WaitOne();
        }
Esempio n. 3
0
        public void TilemapTest()
        {
            var tileMap = new TileMap <TransformRenderable>("Tilemap/DeepForest.tmx");

            Runner.ExecuteAsLoop(_ =>
            {
                RenderComposer composer = Engine.Renderer.StartFrame();

                composer.Render(tileMap);

                Engine.Renderer.EndFrame();
                Runner.VerifyScreenshot(ResultDb.TilemapRender);
            }).WaitOne();

            tileMap.Reset("");
        }