SFML community forums

Help => General => Topic started by: jokoon on November 06, 2014, 03:55:35 pm

Title: Are the examples supposed to work?
Post by: jokoon on November 06, 2014, 03:55:35 pm
I was trying to learn how to use shader in SFML, I encountered the Effect virtual class, and I wanted to know what were the argument of the update() function and where was it called.

I tried to setup the examples using CMake, I got an error:

CMake Error at ftp/CMakeLists.txt:8 (sfml_add_example):
  Unknown CMake command "sfml_add_example".

I could not find the source of SFML 1.6 either.

So how are those effects class used ? Where can I see the full code of those examples, meaning the main() ?
Title: Re: Are the examples supposed to work?
Post by: Jesper Juhl on November 06, 2014, 04:01:59 pm
Examples are supposed to work. Yes.
SFML 1.6 is ancient. Don't bother with it. Get 2.1 at least - or even better build the current master branch from the github repository.
Title: Re: Are the examples supposed to work?
Post by: eXpl0it3r on November 06, 2014, 04:03:21 pm
If you want to know parameters of a function, check out the API documentation (http://sfml-dev.org/documentation/2.1/).

Don't use SFML 1.6, it's outdated, buggy, unmaintained and lacks a lot of features.

If you want to build the examples, just check the SFML_BUILD_EXAMPLES when building SFML.
Title: Re: Are the examples supposed to work?
Post by: jokoon on November 07, 2014, 09:55:54 pm
If you want to know parameters of a function, check out the API documentation (http://sfml-dev.org/documentation/2.1/).

Don't use SFML 1.6, it's outdated, buggy, unmaintained and lacks a lot of features.

If you want to build the examples, just check the SFML_BUILD_EXAMPLES when building SFML.

You did not understand my question.

Where is the main() in the examples ? I could not find it.
Title: AW: Are the examples supposed to work?
Post by: eXpl0it3r on November 07, 2014, 10:00:31 pm
What virtual effect class are you talking about?
What examples are you talking about?
When doing what exactly did you encounter issues with CMake?
What has SFML 1.6 to do with all of this?
Title: Re: Are the examples supposed to work?
Post by: Laurent on November 07, 2014, 10:15:03 pm
You can't build examples alone with CMake, they can only be built together with SFML. Only the top-level CMakeLists.txt can be given to the cmake executable.

But you don't need to compile them, they are pre-compiled in SFML releases.

Most examples are in a single file, and when it's not the case, there are not more than 2 or 3 files; it shouldn't be hard to find the main() function... If you look at the Shader example, there's the Effect.hpp header which defines the Effect abstract class, and Shader.cpp which contains the implementation of the example -- and the main() function. I can't believe you didn't find it :P
Title: Re: Are the examples supposed to work?
Post by: jokoon on November 08, 2014, 08:34:09 am
Oh yes, sorry.

(I did not scroll the entire .cpp file)
Title: Re: Are the examples supposed to work?
Post by: Nexus on November 08, 2014, 01:28:58 pm
Every decent editor has a search function...
Title: Re: Are the examples supposed to work?
Post by: jokoon on November 08, 2014, 02:26:06 pm
I thought there was some example manager class or something like that...

I also thought the example were deprecated because the cmake script returned some error...

My fault :p