public Line(Vec2 startPos, Vec2 endPos, Brush colour, float thickness) { Position = startPos; _endpoint = endPos; Colour = colour; _thickness = thickness; }
/// <summary> /// Creates a new PrintText object /// </summary> /// <param name="text">Text to write</param> /// <param name="pos">Position of Text</param> /// <param name="col">Text Colour</param> /// <param name="size">Text Size</param> public PrintText(string text, Vec2 pos, Brush col, int size) { TextFont = new Font("Arial", size); Colour = col; Text = text; Position = pos; }
public override SimFrame DrawTurn(Vec2 scale) { Debug.Trace("Text Simulator"); SimFrame ret = new SimFrame { Error = false, ToBeDrawn = true, BackGround = Color.White }; ret.AddText(String.Format("Value of E1 E2 Union: {0}", DefuzziedValue1.ToString()), new Vec2(100, 200), new SolidBrush(Color.Black)); ret.AddText(String.Format("Value of E1 E2 Inter: {0}", DefuzziedValue2.ToString()), new Vec2(100, 230), new SolidBrush(Color.Black)); return ret; }
public override SimFrame Init(Vec2 rez) { _doubles = new double[_population]; _template = new Sprite("x") { Picture = SpriteList.SpaceShip_Explode }; for (int i = 0; i < _population; i++) { _doubles[i] = ((double) (new Random().NextDouble()*Globals.Simulator.FrameResolution.X)); } State = SimulatorStateEnum.Initialised; return new SimFrame(); }
public override SimFrame DrawTurn(Vec2 scale) { State = SimulatorStateEnum.Running; SimFrame ret = new SimFrame(); for (int i = 0; i < _population; i++) { ret.AddRenderable( new Sprite("x"+i) { Picture = _template.Picture, Position = new Vec2(_doubles[i], i * _spacing) }); } ret.ToBeDrawn = true; return ret; }
/// <summary> /// Renders the Sprite to the given Graphics Object /// </summary> /// <param name="g">Graphics object to render to</param> public override void Render(Graphics g) { Vec2 noScale = new Vec2(1, 1); //if there is any scaling to do, then scale it if (Scale.X != noScale.X || Scale.Y != noScale.Y) { //Scale.X = 0.01; test to create error if (_originalHeight.X * Scale.X < 1) return; if (_originalHeight.Y * Scale.Y < 1) return; Picture = new Bitmap(Picture, new Size((int)(_originalHeight.X * Scale.X), (int)(_originalHeight.Y * Scale.Y))); Bitmap x = new Bitmap((int)(_originalHeight.X * Scale.X), (int)(_originalHeight.Y * Scale.Y), PixelFormat.Format16bppArgb1555); } g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.DrawImage(Picture, (float)Position.X, (float)Position.Y); }
/// <summary> /// Adds a line of text to the frame /// </summary> /// <param name="text">Text to add</param> /// <param name="pos">Position of text</param> /// <param name="col">Text Colour</param> /// <param name="size">Text Size</param> public override void AddText(string text, Vec2 pos, Brush col, int size) { Renderables.Add(new PrintText(text, pos, col, size)); }
/// <summary> /// Adds Text with a shodow behind-down-right of the text location /// </summary> /// <param name="id">object ID</param> /// <param name="text">print text</param> /// <param name="pos">position</param> /// <param name="col">text colour</param> /// <param name="shadow">shadow colour</param> public void AddTextWithShadow(string id, string text, Vec2 pos, Brush col, Brush shadow) { Renderables.Add(new PrintText(text, new Vec2(pos.X + 1, pos.Y + 1), shadow) { Id = id+"_shadow" }); Renderables.Add(new PrintText(text, pos, col) { Id = id }); }
public void AddText(string id, string text, Vec2 pos, Brush col) { Renderables.Add(new PrintText(text, pos, col) { Id = id } ); }
public PrintText PlotLocation(Vec2 location, Color col) { return new PrintText(Globals.TurnCount.ToString(), location, new SolidBrush(col)); }
public override SimFrame Init(Vec2 rez) { State = SimulatorStateEnum.Initialised; return new SimFrame(); }
/// <summary> /// Method which draws a Frame of Simulation /// </summary> /// <param name="xscale">Canvas X size</param> /// <param name="yscale">Canvas Y size</param> /// <returns>Drawable SimFrame object</returns> public abstract SimFrame DrawTurn(Vec2 scale);
/// <summary> /// The initialization of the Simulator /// </summary> /// <param name="xrez">Canvas X size</param> /// <param name="yrez">Canvas Y size</param> /// <param name="dif">Difficulty of the simulator</param> /// <returns>The first frame to draw</returns> public abstract SimFrame Init(Vec2 rez);
public abstract void AddText(string text, Vec2 pos, Brush col, int size);