Inheritance: OpenRA.Widgets.Widget
 protected TerrainTemplatePreviewWidget(TerrainTemplatePreviewWidget other)
     : base(other)
 {
     worldRenderer = other.worldRenderer;
     tileset       = other.worldRenderer.World.Map.Rules.TileSet;
     Template      = other.Template;
     GetScale      = other.GetScale;
 }
 protected TerrainTemplatePreviewWidget(TerrainTemplatePreviewWidget other)
     : base(other)
 {
     worldRenderer = other.worldRenderer;
     tileset = other.worldRenderer.World.Map.Rules.TileSet;
     Template = other.Template;
     GetScale = other.GetScale;
 }
Example #3
0
 protected TerrainTemplatePreviewWidget(TerrainTemplatePreviewWidget other)
     : base(other)
 {
     worldRenderer   = other.worldRenderer;
     terrainRenderer = other.terrainRenderer;
     Template        = other.Template;
     GetScale        = other.GetScale;
 }
Example #4
0
        public EditorTileBrush(EditorViewportControllerWidget editorWidget, ushort template, WorldRenderer wr)
        {
            this.editorWidget = editorWidget;
            Template = template;
            worldRenderer = wr;
            world = wr.World;

            preview = editorWidget.Get<TerrainTemplatePreviewWidget>("DRAG_TILE_PREVIEW");
            preview.GetScale = () => worldRenderer.Viewport.Zoom;
            preview.IsVisible = () => editorWidget.CurrentBrush == this;

            preview.Template = world.TileSet.Templates.First(t => t.Value.Id == template).Value;
            bounds = worldRenderer.Theater.TemplateBounds(preview.Template, Game.ModData.Manifest.TileSize, world.Map.TileShape);

            // The preview widget may be rendered by the higher-level code before it is ticked.
            // Force a manual tick to ensure the bounds are set correctly for this first draw.
            Tick();
        }
Example #5
0
        public EditorTileBrush(EditorViewportControllerWidget editorWidget, ushort template, WorldRenderer wr)
        {
            this.editorWidget = editorWidget;
            Template          = template;
            worldRenderer     = wr;
            world             = wr.World;

            preview           = editorWidget.Get <TerrainTemplatePreviewWidget>("DRAG_TILE_PREVIEW");
            preview.GetScale  = () => worldRenderer.Viewport.Zoom;
            preview.IsVisible = () => editorWidget.CurrentBrush == this;

            preview.Template = world.TileSet.Templates.First(t => t.Value.Id == template).Value;
            bounds           = worldRenderer.Theater.TemplateBounds(preview.Template, Game.ModData.Manifest.TileSize, world.Map.TileShape);

            // The preview widget may be rendered by the higher-level code before it is ticked.
            // Force a manual tick to ensure the bounds are set correctly for this first draw.
            Tick();
        }