예제 #1
0
        public void Draw(RenderWindow rw)
        {
            rw.Clear();
            rw.Draw(_background);
            _state.Draw(rw);


            _state.DrawOverlay(rw);
            ScreenEffects.GetStaticEffect("vignette").Draw(rw);
        }
예제 #2
0
        public override void Render(RenderWindow window)
        {
            cam.Render(window);
            leftEmitter.Render(window);
            rightEmitter.Render(window);

            window.Draw(sprite);

            collider.Render(window);
        }
예제 #3
0
        public static void Rect(RenderWindow rw, float x, float y, float w, float h)
        {
            RectShape.FillColor        = PrimaryColor;
            RectShape.Position         = new Vector2f(x, y);
            RectShape.Size             = new Vector2f(w, h);
            RectShape.OutlineColor     = OutlineColor;
            RectShape.OutlineThickness = OutlineThickness;

            rw.Draw(RectShape);
        }
예제 #4
0
 private void DrawBricks(RenderWindow app)
 {
     foreach (Brick brick in bricksToDraw)
     {
         if (brick.IsVisible)
         {
             app.Draw(brick.Rect);
         }
     }
 }
예제 #5
0
 private void Draw()
 {
     window.Clear();
     window.Draw(shape);
     foreach (var l in list)
     {
         l.Draw(window);
     }
     window.Display();
 }
예제 #6
0
 public void Draw(RenderWindow window)
 {
     if (_gameHandler.RoundObject.GameWin == true)
     {
         _backgroundSpriteGameWin.Draw(window, RenderStates.Default);
         window.Draw(GameWinList[0]);
         window.Draw(this._score);
     }
     else
     {
         _backgroundSpriteGameOver.Draw(window, RenderStates.Default);
         for (int i = 0; i < GameOverList.Length; i++)
         {
             window.Draw(GameOverList[i]);
         }
         window.Draw(this._continue);
         window.Draw(this._score);
     }
 }
예제 #7
0
 // Tegn objectet
 public void Draw()
 {
     if (_isVisible)
     {
         if (_active)
         {
             _window.Draw(_activeShape);
             foreach (Text item in _list)
             {
                 _window.Draw(item);
             }
         }
         else
         {
             _window.Draw(_shape);
             _window.Draw(_list[0]);
         }
     }
 }
예제 #8
0
        public override void Render(RenderWindow window)
        {
            window.Draw(sprite);
            if (emitter != null)
            {
                emitter.Render(window);
            }

            collider.Render(window);
        }
예제 #9
0
 public void Draw(Scene scene)
 {
     foreach (var chunk in scene.Chunks)
     {
         foreach (var entity in chunk.Entities)
         {
             _mainWindow.Draw(entity);
         }
     }
 }
예제 #10
0
파일: Program.cs 프로젝트: chaley33/Ants
        private static void Main(string[] args)
        {
            AntsList    = new List <Ant>();
            FoodSources = new List <FoodSource>();
            GenerateAnts(10);
            GenerateFoodSources(3);
            window                     = new RenderWindow(new VideoMode(WindowWidth, WindowHeight), "My window");
            window.Closed             += OnClose;
            window.MouseButtonPressed += MouseButtonPressed;
            window.SetFramerateLimit(30);

            while (window.IsOpen)
            {
                window.Clear();

                foreach (var foodSource in FoodSources)
                {
                    foreach (var food in foodSource.Foods)
                    {
                        window.Draw(food.Shape);
                    }
                }

                foreach (var ant in AntsList)
                {
                    ant.Move();
                    window.Draw(ant.Sprite);

                    if (Debug)
                    {
                        var targetPosition = ant.targetPosition;
                        var targetShape    = new RectangleShape(new Vector2f(10, 10));
                        targetShape.Position = targetPosition;
                        window.Draw(targetShape);
                    }
                }

                AntsList[0].debug = false;

                window.DispatchEvents();
                window.Display();
            }
        }
예제 #11
0
 public void redenrizar()
 {
     while (window.IsOpen)
     {
         window.DispatchEvents();
         window.Clear(Color.White);
         window.Draw(bgSprite);
         window.Display();
     }
 }
 public void Draw(RenderWindow window)
 {
     for (int x = 0; x < Configuration.GridWidth + 1; x++)
     {
         for (int y = 0; y < Configuration.GridHeight + 1; y++)
         {
             window.Draw(GridVisuals[x, y]);
         }
     }
 }
예제 #13
0
        //this is for the cpu to place on random field pos
        //public FieldPosition GetRandomFieldPosition(PlayerType player)
        //{

        //    if (player == PlayerType.Enemy)
        //    {
        //        return player2Field[random.Next(0, player2Field.Length)];
        //    }
        //    return null;
        //}

        //drawing the field positions will also in future handle the background
        public void Draw(ViewType viewType)
        {
            //DrawGrid(viewType);
            if (viewType == ViewType.SideView)
            {
                window.Draw(turnStateText);
                window.Draw(matchStateText);
            }
            else
            {
                player1Field.Draw(window);

                player2Field.Draw(window);
            }



            //target.Draw(CardOutlineRectangle(1400,600));
        }
예제 #14
0
파일: Program.cs 프로젝트: EugenyCh/All
        void RenderFigure()
        {
            int size = figure.polygons.Keys.Count;

            if (figure.Dimension() > 2)
            {
                var zBuffer = new SortedList <double, int>(new DuplicateKeyComparer <double>());
                for (int c = 0; c < size; ++c)
                {
                    var             polygon = figure.polygons[c];
                    Vector <double> normal  = polygon.Aggregate((s, v) => s + v).Normalize(1);
                    zBuffer.Add(normal[2], c);
                }

                for (int c = 0; c < size; ++c)
                {
                    int   id      = zBuffer.Values[c];
                    var   polygon = figure.polygons[id];
                    Color color   = originalShape.FillColor;

                    double zp = (zBuffer.Keys[c] + 1) * 0.5;
                    color.R = (byte)(color.R * zp);
                    color.G = (byte)(color.G * zp);
                    color.B = (byte)(color.B * zp);
                    color.A = (byte)(color.A * zp);

                    ConvexShape shape = new ConvexShape
                    {
                        Position  = originalShape.Position,
                        FillColor = color
                    };

                    shape.SetPointCount((uint)polygon.Count);
                    for (int i = 0; i < polygon.Count; ++i)
                    {
                        shape.SetPoint((uint)i, new Vector2f((float)polygon[i][0], -(float)polygon[i][1]));
                    }

                    window.Draw(shape);
                }
            }
        }
예제 #15
0
파일: Game.cs 프로젝트: ZakenKenpachi/tp2
 public void Draw(RenderWindow window)
 {
     for (int i = 0; i < maze.GetWidth(); i++)
     {
         for (int j = 0; j < maze.GetHeight(); j++)
         {
             if (maze.GetMazeElementAt(i, j) == Element.Wall)
             {
                 wallSprite          = new Sprite(wallTexture);
                 wallSprite.Position = new Vector2f(i * DEFAULT_GAME_ELEMENT_WIDTH, j * DEFAULT_GAME_ELEMENT_HEIGHT);
                 window.Draw(wallSprite);
             }
             if (maze.GetMazeElementAt(i, j) == Element.Opponent)
             {
                 for (int k = 0; k < tabOpponent.Length; k++)
                 {
                     tabOpponent[k].Draw(window);
                 }
             }
             if (maze.GetMazeElementAt(i, j) == Element.Hero)
             {
                 hero.Draw(window);
             }
             if (maze.GetMazeElementAt(i, j) == Element.None)
             {
                 noneSprite          = new Sprite(noneTexture);
                 noneSprite.Position = new Vector2f(i * DEFAULT_GAME_ELEMENT_WIDTH, j * DEFAULT_GAME_ELEMENT_HEIGHT);
                 window.Draw(noneSprite);
             }
         }
     }
     theStar = new Star();
     if (theStar.IsStarVisible())
     {
         maze.SetElementAt(8, 9, Element.Star);
         if (!theStar.IsStarActivated())
         {
             theStar.Draw(window, 8, 9);
         }
     }
     //window.Draw(timeText);
 }
예제 #16
0
파일: Game-.cs 프로젝트: ZakenKenpachi/tp2
 /// <summary>
 /// Fonction qui dessine les objets à l'écran.
 /// </summary>
 /// <param name="window">La fenètre de jeu</param>
 public void Draw(RenderWindow window)
 {
     for (int i = 0; i < maze.GetWidth(); i++)
     {
         for (int j = 0; j < maze.GetHeight(); j++) //Deux for inbriqués pour parcourir le tableau entier.
         {
             //Dessine les murs.
             if (maze.GetMazeElementAt(i, j) == Element.Wall)
             {
                 wallSprite          = new Sprite(wallTexture);
                 wallSprite.Position = new Vector2f(i * DEFAULT_GAME_ELEMENT_WIDTH, j * DEFAULT_GAME_ELEMENT_HEIGHT);
                 window.Draw(wallSprite);
             }
             //Dessine le héros.
             if (maze.GetMazeElementAt(i, j) == Element.Hero)
             {
                 hero.Draw(window);
             }
             //Dessine les cases vides.
             if (maze.GetMazeElementAt(i, j) == Element.None)
             {
                 noneSprite          = new Sprite(noneTexture);
                 noneSprite.Position = new Vector2f(i * DEFAULT_GAME_ELEMENT_WIDTH, j * DEFAULT_GAME_ELEMENT_HEIGHT);
                 window.Draw(noneSprite);
             }
             //Dessine les ennemis.
             if (maze.GetMazeElementAt(i, j) == Element.Opponent)
             {
                 for (int k = 0; k < tabOpponents.Length; k++)
                 {
                     tabOpponents[k].Draw(window);
                 }
             }
             //Dessine l'étoile.
             if (maze.GetMazeElementAt(i, j) == Element.Star)
             {
                 theStar.Draw(window, i, j);
             }
         }
     }
     window.Draw(timeText);   //Dessine le temps de la partie.
 }
예제 #17
0
        public void DrawText(RenderWindow c_Window, string c_Text, Vector2f position, uint c_Size, Color c_Color) //method for drawing text on the screen
        {
            defaultText.Font            = defaultFont;                                                            //set the font
            defaultText.CharacterSize   = c_Size;                                                                 //set it size
            defaultText.Position        = position;                                                               //set its location on the screen
            defaultText.DisplayedString = c_Text;                                                                 //what is actually being displayed (text)
            defaultText.Color           = c_Color;                                                                //the color of the text we are drawing
            defaultText.Style           = Text.Styles.Bold;

            c_Window.Draw(defaultText);  //window drawing function
        }
예제 #18
0
 public void Draw(RenderWindow window)
 {
     window.Draw(playerSprite);
     weapon.SetWeaponPosition(Position, dimensions, window);
     weapon.Draw(window, playerLevel);
     foreach (var bullet in Bullets)
     {
         bullet.Draw(window);
     }
     hpBar.Draw(window);
 }
 public static void Draw(this List <IRenderable> renderables, RenderWindow renderWindow)
 {
     renderables.OrderBy(renderable => (int)renderable.RenderableRenderLayer)
     .ToList()
     .ForEach(renderable
              => renderable.GetRenderComponents()
              .ToList()
              .FindAll(renderComponent => renderComponent != null)
              .ForEach(renderComponent
                       => renderWindow.Draw(renderComponent.Shape, new RenderStates(shader: (renderable is IShadable shadable ? shadable.CurrentShader : null)))));
 }
예제 #20
0
파일: Star.cs 프로젝트: smasson99/TP3_Prog
 /// <summary>
 /// Fonction dont le rôle est d'afficher à l'écran l'étoile
 /// </summary>
 /// <param name="window">L'écran du jeu</param>
 public void Draw(RenderWindow window)
 {
     //Donner une couleur à l'étoile
     shape.FillColor = colors[colorType];
     shape.Position  = new Vector2f(PositionX, PositionY);
     if (rnd.Next(0, 100) < 5)
     {
         shape.FillColor = colors[rnd.Next(0, colors.Length)];
     }
     window.Draw(shape);
 }
예제 #21
0
 private void OpenStats()
 {
     Text[] statsTexts = new Text[GameProperties.AmountOfStats];
     for (int i = 0; i < GameProperties.AmountOfStats; i++)
     {
         statsTexts[i]          = new Text("[" + (i + 1) + "] " + data.stats[i].ToString(), DataLoader.font1, 30);
         statsTexts[i].Position = new Vector2f(70f, 70 + 40 * i);
         statsTexts[i].Color    = Color.White;
     }
     while (window.IsOpen && controllerLoop)
     {
         window.Clear();
         for (int i = (int)GameProperties.AmountOfStats - 1; i >= 0; i--)
         {
             window.Draw(statsTexts[i]);
         }
         window.DispatchEvents();
         window.Display();
     }
 }
예제 #22
0
        private void DrawGrid()
        {
            RectangleShape line = new RectangleShape();

            line.FillColor = new Color(50, 50, 50, 150);

            line.Size = new Vector2f(20000, 2);
            for (int i = -5000; i < 15000; i += 80)
            {
                line.Position = new Vector2f(-5000, i);
                _window.Draw(line);
            }

            line.Size = new Vector2f(2, 20000);
            for (int i = -5000; i < 15000; i += 80)
            {
                line.Position = new Vector2f(i, -5000);
                _window.Draw(line);
            }
        }
예제 #23
0
        /// <summary>
        /// Method for drawing the game elements to the game window
        /// </summary>
        public void Draw()
        {
            /// clear the window
            window.Clear();

            /// draw game scene
            window.Draw(text);

            /// draw menu
            if (showMainMenu)
            {
                menu.Draw(window, RenderStates.Default);
            }

            /// draw help text
            window.Draw(helptext);

            /// display the window to the screen
            window.Display();
        }
예제 #24
0
 public void Draw(RenderWindow window)
 {
     window.Clear(Color.Black);
     window.Draw(background);
     foreach (var button in buttons)
     {
         button.Draw(window);
     }
     mousePointer.Draw(window);
     window.Display();
 }
예제 #25
0
파일: Graphics.cs 프로젝트: Kukks/CryBits
    private static void Render(Texture Texture, Rectangle Rec_Source, Rectangle Rec_Destiny, object Color = null, object Mode = null)
    {
        Sprite TmpImage = new Sprite(Texture);

        // Define os dados
        TmpImage.TextureRect = new IntRect(Rec_Source.X, Rec_Source.Y, Rec_Source.Width, Rec_Source.Height);
        TmpImage.Position    = new SFML.System.Vector2f(Rec_Destiny.X, Rec_Destiny.Y);
        TmpImage.Scale       = new SFML.System.Vector2f(Rec_Destiny.Width / (float)Rec_Source.Width, Rec_Destiny.Height / (float)Rec_Source.Height);
        if (Color != null)
        {
            TmpImage.Color = (SFML.Graphics.Color)Color;
        }

        // Renderiza a textura em forma de retângulo
        if (Mode == null)
        {
            Mode = RenderStates.Default;
        }
        RenderWindow.Draw(TmpImage, (RenderStates)Mode);
    }
예제 #26
0
 public void Draw(RenderWindow ventana)
 {
     for (int y = 0; y < mapaAlto; y++)
     {
         for (int x = 0; x < mapaAncho; x++)
         {
             //En el Game crear un objeto para poder llamarlo
             ventana.Draw(patrones[x, y]);
         }
     }
 }
예제 #27
0
        protected override void Draw()
        {
            renderTexture.Clear();
            renderTexture.Draw(background);
            Screens.Draw();
            renderTexture.Display();

            RenderWindow.Clear();
            RenderWindow.Draw(new Sprite(renderTexture.Texture));
            RenderWindow.Display();
        }
예제 #28
0
        /// <summary>
        /// Draws the ship and the jet, if the user has recently
        /// pressed the thrust key
        /// </summary>
        /// <param name="window"></param>
        public override void Draw(RenderWindow window)
        {
            Edge curEdge = OutOfBoundsEdge(window, shipLength / 2);

            if (curEdge != Edge.NULL)
            {
                ResetPosition(curEdge, window, shipLength / 2);
            }
            // TODO : Fix jet flickering, ruled out keyboard repeat (not sure what the issue is)
            if (hasThrust)
            {
                window.Draw(jetShape);
            }
            window.Draw(shape);

            // These are resetted after drawing the jet
            // Otherwise the jet would never be drawn
            hasThrust = false;
            hasSpin   = false;
        }
예제 #29
0
        public void Draw()
        {
            var rail = new RectangleShape(new Vector2f(_width, _height));

            rail.FillColor = new Color(220, 220, 220);
            rail.Position  = _position;

            var handle = new RectangleShape(new Vector2f(_width / 10, _height));

            handle.FillColor = new Color(100, 100, 100);
            handle.Position  = _handlePos;
            handle.Origin    = new Vector2f(_width / 20f, 0f);


            if (_isVisible == true)
            {
                _window.Draw(rail);
                _window.Draw(handle);
            }
        }
예제 #30
0
        public override void Desenhar(RenderWindow window)
        {
            /* Desenha a escada na tela */

            base.Desenhar(window);

            if (Selecionado)
            {
                window.Draw(rect);
            }
        }