Exemplo n.º 1
0
 public Line(Vec2 startPos, Vec2 endPos, Brush colour, float thickness)
 {
     Position = startPos;
     _endpoint = endPos;
     Colour = colour;
     _thickness = thickness;
 }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
        /// <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);
        }
Exemplo n.º 7
0
 /// <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));
 }
Exemplo n.º 8
0
 /// <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 });
 }
Exemplo n.º 9
0
 public void AddText(string id, string text, Vec2 pos, Brush col)
 {
     Renderables.Add(new PrintText(text, pos, col) { Id = id } );
 }
Exemplo n.º 10
0
 public PrintText PlotLocation(Vec2 location, Color col)
 {
     return new PrintText(Globals.TurnCount.ToString(), location, new SolidBrush(col));
 }
Exemplo n.º 11
0
        public override SimFrame Init(Vec2 rez)
        {
            State = SimulatorStateEnum.Initialised;

            return new SimFrame();
        }
Exemplo n.º 12
0
 /// <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);
Exemplo n.º 13
0
 /// <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);
Exemplo n.º 14
0
 public abstract void AddText(string text, Vec2 pos, Brush col, int size);