Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem with an SFML VertexArray Example  (Read 1124 times)

0 Members and 1 Guest are viewing this topic.

Romans

  • Newbie
  • *
  • Posts: 5
    • View Profile
Problem with an SFML VertexArray Example
« on: November 02, 2019, 05:31:08 pm »
Hello! I'm watching this example into SFML VertexArray Examples (the last in the bot: the Particle System):

https://www.sfml-dev.org/tutorials/2.5/graphics-vertex-array.php

I'm trying to use it and it's very good but i have some question, and the most important of them is:

What is the method virtual void draw(RenderTarget, RenderStates), where did they use it?

How does it works? If i remove the function, it gives the error:

particles.cpp|88|error: cannot declare variable 'particles' to be of abstract type 'ParticleSystem'

At the main where it creates the class instance. WHy? Thank you

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problem with an SFML VertexArray Example
« Reply #1 on: November 09, 2019, 07:35:59 pm »
The draw function is a function in the base class of sf::Drawable, from which, as you can see, ParticleSystem is derived.
This allows ParticleSystem to be drawn in a similar way to other SFML drawables. Namely, window.draw(object) rather than object.draw(window).
It talks about this in the very tutorial you mentioned but more specifically in the Creating an SFML-like entity section.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*