public MySfmlNesApp(int x, int y, uint w, uint h, string rom, uint scale = 1) : base("NES", w, h, scale) { Nes = new Nes(this, Controller1); Nes.LoadRom(rom); Nes.RunOnThread(); Position = new SFML.System.Vector2i(x, y); }
/// <summary> /// Processes the mouse. If allowed, will move the console around with the mouse. /// </summary> /// <param name="info">The mouse state.</param> /// <returns></returns> public override bool ProcessMouse(Input.MouseInfo info) { if (_titleWidth != 0 && _isVisible) { info.Fill(this); if (_isDragging && info.LeftButtonDown) { if (base.UsePixelPositioning) { Position = new Point(info.ScreenLocation.X - (_previousMouseInfo.ScreenLocation.X - _consoleAtDragAbsPos.X), info.ScreenLocation.Y - (_previousMouseInfo.ScreenLocation.Y - _consoleAtDragAbsPos.Y)); } else { Position = new Point(info.WorldLocation.X - _previousMouseInfo.ConsoleLocation.X, info.WorldLocation.Y - _previousMouseInfo.ConsoleLocation.Y); } return(true); } // Stopped dragging if (_isDragging && !info.LeftButtonDown) { _isDragging = false; ExclusiveFocus = _prevousMouseExclusiveDrag; return(true); } // Left button freshly down and we're not already dragging, check to see if in title if (!_isDragging && !_previousMouseInfo.LeftButtonDown && info.LeftButtonDown) { if (info.ConsoleLocation.Y == 0 && info.ConsoleLocation.X >= _titleLocationX && info.ConsoleLocation.X < _titleLocationX + _titleWidth) { _prevousMouseExclusiveDrag = ExclusiveFocus; // Mouse is in the title bar ExclusiveFocus = true; _isDragging = true; _consoleAtDragAbsPos = base.Position; if (this.MouseCanFocus) { if (Engine.ActiveConsole != this) { Engine.ActiveConsole = this; } if (this.Parent != null && this.Parent.IndexOf(this) != this.Parent.Count - 1) { this.Parent.MoveToTop(this); } } } } _previousMouseInfo = info.Clone(); } return(base.ProcessMouse(info)); }
static void OnClick(object sender, EventArgs e) { SFML.System.Vector2i mousePos = Mouse.GetPosition((RenderWindow)sender); switch (SortSelectMenu.SelectSort(enviroment.Width * CELL_SIZE, mousePos)) { case 0: enviroment.Agent.setSearch("DFS"); break; case 1: enviroment.Agent.setSearch("BFS"); break; case 2: enviroment.Agent.setSearch("GBFS"); break; case 3: enviroment.Agent.setSearch("AS"); break; case 4: enviroment.Agent.setSearch("IDDFS"); break; case 5: enviroment.Agent.setSearch("RBFS"); break; default: break; } }
public static Point FromFramework(FrameworkPoint point) { return(new Point() { X = point.X, Y = point.Y }); }
public Serialized(GameObject gameObject) { Animations = new List <Consoles.AnimatedTextSurface.Serialized>(); foreach (var item in gameObject.Animations) { Animations.Add(new Consoles.AnimatedTextSurface.Serialized(item.Value)); } IsVisible = gameObject.IsVisible; Position = gameObject.position; RepositionRects = gameObject.repositionRects; UsePixelPositioning = gameObject.usePixelPositioning; Name = gameObject.Name; FontName = gameObject.font.Name; FontSize = gameObject.font.SizeMultiple; RenderOffset = gameObject.renderOffset; if (gameObject.Animations.ContainsValue(gameObject.animation) && gameObject.Animations.ContainsKey(gameObject.animation.Name)) { storedAsName = true; storedAnimationName = gameObject.animation.Name; } else { storedAsName = false; storedAnimationName = gameObject.animation.Name; Animation = new Consoles.AnimatedTextSurface.Serialized(gameObject.animation); } }
/// <summary> /// Processes an area and applies a gradient calculation to each part of the area. /// </summary> /// <param name="position">The center of the gradient.</param> /// <param name="strength">The width of the gradient spread.</param> /// <param name="angle">The angle to apply the gradient.</param> /// <param name="area">The area to calculate.</param> /// <param name="applyAction">The callback called for each part of the area.</param> public static void GradientFill(Point cellSize, Point position, int strength, int angle, Rectangle area, ColorGradient gradient, Action <int, int, Color> applyAction) { double radians = angle * Math.PI / 180; // = Math.Atan2(x1 - x2, y1 - y2); Vector2 angleVector = new Vector2((float)(Math.Sin(radians) * strength), (float)(Math.Cos(radians) * strength)) / 2; Vector2 location = new Vector2(position.X, position.Y); if (cellSize.X > cellSize.Y) { angleVector.Y *= cellSize.X / cellSize.Y; } else if (cellSize.X < cellSize.Y) { angleVector.X *= cellSize.Y / cellSize.X; } Vector2 endingPoint = location + angleVector; Vector2 startingPoint = location - angleVector; double x1 = (startingPoint.X / (double)area.Width) * 2.0f - 1.0f; double y1 = (startingPoint.Y / (double)area.Height) * 2.0f - 1.0f; double x2 = (endingPoint.X / (double)area.Width) * 2.0f - 1.0f; double y2 = (endingPoint.Y / (double)area.Height) * 2.0f - 1.0f; double start = x1 * angleVector.X + y1 * angleVector.Y; double end = x2 * angleVector.X + y2 * angleVector.Y; for (int x = area.Left; x < area.Width; x++) { for (int y = area.Top; y < area.Height; y++) { // but we need vectors from (-1, -1) to (1, 1) // instead of pixels from (0, 0) to (width, height) double u = (x / (double)area.Width) * 2.0f - 1.0f; double v = (y / (double)area.Height) * 2.0f - 1.0f; double here = u * angleVector.X + v * angleVector.Y; double lerp = (start - here) / (start - end); //lerp = Math.Abs((lerp - (int)lerp)); lerp = MyMathHelper.Clamp((float)lerp, 0f, 1.0f); int counter; for (counter = 0; counter < gradient.Stops.Length && gradient.Stops[counter].Stop < (float)lerp; counter++) { ; } counter--; counter = (int)MyMathHelper.Clamp(counter, 0, gradient.Stops.Length - 2); float newLerp = (gradient.Stops[counter].Stop - (float)lerp) / (gradient.Stops[counter].Stop - gradient.Stops[counter + 1].Stop); applyAction(x, y, ColorHelper.Lerp(gradient.Stops[counter].Color, gradient.Stops[counter + 1].Color, newLerp)); } } }
public override void Run() { if (!_started) { _started = true; _textCopy = Text.ToString(); _textIndex = 0; if (_textCopy.Length == 0) { IsFinished = true; base.Run(); return; } _tempLocation = Position; if (TotalTimeToPrint > 0f) { _timePerCharacter = TotalTimeToPrint / _textCopy.Length; } } if (TotalTimeToPrint == 0f) { Target.Print(Position.X, Position.Y, Text); IsFinished = true; } else { _timeElapsed += SadConsole.Engine.GameTimeElapsedUpdate; if (_timeElapsed >= _timePerCharacter) { int charCount = (int)(_timeElapsed / _timePerCharacter); _timeElapsed = 0d; SadConsole.Consoles.Cursor cur; cur = new Consoles.Cursor(Target); cur.Position = _tempLocation; if (charCount >= _textCopy.Length - _textIndex) { charCount = _textCopy.Length - _textIndex; IsFinished = true; } var textToPrint = Text.SubString(_textIndex, charCount); cur.Print(textToPrint); _textIndex += (short)charCount; _tempLocation = cur.Position; } } base.Run(); }
/// <summary> /// calculates the row of the mouse click /// </summary> /// <param name="gridWidth">the height of the row</param> /// <param name="mousePos">the mouse position</param> /// <returns>the row of the mouse click</returns> static public int SelectSort(int gridWidth, SFML.System.Vector2i mousePos) { if (mousePos.X < gridWidth) { return(-1); } return(mousePos.Y / BUTTON_HEIGHT); }
public static double DistanceTo(this SFML.System.Vector2i obj, SFML.System.Vector2i other) { var x = other.X - obj.X; x *= x; var y = other.Y - obj.Y; y *= y; return(Math.Sqrt(x + y)); }
private static SFML.System.Vector2i getClickPosition() { SFML.System.Vector2i posi = new SFML.System.Vector2i(-1, -1); if (Mouse.IsButtonPressed(Mouse.Button.Left)) { posi = Mouse.GetPosition(janela); } System.Threading.Thread.Sleep(10); return(posi); }
public ConsoleViewInputHandler() { CanMoveWithRightButton = false; CanMoveWithLeftButton = false; CanMoveWithKeyboard = false; MoveUpKey = Keys.Up; MoveDownKey = Keys.Down; MoveLeftKey = Keys.Left; MoveRightKey = Keys.Right; _mouseDown = false; _mouseLastLocation = new Point(); }
public Serialized(AnimatedTextSurface surface) { Frames = surface.Frames.ToArray(); Width = surface.width; Height = surface.height; AnimationDuration = surface.AnimationDuration; Name = surface.Name; FontName = surface.font.Name; FontSize = surface.font.SizeMultiple; Repeat = surface.Repeat; Center = surface.Center; }
/// <summary> /// Default constructor of the control. /// </summary> public ControlBase(int width, int height) : base(new TextSurface(width, height, Engine.DefaultFont)) { IsDirty = true; TabStop = true; IsVisible = true; FocusOnClick = true; CanFocus = false; _position = new Point(); CanUseMouse = true; CanUseKeyboard = true; }
/// <summary> /// Moves the cusor up by the specified amount of lines. /// </summary> /// <param name="amount">The amount of lines to move the cursor</param> /// <returns>This cursor object.</returns> public Cursor Up(int amount) { int newY = _position.Y - amount; if (newY < 0) { newY = 0; } Position = new Point(_position.X, newY); return(this); }
/// <summary> /// Moves the cusor down by the specified amount of lines. /// </summary> /// <param name="amount">The amount of lines to move the cursor</param> /// <returns>This cursor object.</returns> public Cursor Down(int amount) { int newY = _position.Y + amount; if (newY >= ((SurfaceEditor)_console.Target).TextSurface.Height) { newY = ((SurfaceEditor)_console.Target).TextSurface.Height - 1; } Position = new Point(_position.X, newY); return(this); }
/// <summary> /// Moves the cusor left by the specified amount of columns. /// </summary> /// <param name="amount">The amount of columns to move the cursor</param> /// <returns>This cursor object.</returns> public Cursor Left(int amount) { int newX = _position.X - amount; if (newX < 0) { newX = 0; } Position = new Point(newX, _position.Y); return(this); }
/// <summary> /// Moves the cusor right by the specified amount of columns. /// </summary> /// <param name="amount">The amount of columns to move the cursor</param> /// <returns>This cursor object.</returns> public Cursor Right(int amount) { int newX = _position.X + amount; if (newX >= ((SurfaceEditor)_console.Target).TextSurface.Width) { newX = ((SurfaceEditor)_console.Target).TextSurface.Width - 1; } Position = new Point(newX, _position.Y); return(this); }
public bool HandlerMouse(IConsole console, MouseInfo info) { if (console.IsVisible && console.CanUseMouse) { info.Fill(console); bool doDrag = (info.LeftButtonDown && CanMoveWithLeftButton) || (info.RightButtonDown && CanMoveWithRightButton); if (info.Console == console && doDrag) { // Mouse just went down on us. if (!_mouseDown) { _mouseDown = true; _mouseLastLocation = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); console.ExclusiveFocus = true; } else { // Mouse has been down, still is Point currentLocation = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); if (currentLocation != _mouseLastLocation) { Rectangle viewport = console.TextSurface.RenderArea; #if SFML viewport.Left += _mouseLastLocation.X - currentLocation.X; viewport.Top += _mouseLastLocation.Y - currentLocation.Y; #elif MONOGAME viewport.X += _mouseLastLocation.X - currentLocation.X; viewport.Y += _mouseLastLocation.Y - currentLocation.Y; #endif _mouseLastLocation = currentLocation; console.TextSurface.RenderArea = viewport; } } return(true); } if (!doDrag && _mouseDown) { console.ExclusiveFocus = false; _mouseDown = false; } } return(false); }
public DrawCallTexture(Texture texture, SFML.System.Vector2i position, Color?tint = null) { Texture = texture; Position = position; if (tint.HasValue) { Tint = tint.Value; } else { Tint = Color.White; } }
public void Update(SFML.System.Vector2i plpoz) { this.plpoz_chunks = plpoz; for (int x = (plpoz_chunks.X - 1 - 5 / 2) > 0 ? (plpoz_chunks.X - 1 - 5 / 2) : 0; x < ((plpoz_chunks.X + 2 + 5 / 2) < world_size_X ? (plpoz_chunks.X + 2 + 5 / 2) : world_size_X); x++) { for (int y = (plpoz_chunks.Y - 1 - 5 / 2) > 0 ? (plpoz_chunks.Y - 1 - 5 / 2) : 0; y < ((plpoz_chunks.Y + 3 + 5 / 2) < world_size_Y ? (plpoz_chunks.Y + 3 + 5 / 2) : world_size_Y); y++) { if (chunks[y][x] != null) { chunks[y][x].Update(); } } } }
public override bool ProcessKeyboard(SadConsole.Input.KeyboardInfo info) { // Forward the keyboard data to the entity to handle the movement code. // We could detect if the users hit ESC and popup a menu or something. // By not setting the entity as the active object, twe let this // "game level" (the console we're hosting the entity on) determine if // the keyboard data should be sent to the entity. // Process logic for moving the entity. bool keyHit = false; if (info.IsKeyReleased(Keys.Up)) { player.Position = new Point(player.Position.X, player.Position.Y - 1); keyHit = true; } else if (info.IsKeyReleased(Keys.Down)) { player.Position = new Point(player.Position.X, player.Position.Y + 1); keyHit = true; } if (info.IsKeyReleased(Keys.Left)) { player.Position = new Point(player.Position.X - 1, player.Position.Y); keyHit = true; } else if (info.IsKeyReleased(Keys.Right)) { player.Position = new Point(player.Position.X + 1, player.Position.Y); keyHit = true; } if (keyHit) { // Entity moved. Let's draw a trail of where they moved from. // We are not detecting when the player tries to move off the console area. // We could detected that though and then move the player back to where they were. SetGlyph(playerPreviousPosition.X, playerPreviousPosition.Y, 250); playerPreviousPosition = player.Position; return(true); } // You could have multiple entities in the game for example, and change // which entity gets keyboard commands. return(false); }
/// <summary> /// Resets all of the rects of the animation based on <see cref="UsePixelPositioning"/> and if <see cref="RepositionRects"/> is true. /// </summary> /// <param name="position">The position of the game object.</param> /// <param name="force">When true, always repositions rects.</param> protected void UpdateRects(Point position, bool force = false) { if (repositionRects || force) { var width = Animation.Width; var height = Animation.Height; var font = Animation.Font; Point offset; var rects = new Rectangle[width * height]; if (repositionRects && usePixelPositioning) { offset = position + renderOffset - new Point(animation.Center.X * font.Size.X, animation.Center.Y * font.Size.Y); } else if (repositionRects) { offset = position + renderOffset - animation.Center; offset = new Point(offset.X * font.Size.X, offset.Y * font.Size.Y); } else { offset = new Point(); } #if SFML animation.AbsoluteArea = new Rectangle(offset.X, offset.Y, (width * font.Size.X) + offset.X, (height * font.Size.Y) + offset.Y); #elif MONOGAME animation.AbsoluteArea = new Rectangle(offset.X, offset.Y, width * font.Size.X, height * font.Size.Y); #endif int index = 0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { #if SFML rects[index] = new Rectangle(x * font.Size.X + offset.X, y * font.Size.Y + offset.Y, font.Size.X + (x * font.Size.X + offset.X), font.Size.Y + (y * font.Size.Y + offset.Y)); #elif MONOGAME rects[index] = new Rectangle(x * font.Size.X + offset.X, y * font.Size.Y + offset.Y, font.Size.X, font.Size.Y); #endif index++; } } animation.RenderRects = rects; } }
/// <summary> /// Moves the cusor left by the specified amount of columns, wrapping the cursor if needed. /// </summary> /// <param name="amount">The amount of columns to move the cursor</param> /// <returns>This cursor object.</returns> public Cursor LeftWrap(int amount) { var console = ((SurfaceEditor)_console.Target); int index = TextSurface.GetIndexFromPoint(this._position, console.TextSurface.Width) - amount; if (index < 0) { index = 0; } this._position = TextSurface.GetPointFromIndex(index, console.TextSurface.Width); return(this); }
/// <summary> /// Moves the cusor right by the specified amount of columns, wrapping the cursor if needed. /// </summary> /// <param name="amount">The amount of columns to move the cursor</param> /// <returns>This cursor object.</returns> public Cursor RightWrap(int amount) { var console = ((SurfaceEditor)_console.Target); int index = TextSurface.GetIndexFromPoint(this._position, console.TextSurface.Width) + amount; if (index > console.TextSurface.Cells.Length) { index = console.TextSurface.Cells.Length - 1; } this._position = TextSurface.GetPointFromIndex(index, console.TextSurface.Width); return(this); }
public Chunk(Random rnd, World world, SFML.System.Vector2i chunk_poz) { this.chunk_poz = chunk_poz; this.world = world; this.rnd = rnd; Tiles = new Tile[chunk_size][]; for (int y = 0; y < chunk_size; y++) { Tiles[y] = new Tile[chunk_size]; for (int x = 0; x < chunk_size; x++) { SetTile(TileType.AIR, y, x); } } }
private void Initialize(FontMaster masterFont, FontSizes fontMultiple) { FontImage = masterFont.Image; MaxGlyphIndex = masterFont.Rows * masterFont.Columns - 1; switch (fontMultiple) { case FontSizes.Quarter: Size = new Point((int)(masterFont.GlyphWidth * 0.25), (int)(masterFont.GlyphHeight * 0.25)); break; case FontSizes.Half: Size = new Point((int)(masterFont.GlyphWidth * 0.5), (int)(masterFont.GlyphHeight * 0.5)); break; case FontSizes.One: Size = new Point(masterFont.GlyphWidth, masterFont.GlyphHeight); break; case FontSizes.Two: Size = new Point(masterFont.GlyphWidth * 2, masterFont.GlyphHeight * 2); break; case FontSizes.Three: Size = new Point(masterFont.GlyphWidth * 3, masterFont.GlyphHeight * 3); break; case FontSizes.Four: Size = new Point(masterFont.GlyphWidth * 4, masterFont.GlyphHeight * 4); break; default: break; } if (Size.X == 0 || Size.Y == 0) { throw new ArgumentException($"This font cannot use size {fontMultiple.ToString()}, at least one axis is 0.", "fontMultiple"); } SizeMultiple = fontMultiple; Name = masterFont.Name; GlyphIndexRects = masterFont.GlyphIndexRects; SolidGlyphIndex = masterFont.SolidGlyphIndex; Rows = masterFont.Rows; Columns = masterFont.Columns; }
public override void HandleEvents() { precisionClock.Stop(); int deltaMs = (int)precisionClock.ElapsedMilliseconds; precisionClock.Reset(); precisionClock.Start(); Array.Copy(currKeyStates, prevKeyStates, currKeyStates.Length); for (int i = 0; i < currKeyStates.Length; i++) { if (i < (int)Keyboard.Key.KeyCount) { currKeyStates[i] = Keyboard.IsKeyPressed((Keyboard.Key)i); } else if (i == (int)Keyboard.Key.KeyCount) { continue; } else { int mIdx = i - (int)Keyboard.Key.KeyCount; currKeyStates[i] = Mouse.IsButtonPressed((Mouse.Button)mIdx); } Keyboard.Key sfKey = (Keyboard.Key)i; if (currKeyStates[i]) { if (!heldTimes.ContainsKey(sfKey)) { heldTimes.Add(sfKey, 0); } heldTimes[sfKey] += deltaMs; } else if (heldTimes.ContainsKey(sfKey)) { heldTimes.Remove(sfKey); } } SFML.System.Vector2i mpos = Mouse.GetPosition(); axis[0] = new Vector2f(mpos.X, mpos.Y); axis[1] = Vector2f.Zero; axis[2] = Vector2f.Zero; }
public GameObjectConsole() : base(80, 25) { var animation = new AnimatedTextSurface("default", 1, 1, SadConsole.Engine.DefaultFont); var frame = animation.CreateFrame(); frame.Cells[0].GlyphIndex = 1; player = new SadConsole.Game.GameObject(SadConsole.Engine.DefaultFont); player.Animation = animation; player.RepositionRects = true; player.Position = new Point(textSurface.Width / 2, textSurface.Height / 2); playerPreviousPosition = player.Position; // Setup this console to accept keyboard input. CanUseKeyboard = true; IsVisible = false; }
//************************************************************************************************************************** /* void chunks_generator(int y, int x) * { * ///////генератор чанков * if (x >= 0 && x < world_size_X && y >= 0 && y < world_size_Y) { * SetChunk(y, x); * * if (y == 8) * { * for (int cx = x * Chunk.chunk_size; cx < (x + 1) * Chunk.chunk_size; cx++) * { * * for (int cy = y * Chunk.chunk_size; cy < Chunk.chunk_size + y * Chunk.chunk_size; cy++) * SetTile_world(rnd.Next(0, 10) == 0 ? TileType.LEAF : TileType.AIR, cy, cx); * } * } * else if (y == 9) * { * for (int cx = x * Chunk.chunk_size; cx < (x + 1) * Chunk.chunk_size; cx++) * { * * for (int cy = y * Chunk.chunk_size; cy < Chunk.chunk_size + y * Chunk.chunk_size; cy++) * SetTile_world(rnd.Next(0, 10) == 0 ? TileType.WOOD : TileType.AIR, cy, cx); * } * } * else if (y == 10) * { * for (int cx = x * Chunk.chunk_size; cx < (x + 1) * Chunk.chunk_size; cx++) * { * * int a = rnd.Next(-2, 2); * * SetTile_world(TileType.GRASS, y * Chunk.chunk_size + a, cx); * * for (int cy = y * Chunk.chunk_size + a +1; cy < Chunk.chunk_size + y * Chunk.chunk_size; cy++) * { * SetTile_world(TileType.DIRT, cy, cx); * } * } * } * else if (y == 11) * { * for (int cx = x * Chunk.chunk_size; cx < (x + 1) * Chunk.chunk_size; cx++) * { * * for (int cy = y * Chunk.chunk_size; cy < Chunk.chunk_size + y * Chunk.chunk_size; cy++) * SetTile_world(rnd.Next(0,10)==0?TileType.DIRT:TileType.STOUN, cy, cx); * } * } * else if (y == 12) * { * for (int cx = x * Chunk.chunk_size; cx < (x + 1) * Chunk.chunk_size; cx++) * { * * for (int cy = y * Chunk.chunk_size; cy < Chunk.chunk_size + y * Chunk.chunk_size; cy++) * SetTile_world(rnd.Next(0, 10) == 0 ? TileType.COAL : TileType.STOUN, cy, cx); * } * } * else if (y == 13) * { * for (int cx = x * Chunk.chunk_size; cx < (x + 1) * Chunk.chunk_size; cx++) * { * * for (int cy = y * Chunk.chunk_size; cy < Chunk.chunk_size + y * Chunk.chunk_size; cy++) * SetTile_world(rnd.Next(0, 10) == 0 ? TileType.IRON : TileType.STOUN, cy, cx); * } * } * else if (y == 14) * { * for (int cx = x * Chunk.chunk_size; cx < (x + 1) * Chunk.chunk_size; cx++) * { * * for (int cy = y * Chunk.chunk_size; cy < Chunk.chunk_size + y * Chunk.chunk_size; cy++) * SetTile_world(rnd.Next(0, 10) == 0 ? TileType.GOLD : TileType.STOUN, cy, cx); * } * } * else if (y == 15) * { * for (int cx = x * Chunk.chunk_size; cx < (x + 1) * Chunk.chunk_size; cx++) * { * * for (int cy = y * Chunk.chunk_size; cy < Chunk.chunk_size + y * Chunk.chunk_size; cy++) * SetTile_world(rnd.Next(0, 10) == 0 ? TileType.DIAMONT : TileType.STOUN, cy, cx); * } * } * else if (y > 15) * { * for (int cx = x * Chunk.chunk_size; cx < (x + 1) * Chunk.chunk_size; cx++) * { * * for (int cy = y * Chunk.chunk_size; cy < Chunk.chunk_size + y * Chunk.chunk_size; cy++) * SetTile_world(TileType.STOUN, cy, cx); * } * } * } * }*/ public void Draw(RenderTarget target, RenderStates states) { states.Transform *= Transform; SFML.System.Vector2i view_size_chuncs = new SFML.System.Vector2i((int)Core.game_view.Size.X / Tile.tile_size / Chunk.chunk_size, (int)Core.game_view.Size.Y / Tile.tile_size / Chunk.chunk_size); for (int x = (plpoz_chunks.X - 1 - view_size_chuncs.X / 2) > 0 ? (plpoz_chunks.X - 1 - view_size_chuncs.X / 2) : 0; x < ((plpoz_chunks.X + 2 + view_size_chuncs.X / 2) < world_size_X ? (plpoz_chunks.X + 2 + view_size_chuncs.X / 2) : world_size_X); x++) { for (int y = (plpoz_chunks.Y - 1 - view_size_chuncs.Y / 2) > 0 ? (plpoz_chunks.Y - 1 - view_size_chuncs.Y / 2) : 0; y < ((plpoz_chunks.Y + 3 + view_size_chuncs.Y / 2) < world_size_Y ? (plpoz_chunks.Y + 3 + view_size_chuncs.Y / 2) : world_size_Y); y++) { if (chunks[y][x] == null) { chunks_generator(y, x); } target.Draw(chunks[y][x], states); } } }
public Box(int sidesCharacter, int topBottomCharacter, int topLeftCharacter, int topRightCharacter, int bottomRightCharacter, int bottomLeftCharacter, int width, int height, Color foreground, Color background, bool fill, Color fillColor) { TopLeftCharacter = topLeftCharacter; TopRightCharacter = topRightCharacter; BottomRightCharacter = bottomRightCharacter; BottomLeftCharacter = bottomLeftCharacter; LeftSideCharacter = sidesCharacter; RightSideCharacter = sidesCharacter; TopSideCharacter = topBottomCharacter; BottomSideCharacter = topBottomCharacter; Foreground = Color.White; BorderBackground = Color.Transparent; Width = width; Height = height; Location = new Point(0, 0); Fill = fill; FillColor = fillColor; DrawTransparency = false; }