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
0
votes
0 answers

Errors occur while compiling SFML-Imgui "undefined reference to"

I'm trying to compile SFML-Imgui in the Code::Blocks application, but I get errors. I have all the necessary Imgui files in the project directory, but what else do I need to do to fix the error? ../main.cpp:13: undefined reference to…
Bru
  • 11
  • 1
0
votes
1 answer

How to move shapes along a path in SFML with C++

I am currently working on a personal project creating an orbit simulator in Visual Studio w/ C++ using the SFML library. This is my very first time working with SFML so there is a bit of a learning curve currently. The "planets" are static at the…
Summer
  • 43
  • 3
0
votes
1 answer

VS Code IntelliSense not finding SFML (c++). Why?

I am working on a personal project where I use SFML in my C++ code. When I created the project in VS Code a few weeks ago, I added the sfml using WSL. I noticed that IntelliSense wouldn't recognise SFML classes, and writing would result…
pevhv
  • 58
  • 7
0
votes
1 answer

"Duplicate storage qualifier" when trying to compile GLSL shader with SFML?

I'm trying to implement shaders in my sfml application, but with no success. I get the following error when compiling with g++ on ubuntu: Failed to compile vertex shader: 0:1(1): error: duplicate storage qualifier I'm trying to find a way to get…
Floggy X
  • 11
  • 4
0
votes
1 answer

CMake Error at build: Missing item in FREETYPE_LIBRARY

I am trying to install a tester program (https://github.com/o-reo/push_swap_visualizer) on my Microsoft Visual Code running on wsl-ubuntu. The developer of the program says that in order to install, I need to clone the program from a github and then…
0
votes
1 answer

cannot convert from 'b2BodyUserData' to 'sf::Shape *'

i had combine sfml and box2d. but i have an error in the source code. in this code sf::Shape* shape = static_cast(body->GetUserData()); how to convert from b2bodyuserdata to sf::shape?? and this code delete…
lie ardi
  • 5
  • 2
0
votes
0 answers

I'm making a particle sandbox sand falling system in c++ sfml but I'm having some major performance issues

// spawn if (Keyboard::isKeyPressed(Keyboard::Q)) // coal { particleR = new RectangleShape; particleV.push_back(*particleR); particleV[particleV.size() - 1].setSize(Vector2f(1, 1)); …
Jakebix
  • 63
  • 8
0
votes
1 answer

How to print player position on terminal in Sfml?

I tried using this code sf::Vector2f position = game.player_position(); std::cout << "position : " << position << std::endl; but it didn't work. Here the code in the "player_position()" function return sprite.getPosition(); i tried to print player…
Ok.
  • 21
  • 4
0
votes
1 answer

how to setup proprely a cmakefile to build an universal binary (macos M1, linux and windows) including SFML and TGUI llibraries

I'm working on a project where we need to use teh SFML and TGUI libraries, but now that we try to compile the TGUI lib with the CmakeFile, I get an error on my macbook M1 because TGUI uses a member of SFML called "auto_ptr" which has been…
0
votes
1 answer

Issues using IntRect in SFML. Can not pass constructors to IntRect like all tutorials show

taa.left = 0; taa.top = 0; taa.height = playerSpriteSize.y; taa.width = playerSpriteSize.x; player.setTextureRect(taa); player.setTextureRect(sf::IntRect(0, 0, 50, 50)); The taa part works but the later part does not. Why does it not let me…
Keke
  • 1
0
votes
1 answer

SFML on Clion with CMakeList freetype.lib

i want to create a 2D game in c++ with SFML but it don't work here my CMakeList and here my error message i think the issue is that the fill "freetype.lib" is missing but i don't know where i can find it
0
votes
0 answers

SFML Undefined symbols for architecture arm64

I am following a tutorial to use SFML. I have also used this tutorial to properly download SFML files and move them to their proper file locations. I also used brew to install SFML. I am currently using an M2 Mac, I have downloaded SFML version…
Mula
  • 1
  • 1
0
votes
1 answer

Compiling SFML Can't Be Finish: SFML/Audio/SoundRecorder.cpp In destructor error

I am at 82 % of compiling and it stops (use Linux OS), thus this is the screenshot. I want to use this SFML but why is it so hard to compile it and install it? I try this : grep "assert" SoundRecorder.cpp at the so-called file Thanks.
0
votes
0 answers

SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

I recently did a fresh install of CSFML and I am getting this errors when running my program: object.Exception@source/app.d(38): Fatal error(s) encountered whilst calling `loadSFML()` function: ["Error: libcsfml-system.so, Message:…
thebluepandabear
  • 263
  • 2
  • 7
  • 29
0
votes
1 answer

SFML 2.5.1 - Geometry shaders are not supported, Ubuntu 22.04, NVIDIA GeForce RTX Mobile

After changing the operating system, I could no longer use the SFML geometry shader and always got the following error: Failed to create a shader: your system doesn't support geometry shaders (you should test Shader::isGeometryAvailable() before…
kaiserm99
  • 146
  • 8
1 2 3
99
100