internal CoordinateSpace(Map map, RenderMap renderMap) { this.map = map; this.renderMap = renderMap; columnRowFactor = (map.Size % 2 == 0) ? 4 : 2; }
/* * public void Reload(Stream fontStream, int faceIndex) { * try { * SharpFont.Face currentFace = Face; * Load(fontStream, faceIndex); * * if (currentFace != null) { * currentFace.Dispose(); * } * } catch(System.Exception e) { * throw e; * } * } */ public Font Clone(float?size = null) { string[] filenames; if (Filenames != null) { filenames = new string[Filenames.Length]; Filenames.CopyTo(filenames, 0); } else { filenames = null; } RenderMap?.AddReferenceCount(); Font font = new Font() { Name = Name, Filenames = filenames, RenderMap = RenderMap, ShaderParameters = ShaderParameters?.Clone() }; if (size.HasValue) { font.Size = size.Value; } else { font.Size = _size; } return(font); }
public static bool Render(Graphics g, int w, int h, float angle, short x = -1, short y = -1, int indexToRender = -1) { bool update = false; if (indexToRender >= 0) { return(((RenderMap)_objects[(int)LAYER_ORDER.BACKGROUND][indexToRender]).Render(g, w, h, angle, x, y)); } for (int i = 0; i < _objects[(int)LAYER_ORDER.BACKGROUND].Count; i++) { RenderMap map = (RenderMap)_objects[(int)LAYER_ORDER.BACKGROUND][i]; if (map != null) { if (map.IsDisposing) { _objects[(int)LAYER_ORDER.BACKGROUND].RemoveAt(i); } else { update |= map.Render(g, w, h, angle, x, y); } } } return(update); }
public void GenAllMap() { float[,] biomeMap = GenWorldPreview.GenBiomeMap(scale, seed, offset); RenderMap display = FindObjectOfType <RenderMap>(); display.CreateMap(biomeMap); }
public void Reload() { try { RenderMap?.Reload(); } catch (System.Exception e) { throw e; } }
/// <inheritdoc cref="IRenderable.RenderMap"/> public RenderMap RenderMap(bool compatibility = false) { var map = new RenderMap(); map.Add(_positions[0], compatibility ? 'x' : '●'); return(map); }
void Awake() { instance = this; for (int i = 0; i < filterLines.Length; i++) { filterLines[i] = new List <GameObject>(); } loactionsGO = Instantiate(new GameObject(), new Vector3(0, 0, 0), transform.rotation); loactionsGO.name = "Loactions"; loactionsGO.transform.SetSiblingIndex(1); }
/// <inheritdoc cref="IRenderable.RenderMap"/> public RenderMap RenderMap(bool compatibility = false) { var map = new RenderMap(); // Calculate the location of the title bar for (var i = 0; i < _text.Length; i++) { map.Add(new Position(i, 0), _text[i]); } return(map); }
/// <inheritdoc cref="IRenderable.RenderMap"/> public RenderMap RenderMap(bool compatibility = false) { var map = new RenderMap(); // Calculate the location of the status bar for (var i = Console.BufferWidth - _text.Length - 1; i < Console.BufferWidth - 1; i++) { map.Add(new Position(i, Console.BufferHeight - 1), _text[i - Console.BufferWidth + _text.Length + 1]); } return(map); }
public void Dispose() { if (IsDisposed) { return; } if (RenderMap != null) { RenderMap.Dispose(); RenderMap = null; } IsDisposed = true; }
void Awake() { instance = this; targetMapScale = GetComponent <Camera>().orthographicSize; for (int i = 0; i < filterLines.Length; i++) { filterLines[i] = new List <GameObject>(); } loactionsGO = Instantiate(new GameObject(), new Vector3(0, 0, 0), transform.rotation); loactionsGO.name = "Loactions"; loactionsGO.transform.SetSiblingIndex(1); for (int i = 0; i < filterState.Length; i++) { filterState[i] = true; } }
/// <inheritdoc cref="IRenderable.RenderMap"/> public RenderMap RenderMap(bool compatibility = false) { var map = new RenderMap(); foreach (var position in _positions) { map.Add(position, compatibility ? '#' : '█'); } // Concept of different heads depending on the moving direction // var last = _locations.Last(); // foreach (var location in _locations) // { // map.Add(location, compatibility ? '#' : '█'); // if (location.X == last.X && location.Y == last.Y) // switch (_direction) // { // case Direction.Down: // map.Add(location, '▼'); // break; // case Direction.Left: // map.Add(location, '◀'); // break; // case Direction.Right: // map.Add(location, '▶'); // break; // case Direction.Up: // map.Add(location, '▲'); // break; // } // else // map.Add(location, '█'); // } return(map); }
public static void RemoveMap(RenderMap map) { _objects[(int)LAYER_ORDER.BACKGROUND].Remove(map); }
public static void AddMap(RenderMap map) { _objects[(int)LAYER_ORDER.BACKGROUND].Add(map); }
public Vector2 MeasureText(string text) { RenderMap.PrepareTextRenderData(text, out double textEmWidth, out double textEmHeight); return(new Vector2(textEmWidth, textEmHeight)); }
public Text.RenderData PrepareTextRenderData(string text) { return(RenderMap.PrepareTextRenderData(text, out _, out _)); }
public Text.RenderData PrepareTextRenderData(string text, out double textEmWidth, out double textEmHeight) { return(RenderMap.PrepareTextRenderData(text, out textEmWidth, out textEmHeight)); }
public void ShiftGrid(GameManager.Direction direction) { RenderMap[] maps = new RenderMap[] { renderMap, altRenderMap }; foreach (RenderMap rM in maps) { for (int x = 0; x < rM.dim; x++) { for (int y = 0; y < rM.dim; y++) { for (int i = 0; i < 4; i++) { rM[x, y].SetLineFromDir((Direction)i, false); } } } switch (direction) { case GameManager.Direction.North: for (int x = 0; x < rM.dim; x++) { for (int y = 0; y < rM.dim - 1; y++) // Dont do final row since it doesnt have anything after it { rM[x, y].CopyState(rM[x, y + 1]); } } //Handle blanking out the last row out for (int x = 0; x < rM.dim; x++) { rM[x, rM.dim - 1].DrawFullNode(null); } break; case GameManager.Direction.East: for (int x = 0; x < rM.dim - 1; x++) { for (int y = 0; y < rM.dim; y++) // Dont do final row since it doesnt have anything after it { rM[x, y].CopyState(rM[x + 1, y]); } } //Handle blanking out the last row out for (int y = 0; y < rM.dim; y++) { rM[rM.dim - 1, y].DrawFullNode(null); } //Handling blanking the last row out break; case GameManager.Direction.South: for (int x = 0; x < rM.dim; x++) { for (int y = rM.dim - 1; y > 0; y--) // Dont do final row since it doesnt have anything after it { rM[x, y].CopyState(rM[x, y - 1]); } } //Handling blanking the last row out //Handle blanking out the last row out for (int x = 0; x < rM.dim; x++) { rM[x, 0].DrawFullNode(null); } break; case GameManager.Direction.West: for (int x = rM.dim - 1; x > 0; x--) { for (int y = 0; y < rM.dim; y++) // Dont do final row since it doesnt have anything after it { rM[x, y].CopyState(rM[x - 1, y]); } } //Handling blanking the last row out for (int y = 0; y < rM.dim; y++) { rM[0, y].DrawFullNode(null); } break; default: break; } } }