Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sfml]

Simple and Fast Multimedia Library - a free, portable API that provides access to graphics, input, audio, etc.

0
votes
2answers
46 views

SFML - How to animate two Sprites with the same Clock?

I'm making a basic Street Fighter style game in SFML, and I use Clock and Time() from SFML to time the animations. Here's the ...
2
votes
1answer
73 views

How to load game resources correctly regardless of the working directory?

I am writing a resource manager for a hobby game project that reads textures/fonts etc. Up to now, I was giving the location of the files relative to the executable path, like: ...
1
vote
0answers
29 views

Issue with creating a view in a tilemap environment (SFML)

I'm experiencing a problem with my simple 2d tile map game. I have a character on screen that moves in all directions in a world made up of tiles/blocks. Basically I have created an array that with ...
2
votes
1answer
52 views

(SFML) Moving in one direction a time

so i've been making a pathfinder on a grid. I've succesfuly implemented the A* algorithm so the next step is making the AI follow a path. I got it to move to the desired destination but the thing is ...
-3
votes
0answers
31 views

Collision with gravity (SFML) [duplicate]

What's the fastest and smoothest way to implement collision detection in sfml and stop at collision with a platform so that you can expand upon this code and make a platformer game? I've tried many ...
1
vote
2answers
58 views

Collision Detection in Direction (SFML) [closed]

I am experiencing a problem with collision detection, an efficiency problem. Right now I want to make it so that my player square stops traveling in the direction of collision into the static object. ...
0
votes
1answer
39 views

How to flip sprite in sfml

I am facing the same problem although the sprite flips but only one time after that it does not flips at all. Here is the code snippet: ...
0
votes
0answers
102 views

AI movement in a tile based game

I've been tryin to make My AI follow my A* path in grid. the problem is that is goes off course and doesn't move along the path very well. currently got it to move only left and up. how I intended ...
0
votes
1answer
49 views

Getting Position of a Player in a grid

So I am making a pacman-like game. the game has tiles/grid. I keep the node data in a struct: ...
1
vote
1answer
116 views

Passing a value to a stuct

So I've been making a 2D grid and pathfinder using SFML. Now I ran into a problem. I've been making a vector for the path nodes. ...
1
vote
1answer
39 views

I want to display the total computed score in sfml

sf::RenderWindow window(sf::VideoMode(LAYOUT_WINDOW_WIDTH, LAYOUT_WINDOW_HEIGHT), "Tetris 2019 - A New Beginning"); ...
0
votes
1answer
51 views

How can I make the text flash?

I want to have text that flashes from green to white and back to green over and over until the window is closed? Below is what I have tried but i cant seem to get it to work, please help me. ...
0
votes
1answer
41 views

mouseButton.y and mouseButton.x is -858993460 for every event except MouseButtonPressed

Using SFML, every event type will produce a large negative value for x and y of -858993460. ...
0
votes
0answers
40 views

initialising constructor

I am using the SFML library to create a 2D grid. i use grid cords so I can place my players on the grid: I use struct to hold information of the nodes ...
0
votes
0answers
46 views

Making AI follow player in pacman game with grid

I have an AI that I want to navigate a maze in order to follow the player. I thought of creating a large grid with the help of FloatRects, so I do it like this: ...
1
vote
0answers
51 views

How can I make the cursor the right size on a 4k monitor?

Since I have a 4k screen, cursor.loadFromSystem(sf::Cursor::Hand)); gives me a cursor that is way too small. Is there a simple way to make the cursor ...
-3
votes
1answer
68 views

Cant make SFML work

I am having an error when I try to create the first window in SFML. the error says: The code execution cannot proceed because sfml-system-d-2.dll was not found. Reinstalling the program may fix the ...
0
votes
1answer
160 views

Where should I store textures for a game?

I am currently creating a game in SFML using C++ and I'm wondering: what is good practise for a location for textures? Should I store it with my project? Or my executable? Or even in something like ...
0
votes
1answer
165 views

Why is my Zombie enemy not chasing the player?

I am using C++ and SFML to make a top-down Zombie shooter. For now I have a player I can move around who can shoot but I am trying to have a basic AI for a Zombie who chases the player based on player ...
1
vote
0answers
30 views

How to apply a visual filter to what I am drawing?

I'm looking to apply a sepia filter to what I'm rendering. Perhaps we could just apply the filter to the view or pass it to the draw method to draw everything with the filter (I'm using one draw ...
1
vote
1answer
46 views

Texture won't appear using a vector of unique pointers of an Object

I am working on a top down 2d shooter game. I have a player Sprite and a Bullet class. I made a vector of pointers to Bullet to store the bullets. Here is the code of the vector and the functions I’m ...
0
votes
2answers
1k views

Error saying attempting to reference a deleted function while using a vector list

I’m making a 2d top down shooter game and I was working on shooting bullets. Im using a vector for the bullet in my player class: std::vector b; And I have coded a shoot function which shoots the ...
0
votes
1answer
229 views

SFML 2.5 on Ubuntu 18.04 - cannot open shared object file: No such file or directory

I'm trying to run an example code with SFML 2.5 on Ubuntu, but without success. I'm using: VSCode 1.27.0 with the Easy C++ Projects extension on Ubuntu 18.04. The build/run output keep saying that ...
0
votes
1answer
97 views

The SFML equivalent of polling to see if a key has been released?

I'm testing out SFML by trying to make a square move with lerp velocity. The desired result was that when, let's say, D was pushed, the square would accelerate smoothly from ...
0
votes
1answer
76 views

SFML: How to draw/render from Screen class

Game architecture is as follows: // main.cpp ...
1
vote
1answer
168 views

Day/Night cycle with GLSL - blend from one colour to another along Sin curve

I am attempting to implement a day/night cycle using a GLSL fragment shader in a 2D game i'm developing in SFML. I am a novice with shaders with this one being my first. Currently I am using a ...
1
vote
1answer
796 views

Why am I getting an access violation when assigning to a 2D array member?

c++ Beginner here, coming from Java background, and I'm getting the feeling this is a c++ specific error I'm running into. I am trying to procedurally generate a 2D map, which is of type Tile[y][x]. ...
0
votes
0answers
96 views

CSFML sfRenderTexture trouble

I am having trouble creating a sfRenderTexture in CSFML so that I can dynamically update my lighting. Why does this code: ...
-1
votes
0answers
140 views

If Statement always runs irrelevant of the condition in it in C++. Why?

I’ve been using C++ with the SFML library for a while. And I have encountered this problem which I am not sure how to fix. I am working on a game and below is a part of its code that is not working ...
0
votes
0answers
49 views

Create BGRA texture SFML

I have a texture sfml but this texture have a format RGBA how i can change it to BGRA? Or how to create texture with need able ...
0
votes
1answer
93 views

Game map for platformer megaman-style game

I want to make platformer game that would be sort of like megaman. I'm using SFML library for it. I have a problem with creating a map. Should I hardcode every single platform, add it colliders and so ...
0
votes
0answers
42 views

How to know a sprite position inside a view, relative to window?

I have this sprite of a car that moves with varied speed. It is inside a view and the view is moved to the left to keep the car always in the center of the window. The view accompanies the ...
2
votes
0answers
111 views

SFML.NET DLLNotFoundException with dll.config files in project

I am trying to run SFML.NET on arch linux and I have two dll.config files in my project called sfmlnet-graphics-2.dll.config and sfmlnet-window-2.dll.config. sfmlnet-graphics-2.dll.config: ...
0
votes
0answers
70 views

Creating state machines to handle multiple aspects of a game?

So first off, I'm not sure if it matters but I am using SFML and C++. I've been wanting to write a game and I've read a lot on FSMs and what they do/make things easier for managing games, etc. What I ...
0
votes
1answer
248 views

SFML Keyboard Input

I've implemented a basic Keyboard Input manager: ...
1
vote
0answers
376 views

SFML - How to implement a simple 2D lighting system

Lately, I've been reading a lot about 2D lighting systems in a game, and have observed just how much lighting can add to a game's graphics appeal. However, as for implementing one of these in SFML, I ...
0
votes
0answers
38 views

SFML Include Issues

I'm trying to copy over a VS2017 solution/project which uses SFML to a different machine. On the original machine, everything compiles and runs fine however when copied over to the second machine (...
0
votes
1answer
148 views

Why is my character not reacting to the gravity I set?

I've got a little question about my gravity that isn't working and I can't find out why... The issue is that the player just go upper but doesn't really 'jump' and doesn't come back on the ground. ...
1
vote
1answer
93 views

Dynamic Tilemap size changer

I have started coding this project using the library SFML a few months ago. I have implemented a random map generation everytime I load the game thanks to Biome and the Perlin noise Algorithm. I ...
0
votes
3answers
290 views

sf::mouse::getPosition method help

I am trying to write sf::mouse::getPosition(const Window &Relative To) in a function but I can't write the correct argument in it. Why is that? Here is my Game.cpp File: EDIT: I pasted the ...
0
votes
1answer
57 views

SFML GetRenderWindow Method Help

I have been following the "SFML Game Development By Example" and on chapter 2, the book was showing the example game design of a Snake game. However he didn't write the code of some header classes and ...
0
votes
1answer
42 views

Side of collision with rotation

I have 2 rectangles and I want to know if its a length collision or a breadth collision. I will also need to know the rectangle ...
1
vote
1answer
433 views

How do I set up an SFML .NET dll reference in Visual Studio Code

How do I set up SFML .NET library dll files as references in Visual studio code using dotnet core SDK? I want to ditch visual studio as it's large and clunky and am wondering how to add "third party" ....
0
votes
1answer
277 views

Convert gl_TexCoord[0].st to match version #330

I'm currently working on a sfml based library where I'm implementing widgets with shaders. I'm defining an quad with position and texcoord in sfml to make the shader apply to the object like this: <...
1
vote
0answers
255 views

Is there a way to get mouse coordinates relative to an sfml window without locking the mouse to the window border or monitor edges?

As the title states, is there a way to get the relative mouse coordinates to the sf::RenderWindow without locking the mouse cursor inside of the window border or monitor edges? In glfw using a mouse ...
0
votes
1answer
78 views

2D Lighting Problem with Black Backgrounds

I'm currently experimenting with simple lighting in my game made with SFML and C++ (though I don't think that's relevant to the question). It's my first time messing with lighting in 2D, and my basic ...
1
vote
1answer
451 views

Collision detection in SFML

I am building a simple 2D game with SFML and have a GameState object that contains a Plane and a vector of Enemies. THe plane is represented by a triangle and the enemies by a rectangle. The plane ...
1
vote
1answer
129 views

Jitters in collision reaction

I'm working on a project for school and I'm having some trouble solving a bug. When the player collides with a rectangle the sprite/hitbox keeps jittering while the player has momentum in the ...
0
votes
1answer
1k views

Using 2D std::vector for map and collision

Hello to anyone reading this. I am having trouble on how to use std::vector. From what I know, std::vector is a flexible version of an array and iterator is used to go through each individual element ...
0
votes
1answer
205 views

SDL2 Draw scene to texture. SDL2 RenderTexture like SFML

I've been developing a 2D Engine using SFML + ImGui. The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects ...