3,665 questions
-3
votes
0
answers
104
views
Unable to run SFML in VSCode
I was following this tutorial.
It was going fine till 6:16. I installed the latest stable version of SFML (3.0.2) and mingw64 from the SFML website, specifically the files called "WinLibs UCRT 14....
0
votes
1
answer
110
views
C++ Mouse Input HandleProblem
bool isOnBottom(){
float y_bottom = m_shape->getPosition().y + (m_shape->getSize() / 2);
float x_shapeRight = m_shape->getPosition().x + (m_shape->getSize() / 2);
float ...
0
votes
1
answer
134
views
SFML fails to load font?
[Update]
I found that I need to link to a proper SFML library, specifically SFML debug/release. This was not done in my code, my bad.
eg
Use sfml-system-3.dll for release mode and use sfml-system-d-3....
0
votes
0
answers
102
views
C++ SFML window created from X11 handle says "not responding" despite running fine, and polling for events on Linux
so my problem is that when I create a X11 window and then create a SFML window from the X window handle, the os says the window is "not responding" even though I am polling for events and ...
3
votes
0
answers
99
views
ODR violations using SFML in global module fragment
I'm trying to build a project using SFML and C++20 modules. This project will be built both with MSVC and GCC 14.2. Now, to my knowledge (please correct me if I'm wrong):
SFML doesn't officially ...
2
votes
1
answer
159
views
Having trouble with a compiler issue: "No matching function for call to 'sf::Sprite::Sprite()'" How can I fix this?
I am quite new to programming, and am attempting to create a simple game. I'm having issues with sfml, but I think I installed it correctly. This is the code:
#include <SFML/Graphics.hpp>
#...
0
votes
1
answer
344
views
Is there a way to set up SFML 3 on Clion?
I found this CMAKE file for SFML 3.0:
cmake_minimum_required(VERSION 3.28)
project(CMakeSFMLProject LANGUAGES CXX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include(FetchContent)
...
2
votes
1
answer
277
views
I can't correctly resize window using SFML 3.0, C++
There are two problems. The first problem is that when I resize the window, there are distortions at the corners of the window. The second problem (I won't attach the screenshot, I'm sorry) it ...
1
vote
1
answer
126
views
SFML 3 how to deal with texts within a rectangle
#pragma once
#include <SFML/Graphics.hpp>
class RectangleWText
{
private:
sf::RectangleShape shape;
sf::Font font;
sf::Text label(std::string&);
public:
RectangleWText(...
0
votes
0
answers
74
views
Unable to have all pieces be seen on grid format using VertexArray with SFML and C++
I am facing difficulties with my C++/SFML project that is focused on replicating the game of Blokus. I've been trying to get all the pieces to be seen in initial loading and am also unable to have the ...
0
votes
1
answer
214
views
instantiation of template class 'std::basic_string<unsigned int>' requested. #include <SFML/System.hpp>
I am trying to use the Clock from SFML/System.hpp, but as soon as I include #include <SFML/System.hpp> in my header, and call make in the terminal, I get the error shown below. If I remove that ...
1
vote
0
answers
79
views
How to read the latest data with UDP socket in SFML?
I want to figure out how to read the "latest" data from a udp socket. As in my client reads data using SFML's udp socket but it reads old data. I read up that you should try flushing the ...
0
votes
0
answers
75
views
Sfml 3.0.0 setTextureRect does not work as intended
I am trying to learn sfml but I cant get over drawing sprite part. Without adding setTextureRect I can see full texture but when I add it, cant see the sprite
#include <SFML/Graphics.hpp>
#...
-2
votes
1
answer
78
views
sf::music prevents my program from crashing?
Here's the program i'm asking help for:
main program
#include "fonctions.h"
int main(){
sf::Music musique;
musique.openFromFile("audio/musique/song.mp3");
musique.play(...
1
vote
1
answer
54
views
Problem with the inialization of my variable to its class
Initially, I was trying to separate my main.cpp to different classes for each player for a game in SFML 3.0.0 I'm trying to build, but when trying to assign a local variable to my class the compiler ...
-3
votes
1
answer
128
views
How can I make the movement in SFML 3.0 less choppy?
My pong implementation is very choppy, and I think it may be because of how I calculate how much the program sleeps. The maximum frame rate is set to 60 and my computer should be able to run this at ...
4
votes
1
answer
162
views
Can't compile a *.cpp file with SFML using g++ on Windows
I'm trying to compile a *.cpp file:
#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
RenderWindow window(VideoMode(400, 400), L"New project", Style::Default);
...
0
votes
1
answer
524
views
Problems with the sf::Sprite class
I am making a game with SFML 3 which removed the default constructor for sf::Sprite.
I have this Player class:
#include <SFML/Graphics.hpp>
class Player
{
public:
Player();
sf::...
0
votes
1
answer
42
views
Rendering more than one sprites gives an unexpected error
The code files are written below.
When i try to compile and run the project with 'Enemies.h' I got error on Enemy.cpp -> Enemy::Draw -> window.draw(healthText);
If i comment out this line the ...
0
votes
0
answers
1k
views
Struggling with "pkg-config not found" errors using Meson when trying to use the SFML library (Windows)
I'm trying to run Meson with SFML as a dependency and I keep getting the message "Did not find pkg-config by name 'pkg-config'" and the error "Dependency lookup for openal with method '...
0
votes
1
answer
100
views
SFML cannot load textures from the images folder - Unable to open file
I am trying to load textures for a chessboard and chess pieces in my chess game using SFML. However, the loadFromFile function fails and returns the error: Unable to open file.
What I am trying to do:
...
0
votes
1
answer
60
views
SFML Window performance remains low after disabling LWA_COLORKEY
I have the following program which creates a SFML window and enables chroma-key using SetLayeredWindowAttributes with LWA_COLORKEY, then disables it after 5 seconds.
#include <iostream>
#include ...
0
votes
0
answers
43
views
Undefined reference to `WinMain@16' [duplicate]
I'm working on an SFML project, but when I try to compile, the main.exe file doesn't get created. I'm using a Makefile, but I keep getting an error:
The error
This is the MakeFile:
all: compile link
...
2
votes
1
answer
291
views
Trouble Using TGUI with SFML in C++ Project in Visual Studio 2022
I'm trying to integrate SFML and TGUI libraries into my C++ projects. While SFML works perfectly, I’m having trouble with TGUI.
I followed the installation instructions on the TGUI website carefully—...
0
votes
0
answers
29
views
I am attempting to set up SFML in VSC but it isn't linking properly [duplicate]
The following is my tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": &...