Something I find useful is adding a SFML custom wizard to qtcreator, it takes the drudgery out of setting up a new project so I thought I may as well share it.
First you need to locate your qtcreator config folder, which on linux (for me) is at $HOME/.config/QtProject/qtcreator/templates
It will vary depending on distro/OS so check this out:
http://qt-project.org/doc/qtcreator-3.1/creator-project-wizards.htmlYou may have to create the templates folder, and inside that the wizards folder and then inside that a folder called SFML. So the path now becomes: $HOME/.config/QtProject/qtcreator/templates/wizards/SFML
I'm using CMake so you will need to create a generic CMakeLists.txt inside your newly created SFML folder. Mine looks like this but you should adjust it to your system:
project(%ProjectName%)
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wall -O0")
set(CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules/" "/usr/share/SFML/cmake/Modules/")
set(SOURCE
${SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/main.%CppSourceSuffix%
)
set(HEADERS
${HEADERS}
)
find_package(SFML 2 REQUIRED system window graphics network audio)
if(SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
endif()
add_executable(${PROJECT_NAME} ${SOURCE})
target_link_libraries(${PROJECT_NAME} ${SFML_LIBRARIES})
The %ProjectName% variable will be replaced with the name of the project you give in the new project wizard. The variable %CppSourceSuffix% will be replaced with whatever you have qtcreator set to use as C++ file name suffixes. So if you use something other than cpp you will want to change the filename of main.cpp you will create next and adjust the "file source" attribute in the XML file you will create later, or you can get rid of the %CppSourceSuffix% and just hard code the name.
Now you will need a main.cpp file (adjust it to your needs):
#include <SFML/Graphics.hpp>
int main()
{
const int SWIDTH = 1024;
const int SHEIGHT = 768;
sf::RenderWindow win(sf::VideoMode(SWIDTH,SHEIGHT),"%ProjectName:c%",sf::Style::Close);
while(win.isOpen())
{
sf::Event e;
while (win.pollEvent(e))
{
if(e.type == sf::Event::Closed)
{
win.close();
}
}
win.clear();
//drawing
win.display();
}
return 0;
}
Again it has the %ProjectName:c% variable with a ':c', which means it will use your project name with the first letter capitalised as your window title.
Now create a file called wizard.xml
<wizard version="1" kind="project" firstpage="10" id="S.Plain C++ (SFML/CMake)" category="I.Projects"
platformIndependent="true" featuresRequired="CMake.CMakeSupport">
<icon>sfml.png</icon>
<description>Creates a SFML C++ project using CMake.</description>
<displayname>Plain SFML C++ Project (CMake Build)</displayname>;
<displaycategory>Non-Qt Project</displaycategory>
<files>
<file source="main.cpp" target="main.%CppSourceSuffix%" openeditor="true"/>
<file source="CMakeLists.txt" openproject="true"/>
</files>
</wizard>
This xml file describes the generic wizard, where to place it in the "Create New" dialog and the picture to use. I knocked up a quick 32x32 sfml logo in GIMP which I've attached (hope you don't mind Laurent), this also goes in the SFML folder.
That's it. Restart QtCreator, go to New Project/Non-Qt Project and "Plain SFML Project" should be under the usual CMake options. Hope it's useful.