Ejemplo n.º 1
0
        public override void OnDraw(RendererBase rendererToDrawWith)
        {
            ImageSequence menuBackground = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "MainMenuBackground");

            rendererToDrawWith.Render(menuBackground.GetImageByIndex(0), 0, 0);

            ImageSequence planetOnMenu = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "PlanetOnMenu");

            rendererToDrawWith.Render(planetOnMenu.GetImageByRatio(planetRatio.Read()), 620, 360);

            base.OnDraw(rendererToDrawWith);
        }
Ejemplo n.º 2
0
        protected override void DoDraw(RendererBase destRenderer)
        {
            int         playerSequenceIndex = GetPlayerIndex();
            ImageBuffer playerImage         = ((ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "Players")).GetImageByIndex(playerSequenceIndex);

            destRenderer.Render(playerImage, m_Position.x, m_Position.y);
        }
Ejemplo n.º 3
0
 public override void Render(Canvas2D canvas, RendererBase renderer)
 {
     if (BonusAnimation != null)
     {
         renderer.Render(canvas, this);
     }
 }
Ejemplo n.º 4
0
 public override void Render(Canvas2D canvas, RendererBase renderer)
 {
     if (Sprite != null)
     {
         renderer.Render(canvas, this);
     }
 }
Ejemplo n.º 5
0
        public override void OnDraw(RendererBase rendererToDrawWith)
        {
            ImageSequence menuBackground = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "CreditsScreen");
            rendererToDrawWith.Render(menuBackground.GetImageByIndex(0), 0, 0);

            base.OnDraw(rendererToDrawWith);
        }
Ejemplo n.º 6
0
        public override void OnDraw(RendererBase rendererToDrawWith)
        {
            ImageSequence menuBackground = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "CreditsScreen");

            rendererToDrawWith.Render(menuBackground.GetImageByIndex(0), 0, 0);

            base.OnDraw(rendererToDrawWith);
        }
        /// <summary>
        /// Bake light textures from provided lighting rig
        /// </summary>
        /// <param name="lightingRigPrefab"></param>
        public void BuildRig(LightingRig lightingRigPrefab)
        {
            if (lightingRigPrefab == null)
            {
                Debug.LogError("LightingRigPrefab not provided");
            }

            _rendererIBL.Render(_matCapSnapshot, lightingRigPrefab, _cameraRef);
        }
Ejemplo n.º 8
0
        public override void OnDraw()
        {
            RendererBase <T> rendererForSurfaceThisIsOn = Parrent.GetRenderer();

            for (uint i = 0; i < num_paths(); i++)
            {
                rendererForSurfaceThisIsOn.Render(this, i, color(i).GetAsRGBA_Bytes());
            }
            base.OnDraw();
        }
Ejemplo n.º 9
0
        protected override void DoDraw(RendererBase <T> destRenderer)
        {
            IAffineTransformMatrix <T> Final = MatrixFactory <T> .NewIdentity(VectorDimension.Two);

            Final.RotateAlong(MatrixFactory <T> .CreateVector2D(0, 0), m_Rotation.ToDouble());
            Final.Translate(m_Position);
            ConvTransform <T> TransformedShip = new ConvTransform <T>(m_PlayerToDraw, Final);

            destRenderer.Render(TransformedShip, new RGBA_Bytes(.9, .4, .2, 1));
        }
Ejemplo n.º 10
0
        void Triangle(Tesselate_Tests.Vertex Vertex1, Tesselate_Tests.Vertex Vertex2, Tesselate_Tests.Vertex Vertex3,
                      RendererBase renderer)
        {
            PathStorage triangle = new PathStorage();

            triangle.move_to(Vertex1.m_X * m_Scale + m_XOffset, Vertex1.m_Y * m_Scale + m_YOffset);
            triangle.line_to(Vertex2.m_X * m_Scale + m_XOffset, Vertex2.m_Y * m_Scale + m_YOffset);
            triangle.line_to(Vertex3.m_X * m_Scale + m_XOffset, Vertex3.m_Y * m_Scale + m_YOffset);

            renderer.Render(triangle, m_TriangleColor.GetAsRGBA_Bytes());
        }
Ejemplo n.º 11
0
        void Line(Tesselate_Tests.Vertex Vertex1, Tesselate_Tests.Vertex Vertex2, double lineWidth, RendererBase renderer, bool ArrowTip)
        {
            PathStorage line = new PathStorage();

            line.move_to(Vertex1.m_X * m_Scale + m_XOffset, Vertex1.m_Y * m_Scale + m_YOffset);
            line.line_to(Vertex2.m_X * m_Scale + m_XOffset, Vertex2.m_Y * m_Scale + m_YOffset);

            // Drawing as an outline
            conv_stroke wideLine = new conv_stroke(line);

            wideLine.width(lineWidth);

            renderer.Render(wideLine, m_LineColor.GetAsRGBA_Bytes());

            if (ArrowTip)
            {
                Ellipse Dot = new Ellipse(
                    (Vertex2.m_X * m_Scale * 9 + Vertex1.m_X * m_Scale) / 10 + m_XOffset,
                    (Vertex2.m_Y * m_Scale * 9 + Vertex1.m_Y * m_Scale) / 10 + m_YOffset, 3, 3);
                GetRenderer().Render(Dot, m_LineColor.GetAsRGBA_Bytes());
            }
        }
Ejemplo n.º 12
0
        public void DrawScore(RendererBase destRenderer)
        {
            int           playerSequenceIndex = GetPlayerIndex();
            ImageSequence scoreSequence       = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "ScoreNumbers");
            string        score = m_Score.ToString();
            int           x     = 43;
            int           y     = 577;

            switch (playerSequenceIndex)
            {
            case 0:
                break;

            case 1:
                x = 700;
                break;

            case 2:
                x = 45;
                y = 5;
                break;

            case 3:
                x = 700;
                y = 5;
                break;

            default:
                break;
            }

            for (int i = 0; i < score.Length; i++)
            {
                int         digit       = (int)(score[i] - '0');
                ImageBuffer numberImage = scoreSequence.GetImageByIndex(digit);
                destRenderer.Render(numberImage, x, y);
                x += numberImage.Width();
            }
        }
Ejemplo n.º 13
0
 public override void Render(Canvas2D canvas, RendererBase renderer)
 {
     renderer.Render(canvas, this);
 }
Ejemplo n.º 14
0
 protected override void DoDraw(RendererBase destRenderer)
 {
     ImageBuffer shieldImage = ((ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "Shield")).GetImageByIndex(0);
     destRenderer.Render(shieldImage, m_Position.x, m_Position.y);
 }
Ejemplo n.º 15
0
        public override void OnDraw(RendererBase rendererToDrawWith)
        {
            ImageSequence menuBackground = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "MainMenuBackground");
            rendererToDrawWith.Render(menuBackground.GetImageByIndex(0), 0, 0);

            ImageSequence planetOnMenu = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "PlanetOnMenu");
            rendererToDrawWith.Render(planetOnMenu.GetImageByRatio(planetRatio.Read()), 620, 360);

            base.OnDraw(rendererToDrawWith);
        }
Ejemplo n.º 16
0
        void Triangle(Tesselate_Tests.Vertex Vertex1, Tesselate_Tests.Vertex Vertex2, Tesselate_Tests.Vertex Vertex3,
            RendererBase renderer)
        {
            PathStorage triangle = new PathStorage();
            triangle.move_to(Vertex1.m_X * m_Scale + m_XOffset, Vertex1.m_Y * m_Scale + m_YOffset);
            triangle.line_to(Vertex2.m_X * m_Scale + m_XOffset, Vertex2.m_Y * m_Scale + m_YOffset);
            triangle.line_to(Vertex3.m_X * m_Scale + m_XOffset, Vertex3.m_Y * m_Scale + m_YOffset);

            renderer.Render(triangle, m_TriangleColor.GetAsRGBA_Bytes());
        }
Ejemplo n.º 17
0
        protected override void DoDraw(RendererBase destRenderer)
        {
            ImageBuffer shieldImage = ((ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "Shield")).GetImageByIndex(0);

            destRenderer.Render(shieldImage, m_Position.x, m_Position.y);
        }
Ejemplo n.º 18
0
        public override void OnDraw(RendererBase rendererToDrawWith)
        {
            ImageBuffer levelMap = playfield.LevelMap;
            int offset;
            byte[] buffer = levelMap.GetBuffer(out offset);

            if (!haveDrawnWalls)
            {
                RendererBase backgroundRenderer = BackgroundImage.NewRenderer();
                rect_i boundsI = BackgroundImage.GetBoundingRect();
                rect_d bounds = new rect_d(boundsI.Left, boundsI.Bottom, boundsI.Right, boundsI.Top);
                backgroundRenderer.SetClippingRect(bounds);
                ImageSequence wallTileSequence = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "WallTile");
                for (int y = 0; y < levelMap.Height(); y++)
                {
                    for (int x = 0; x < levelMap.Width(); x++)
                    {
                        if (buffer[levelMap.GetBufferOffsetXY(x, y)] == 0)
                        {
                            int index = 0;
                            // what type of wall
                            if (x < levelMap.Width() -1 
                                && buffer[levelMap.GetBufferOffsetXY(x + 1, y + 0)] == 0)
                            {
                                index |= 8;
                            }

                            if (y < levelMap.Height() -1 
                                && buffer[levelMap.GetBufferOffsetXY(x + 0, y + 1)] == 0)
                            {
                                index |= 4;
                            }

                            if (x > 0
                                && buffer[levelMap.GetBufferOffsetXY(x - 1, y + 0)] == 0)
                            {
                                index |= 2;
                            }

                            if (y > 0
                                && buffer[levelMap.GetBufferOffsetXY(x + 0, y - 1)] == 0)
                            {
                                index |= 1;
                            }

                            backgroundRenderer.Render(wallTileSequence.GetImageByIndex(index), x * 16, y * 16);
                        }
                    }
                }
                haveDrawnWalls = true;
            }

            //for (int i = 0; i < 1; i++)
            for (int i = 0; i < numPlayers; i++)
            {
                playerViews[i].SetRendererPreDraw(BackgroundImage, rendererToDrawWith, playfield.PlayerList[i]);

                rendererToDrawWith.Render(BackgroundImage, 0, 0);

                foreach (SequenceEntity aSequenceEntity in playfield.SequenceEntityList)
                {
                    aSequenceEntity.Draw(rendererToDrawWith);
                }

                foreach (Player aPlayer in playfield.PlayerList)
                {
                    aPlayer.Draw(rendererToDrawWith);
                }

                playfield.sword.Draw(rendererToDrawWith);
                playfield.key.Draw(rendererToDrawWith);
                playfield.shield.Draw(rendererToDrawWith);

                playerViews[i].SetRendererPostDraw(rendererToDrawWith);
            }

            ImageSequence hud = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), (playfield.PlayerList.Count).ToString() + "PlayerHUD");
            rendererToDrawWith.Render(hud.GetImageByIndex(0), 400, 300);

            foreach (Player aPlayer in playfield.PlayerList)
            {
                aPlayer.DrawScore(rendererToDrawWith);
            }

            rendererToDrawWith.Line(0.5, 300.5, 800.5, 300.5, new RGBA_Bytes(255, 20, 20));
            rendererToDrawWith.Line(400.5, 0.5, 400.5, 600.5, new RGBA_Bytes(255, 20, 20));

            base.OnDraw(rendererToDrawWith);
        }
Ejemplo n.º 19
0
        public void Draw(IAffineTransformMatrix <T> Position, RendererBase <T> renderer)
        {
            T TextHeight = m_Position[1].Subtract(20);
            T Range      = (m_DataViewMaxY.Subtract(m_DataViewMinY));
            ConvTransform <T> TransformedLinesToDraw;
            ConvStroke <T>    StrockedTransformedLinesToDraw;

            RoundedRect <T>   BackGround            = new RoundedRect <T>(m_Position[0], m_Position[1].Subtract(1), m_Position[0].Add(m_Width), m_Position[1].Subtract(1).Add(m_Height).Add(2), M.New <T>(5));
            ConvTransform <T> TransformedBackGround = new ConvTransform <T>(BackGround, Position);

            renderer.Render(TransformedBackGround, new RGBA_Bytes(0, 0, 0, .5));

            // if the 0 line is within the window than draw it.
            if (m_DataViewMinY.LessThan(0) && m_DataViewMaxY.GreaterThan(0))
            {
                m_LinesToDraw.RemoveAll();
                m_LinesToDraw.MoveTo(m_Position[0],
                                     m_Position[1].Add(m_DataViewMinY.Negative().Multiply(M.New <T>(m_Height).Divide(Range))));


                m_LinesToDraw.LineTo(m_Position[0].Add((double)m_Width),
                                     m_Position[1].Add(m_DataViewMinY.Negative().Multiply(M.New <T>((double)m_Height).Divide(Range))));

                TransformedLinesToDraw         = new ConvTransform <T>(m_LinesToDraw, Position);
                StrockedTransformedLinesToDraw = new ConvStroke <T>(TransformedLinesToDraw);
                renderer.Render(StrockedTransformedLinesToDraw, new RGBA_Bytes(0, 0, 0, 1));
            }

            T MaxMax     = M.New <T>(-999999999);
            T MinMin     = M.New <T>(999999999);
            T MaxAverage = M.Zero <T>();

            foreach (KeyValuePair <String, HistoryData> historyKeyValue in m_DataHistoryArray)
            {
                HistoryData history = historyKeyValue.Value;
                m_LinesToDraw.RemoveAll();
                MaxMax     = M.Max(MaxMax, history.GetMaxValue());
                MinMin     = M.Min(MinMin, history.GetMinValue());
                MaxAverage = M.Max(MaxAverage, history.GetAverageValue());
                for (int i = 0; i < m_Width - 1; i++)
                {
                    if (i == 0)
                    {
                        m_LinesToDraw.MoveTo(m_Position[0].Add(i),
                                             m_Position[1].Add(history.GetItem(i).Subtract(m_DataViewMinY).Multiply(M.New <T>(m_Height).Divide(Range))));
                    }
                    else
                    {
                        m_LinesToDraw.LineTo(m_Position[0].Add(i),
                                             m_Position[1].Add(history.GetItem(i).Subtract(m_DataViewMinY).Multiply(M.New <T>((double)m_Height).Divide(Range))));
                    }
                }

                TransformedLinesToDraw         = new ConvTransform <T>(m_LinesToDraw, Position);
                StrockedTransformedLinesToDraw = new ConvStroke <T>(TransformedLinesToDraw);
                renderer.Render(StrockedTransformedLinesToDraw, history.m_Color);

                String Text = historyKeyValue.Key + ": Min:" + MinMin.ToString("0.0") + " Max:" + MaxMax.ToString("0.0");
                renderer.DrawString(Text, m_Position[0], TextHeight.Subtract(m_Height));
                TextHeight.SubtractEquals(20);
            }

            RoundedRect <T> BackGround2 = new RoundedRect <T>(
                m_Position[0],
                m_Position[1].Subtract(1),
                m_Position[0].Add((double)m_Width),
                m_Position[1].Subtract(1 + m_Height + 2), M.New <T>(5));

            ConvTransform <T> TransformedBackGround2        = new ConvTransform <T>(BackGround2, Position);
            ConvStroke <T>    StrockedTransformedBackGround = new ConvStroke <T>(TransformedBackGround2);

            renderer.Render(StrockedTransformedBackGround, new RGBA_Bytes(0.0, 0, 0, 1));

            //renderer.Color = BoxColor;
            //renderer.DrawRect(m_Position.x, m_Position.y - 1, m_Width, m_Height + 2);
        }
Ejemplo n.º 20
0
        void Line(Tesselate_Tests.Vertex Vertex1, Tesselate_Tests.Vertex Vertex2, double lineWidth, RendererBase renderer, bool ArrowTip)
        {
            PathStorage line = new PathStorage();
            line.move_to(Vertex1.m_X * m_Scale + m_XOffset, Vertex1.m_Y * m_Scale + m_YOffset);
            line.line_to(Vertex2.m_X * m_Scale + m_XOffset, Vertex2.m_Y * m_Scale + m_YOffset);

            // Drawing as an outline
            conv_stroke wideLine = new conv_stroke(line);
            wideLine.width(lineWidth);

            renderer.Render(wideLine, m_LineColor.GetAsRGBA_Bytes());

            if(ArrowTip)
            {
                Ellipse Dot = new Ellipse(
                    (Vertex2.m_X * m_Scale * 9 + Vertex1.m_X * m_Scale) / 10 + m_XOffset,
                    (Vertex2.m_Y * m_Scale * 9 + Vertex1.m_Y * m_Scale) / 10 + m_YOffset, 3, 3);
                GetRenderer().Render(Dot, m_LineColor.GetAsRGBA_Bytes());
            }
        }
Ejemplo n.º 21
0
        public void Render(RendererBase <T> renderer)
        {
            //render the stats
            string s = "Generation:          " + m_iGenerations.ToString();

            AGG.UI.TextWidget <T> GenerationText = new AGG.UI.TextWidget <T>(s, M.New <T>(150), M.New <T>(10), M.New <T>(9));
            //GenerationText.Render(renderer);

            //do not render if running at accelerated speed
            if (!m_bFastRender)
            {
                //render the mines
                for (int i = 0; i < m_vecMines.Count; ++i)
                {
                    //grab the vertices for the mine shape
                    List <IVector <T> > mineVB = new List <IVector <T> >();
                    foreach (IVector <T> vector in m_MineVB)
                    {
                        mineVB.Add(vector);
                    }

                    WorldTransform(mineVB, m_vecMines[i]);

                    //draw the mines
                    m_LinesToDraw.RemoveAll();
                    m_LinesToDraw.MoveTo(mineVB[0][0], mineVB[0][1]);
                    for (int vert = 1; vert < mineVB.Count; ++vert)
                    {
                        m_LinesToDraw.LineTo(mineVB[vert][0], mineVB[vert][1]);
                    }

                    renderer.Render(m_LinesToDraw, m_BlackPen);
                }

                RGBA_Bytes currentColor = m_RedPen;
                //render the sweepers
                for (int i = 0; i < m_vecSweepers.Count; i++)
                {
                    //grab the sweeper vertices
                    List <IVector <T> > sweeperVB = new List <IVector <T> >();
                    foreach (IVector <T> vector in m_SweeperVB)
                    {
                        sweeperVB.Add(vector);
                    }

                    //Transform the vertex buffer
                    m_vecSweepers[i].WorldTransform(sweeperVB);

                    //draw the sweeper left track
                    m_LinesToDraw.RemoveAll();
                    m_LinesToDraw.MoveTo(sweeperVB[0][0], sweeperVB[0][1]);
                    for (int vert = 1; vert < 4; ++vert)
                    {
                        m_LinesToDraw.LineTo(sweeperVB[vert][0], sweeperVB[vert][1]);
                    }

                    if (i == m_pGA.NumElite)
                    {
                        currentColor = m_BlackPen;
                    }

                    renderer.Render(m_LinesToDraw, currentColor);

                    //draw the sweeper right track
                    m_LinesToDraw.RemoveAll();
                    m_LinesToDraw.MoveTo(sweeperVB[4][0], sweeperVB[4][1]);
                    for (int vert = 5; vert < 8; ++vert)
                    {
                        m_LinesToDraw.LineTo(sweeperVB[vert][0], sweeperVB[vert][1]);
                    }
                    renderer.Render(m_LinesToDraw, currentColor);

                    // draw the body
                    m_LinesToDraw.RemoveAll();
                    m_LinesToDraw.MoveTo(sweeperVB[8][0], sweeperVB[8][1]);
                    m_LinesToDraw.LineTo(sweeperVB[9][0], sweeperVB[9][1]);
                    m_LinesToDraw.MoveTo(sweeperVB[10][0], sweeperVB[10][1]);
                    for (int vert = 11; vert < 16; ++vert)
                    {
                        m_LinesToDraw.LineTo(sweeperVB[vert][0], sweeperVB[vert][1]);
                    }
                    renderer.Render(m_LinesToDraw, currentColor);
                }
            }
            else
            {
                PlotStats(renderer);
            }
        }
Ejemplo n.º 22
0
        public void DrawScore(RendererBase destRenderer)
        {
            int playerSequenceIndex = GetPlayerIndex();
            ImageSequence scoreSequence = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "ScoreNumbers");
            string score = m_Score.ToString();
            int x = 43;
            int y = 577;
            switch (playerSequenceIndex)
            {
                case 0:
                    break;

                case 1:
                    x = 700;
                    break;

                case 2:
                    x = 45;
                    y = 5;
                    break;

                case 3:
                    x = 700;
                    y = 5;
                    break;

                default:
                    break;
            }

            for (int i = 0; i < score.Length; i++)
            {
                int digit = (int)(score[i] - '0');
                ImageBuffer numberImage = scoreSequence.GetImageByIndex(digit);
                destRenderer.Render(numberImage, x, y);
                x += numberImage.Width();
            }
        }
Ejemplo n.º 23
0
        public override void OnDraw(RendererBase rendererToDrawWith)
        {
            ImageBuffer levelMap = playfield.LevelMap;
            int         offset;

            byte[] buffer = levelMap.GetBuffer(out offset);

            if (!haveDrawnWalls)
            {
                RendererBase backgroundRenderer = BackgroundImage.NewRenderer();
                rect_i       boundsI            = BackgroundImage.GetBoundingRect();
                rect_d       bounds             = new rect_d(boundsI.Left, boundsI.Bottom, boundsI.Right, boundsI.Top);
                backgroundRenderer.SetClippingRect(bounds);
                ImageSequence wallTileSequence = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "WallTile");
                for (int y = 0; y < levelMap.Height(); y++)
                {
                    for (int x = 0; x < levelMap.Width(); x++)
                    {
                        if (buffer[levelMap.GetBufferOffsetXY(x, y)] == 0)
                        {
                            int index = 0;
                            // what type of wall
                            if (x < levelMap.Width() - 1 &&
                                buffer[levelMap.GetBufferOffsetXY(x + 1, y + 0)] == 0)
                            {
                                index |= 8;
                            }

                            if (y < levelMap.Height() - 1 &&
                                buffer[levelMap.GetBufferOffsetXY(x + 0, y + 1)] == 0)
                            {
                                index |= 4;
                            }

                            if (x > 0 &&
                                buffer[levelMap.GetBufferOffsetXY(x - 1, y + 0)] == 0)
                            {
                                index |= 2;
                            }

                            if (y > 0 &&
                                buffer[levelMap.GetBufferOffsetXY(x + 0, y - 1)] == 0)
                            {
                                index |= 1;
                            }

                            backgroundRenderer.Render(wallTileSequence.GetImageByIndex(index), x * 16, y * 16);
                        }
                    }
                }
                haveDrawnWalls = true;
            }

            //for (int i = 0; i < 1; i++)
            for (int i = 0; i < numPlayers; i++)
            {
                playerViews[i].SetRendererPreDraw(BackgroundImage, rendererToDrawWith, playfield.PlayerList[i]);

                rendererToDrawWith.Render(BackgroundImage, 0, 0);

                foreach (SequenceEntity aSequenceEntity in playfield.SequenceEntityList)
                {
                    aSequenceEntity.Draw(rendererToDrawWith);
                }

                foreach (Player aPlayer in playfield.PlayerList)
                {
                    aPlayer.Draw(rendererToDrawWith);
                }

                playfield.sword.Draw(rendererToDrawWith);
                playfield.key.Draw(rendererToDrawWith);
                playfield.shield.Draw(rendererToDrawWith);

                playerViews[i].SetRendererPostDraw(rendererToDrawWith);
            }

            ImageSequence hud = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), (playfield.PlayerList.Count).ToString() + "PlayerHUD");

            rendererToDrawWith.Render(hud.GetImageByIndex(0), 400, 300);

            foreach (Player aPlayer in playfield.PlayerList)
            {
                aPlayer.DrawScore(rendererToDrawWith);
            }

            rendererToDrawWith.Line(0.5, 300.5, 800.5, 300.5, new RGBA_Bytes(255, 20, 20));
            rendererToDrawWith.Line(400.5, 0.5, 400.5, 600.5, new RGBA_Bytes(255, 20, 20));

            base.OnDraw(rendererToDrawWith);
        }
Ejemplo n.º 24
0
 protected override void DoDraw(RendererBase <T> destRenderer)
 {
     m_RockToDraw.X = m_Position[0];
     m_RockToDraw.Y = m_Position[1];
     destRenderer.Render(m_RockToDraw, new RGBA_Bytes(.9, .4, .2, 1));
 }
Ejemplo n.º 25
0
        //this function plots a graph of the average and best fitnesses
        //over the course of a run
        void PlotStats(RendererBase <T> renderer)
        {
            if (m_vecBestFitness.Count == 0)
            {
                return;
            }
            string         s        = "Best Fitness:       " + m_pGA.BestFitness.ToString();
            TextWidget <T> InfoText = new TextWidget <T>(s, M.New <T>(5), M.New <T>(30), M.New <T>(9));

            //InfoText.Render(renderer);

            s        = "Average Fitness: " + m_pGA.AverageFitness.ToString();
            InfoText = new TextWidget <T>(s, M.New <T>(5), M.New <T>(45), M.New <T>(9));
            //InfoText.Render(renderer);

            //render the graph
            T HSlice = M.New <T>((double)cxClient / (m_iGenerations + 1));
            T VSlice = M.New <T>((double)(cyClient / ((m_BestFitnessYet + 1) * 2)));

            bool foundNewBest = false;

            if (m_vecBestFitness[m_vecBestFitness.Count - 1] > m_BestFitnessYet ||
                m_BestLinesToDraw == null ||
                LastFitnessCount != m_vecBestFitness.Count)
            {
                LastFitnessCount = m_vecBestFitness.Count;
                m_BestFitnessYet = m_vecBestFitness[m_vecBestFitness.Count - 1];

                foundNewBest = true;
            }

            if (foundNewBest)
            {
                //plot the graph for the best fitness
                T x = M.Zero <T>();
                m_BestPathToDraw.RemoveAll();
                m_BestPathToDraw.MoveTo(M.Zero <T>(), M.Zero <T>());
                for (int i = 0; i < m_vecBestFitness.Count; ++i)
                {
                    m_BestPathToDraw.LineTo(x, VSlice.Multiply(m_vecBestFitness[i]));
                    x.AddEquals(HSlice);
                }

                m_BestLinesToDraw = new ConvStroke <T>(m_BestPathToDraw);

                //plot the graph for the average fitness
                x = M.Zero <T>();

                m_AveragePathToDraw.RemoveAll();
                m_AveragePathToDraw.MoveTo(M.Zero <T>(), M.Zero <T>());
                for (int i = 0; i < m_vecAvFitness.Count; ++i)
                {
                    m_AveragePathToDraw.LineTo(x, VSlice.Multiply(m_vecAvFitness[i]));
                    x.AddEquals(HSlice);
                }

                m_AverageLinesToDraw = new ConvStroke <T>(m_AveragePathToDraw);
            }
            else
            {
                renderer.Render(m_BestLinesToDraw, m_BluePen);
                renderer.Render(m_AverageLinesToDraw, m_RedPen);
            }
        }
Ejemplo n.º 26
0
        protected override void DoDraw(RendererBase destRenderer)
		{
            int playerSequenceIndex = GetPlayerIndex();
            ImageBuffer playerImage = ((ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "Players")).GetImageByIndex(playerSequenceIndex);
            destRenderer.Render(playerImage, m_Position.x, m_Position.y);
        }