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

Author Topic: Help with definition in c++/SFML  (Read 1523 times)

0 Members and 2 Guests are viewing this topic.

Toxminn

  • Newbie
  • *
  • Posts: 2
    • View Profile
Help with definition in c++/SFML
« on: November 18, 2016, 03:21:53 pm »
Hello,

I have a question. How can I make a definition? I know I'm a beginner xD. For example. I want to make

#include <SFML/Graphics.hpp>

void example(){
  //HELP
}


int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);                     //that should be in the definition
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Help with definition in c++/SFML
« Reply #1 on: November 18, 2016, 03:43:22 pm »
It's not a definition, it's a function. And you don't explain what your problem is. But anyway, this is the SFML forum, we don't teach C++ here ;)

My advice is to go read a book about C++. You really can't learn C++ on a forum.
Laurent Gomila - SFML developer

djm_jm

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Help with definition in c++/SFML
« Reply #2 on: November 18, 2016, 04:11:25 pm »
Read the "programmer's bible of c++" by Kris Jamsa.  ;)

 

anything