SFML community forums

Help => Graphics => Topic started by: Volatile Agent on September 19, 2019, 04:08:15 pm

Title: Error creating VertexArray
Post by: Volatile Agent on September 19, 2019, 04:08:15 pm
I am getting a syntax error on the symbol sf::Lines, and I can't figure out why. I've also tried specifying it as sf::PrimitiveType::Lines. What am I doing wrong?

#include <vector>
#include <SFML/Graphics.hpp>
#include "Geometry.h"

using namespace DarkLoonMath;

class CSpaceRaceMap : sf::Drawable
{
private:
        std::vector<TLineSegment2<float>> Lines;
        sf::VertexArray Vertices(sf::Lines, 10);
        const sf::Color MapLineColor = sf::Color::Green;

public:
        CSpaceRaceMap();
        ~CSpaceRaceMap();

        void AddLineSegment(TLineSegment2<float> S);

        void Draw(sf::RenderTarget & target, const sf::RenderStates states);
        void Update(sf::Time delta);
};

 
Title: Re: Error creating VertexArray
Post by: Laurent on September 19, 2019, 08:21:17 pm
You can't construct a class member directly when you declare it. You must use the constructor's initialization list (Google for more details).