Questions tagged [sfml]

SFML (Simple Fast Multimedia Library) is a portable and easy to use multimedia API written in C++. You can see it as a modern, object-oriented alternative to SDL. SFML is composed of several packages to perfectly suit your needs. You can use SFML as a minimal windowing system to interface with OpenGL, or as a fully-featured multimedia library for building games or interactive programs.

Official resources

Main features

  • Portable: SFML compiles on standard platforms like Windows (98, 2000, XP, Vista, 7, 8 and 10) and Unix systems (Linux, and Mac OS X). As the library grows up, support for more operating systems will be added.
  • Object-oriented: SFML is written in C++ and provides an efficient, object-oriented design. It relies on standard patterns and idioms to provide a simple and robust framework.
  • Easy to use: SFML aims at being easy to manipulate. The effort is put on the internal code to provide the simplest public interface.
  • Flexible: Instead of being one big API, SFML rather contains a lot of small packages, that can be chosen and combined according to the intended usage. You can use only the base package to get input and windowing, as well as the full graphics package with sprites and post-effects.
  • Easily integrable: SFML can be used in one or more windows, and/or can be integrated with existing interface components. Integration with existing graphical user interface (GUI) libraries is easy so that you can add SFML views into complex interfaces built with Qt, wxWidgets, MFC or whatever.

Languages

SFML is implemented in C++. That said, several bindings have been created for other languages that allow SFML to be used from C, C#, C++/CLI, D, Ruby, OCaml, Java, Python and VB.NET.

System

  • Portable and accurate time measurement
  • Simple and object-oriented threads and mutexes
  • Unicode module for proper conversions between UTF and locale-dependent encodings

Window

  • Can be used as a minimal, portable package to replace GLUT or SDL for windowing and input with OpenGL
  • Can create several rendering windows
  • Can be integrated into components of existing Qt, MFC, wxWidgets, Win32, X11, etc. interfaces
  • Provides both a message-based and a real-time interface for handling input
  • Can handle mouses with up to five buttons
  • Can handle four joysticks with up to seven axes and 32 buttons

Graphics

  • Interfaces very easily with OpenGL
  • Modern effects available and hardware-accelerated: alpha-blending, rotations, shaders, ...
  • Manages memory efficiently, so that you don't have to worry about resources lifetime or storage; you can even load your graphical resources before any window is created
  • Can load and save standard image formats: BMP, DDS, JPEG, PNG, TGA, and PSD
  • Can load all graphics resources directly from files in memory
  • Can use views like in a 3D scene, to zoom / translate / rotate the whole world
  • Uses a simplified shader language for adding real-time post-effects
  • Easy manipulation of graphical text through bitmap fonts
  • Supports unicode characters
  • Can load standard font file formats: TTF, CFF, PCF, FNT, BDF, PFR, SFNT, PostScript Type 1, Type 42

Audio

  • Uses hardware acceleration whenever possible
  • Can load and save standard sound formats: Ogg, WAV, FLAC, AIFF, Au, RAW, paf, 8SVX, NIST, VOC, IRCAM, W64, MAT4, MAT5 PVF, HTK, SDS, AVR, SD2, Core Audio Format, WVE, MPC2K, RF64
  • Can load all audio resources directly from files in memory
  • 3D sound spacialization
  • Easy interface for capturing audio
  • Manages memory efficiently, so that you don't have to worry about resources lifetime or storage
  • Supports streaming for big files ; you can even write your custom streaming class for any source (network, ...)
  • Supports multi-channels formats (mono, stereo, 4.0, 5.1, 6.1, 7.1)

Network

  • Implements a portable layer over TCP and UDP sockets
  • Easy data transfers through stream-based extensible packets
  • Classes to use the HTTP and FTP internet protocols

License

3542 questions
104
votes
3 answers

How to call on a function found on another file?

I'm recently starting to pick up C++ and the SFML library, and I was wondering if I defined a Sprite on a file appropriately called "player.cpp" how would I call it on my main loop located at "main.cpp"? Here is my code (Be aware that this is SFML…
user1932645
44
votes
2 answers

Vector is not a Template?

I am currently trying to follow a tutorial on making a simple 2D tile engine for top-down RPGs. For some reason though I get the intellisense error vector is not a template The word "vector" is underlined with red. Why does this not work? Why is it…
OmniOwl
  • 5,477
  • 17
  • 67
  • 116
34
votes
5 answers

Declaring multiple object pointers on one line causes compiler error

when I do this (in my class) public: Entity() { re_sprite_eyes = new sf::Sprite(); re_sprite_hair = new sf::Sprite(); re_sprite_body = new sf::Sprite(); } private: sf::Sprite* re_sprite_hair; sf::Sprite*…
user569322
29
votes
6 answers

Failed to Initialize GLEW. Missing GL version

I've tried to set up SFML 2.0 with the latest version of the qt creator, I've set up SFML right and I imported a small game I wrote in visual studio. Upon compilation, I get this: What I tried Reinstalling the entire qt SDK and qt creator IDE from…
Bugster
  • 1,552
  • 8
  • 34
  • 56
21
votes
3 answers

Centering text on the screen with SFML

I'm using SFML 2.0 libraries on Ubuntu 12.10, using sudo apt-get install libsfml-dev to get them. Now I'm trying to get a sf::Text centered in the sreen. To do this, I set the origin of the text (the place that is used to make transformations such…
Dani Torramilans
  • 340
  • 1
  • 2
  • 7
19
votes
2 answers

Using Quaternions for OpenGL Rotations

So I'm writing a program where objects move around spacesim-style, in order to learn how to move things smoothly through 3D space. After messing around with Euler angles a bit, it seems they aren't really appropriate for free-form 3D movement in…
GarrickW
  • 2,181
  • 5
  • 31
  • 38
18
votes
5 answers

Pong physics problem

I have problem but I don't know how to describe it so I have drawn it. As you can see ball bounces when collision is detected. Nevermind the angle - I have just drawn it that way. But sometimes ball goes through the paddle leaving it other way. Why…
zarcel
  • 1,211
  • 2
  • 16
  • 35
18
votes
1 answer

2D isometric - SFML - Right formulas, wrong coordinate range

I don't work with tiles but cubes drawn with sf::Vertex. Each cubes have 6 sides with 4 points each. So i just have to cubes[numCube].sides()[numSide].... to select a side. I create cubes layer.cpp : for(int J = 0; J < mapSize; J++) { …
Madz
  • 287
  • 3
  • 14
14
votes
1 answer

sf::Texture applied in a wrong way

In my 2D isometric engine, I have the following classes: maps(variable)/layers(variable)/cubes(variable)/sides(6)/points(4)/coordinates(3) Each sides contains 4 points(1 point = 1 coordinate(x, y, z)). Each cubes contains 6 sides. I can create a…
Madz
  • 287
  • 3
  • 14
13
votes
1 answer

CMake link library from subdirectory

I am trying to include SFML sources in my project. My directories are laid out like this: main SFML (subtree synced with the official git repo) src General (here lies the binary) From the main level I am adding SFML…
Tommalla
  • 297
  • 1
  • 2
  • 10
12
votes
2 answers

Alternative to texelFetch?

I'm getting into GLSL and need some help with texture lookups. I'm trying to use a texture for storage but I cannot get "proper" texture lookups. I would prefer using the usual texture2D method (using GLSL 1.2) but the results are not good…
Rohan Singh
  • 326
  • 1
  • 3
  • 8
12
votes
4 answers

ld linker error "cpu model hidden symbol"

I'm getting an ld error when attempting to compile an sfml program on ubuntu 16.04. This is apparently a known issue, and there is supposed to be a workaround, but I don't understand what is…
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
12
votes
3 answers

Is there a good way to expose sf::Event to Lua with Luabridge?

According to the LuaBridge readme, LuaBridge does not support "Enumerated constants", which I assume is just enums. Since sf::Event is almost entirely enums, is there any way I can expose the class? Currently the only other solution I can come up…
Ben Hollier
  • 585
  • 2
  • 11
  • 32
12
votes
2 answers

Wrote some perlin noise kind of code, it looks blocky

The previous answered question doesn't seem to answer my problem "Blocky" Perlin noise I tried to simplify the most I could to make my code readable and understandable. I don't use the permutation table, instead I use the mt19937 generator. I use…
jokoon
  • 6,207
  • 11
  • 48
  • 85
11
votes
2 answers

"Looking At" an object with a Quaternion

So I am currently trying to create a function that will take two 3D points A and B, and provide me with the quaternion representing the rotation required of point A to be "looking at" point B (such that point A's local Z axis passes through point B,…
GarrickW
  • 2,181
  • 5
  • 31
  • 38
1
2 3
99 100