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

Author Topic: Error creating VertexArray  (Read 55 times)

0 Members and 1 Guest are viewing this topic.

Volatile Agent

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Error creating VertexArray
« 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);
};

 

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32123
    • View Profile
    • SFML's website
    • Email
Re: Error creating VertexArray
« Reply #1 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).
Laurent Gomila - SFML developer