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
0answers
78 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
42 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
86 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
21 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
39 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
38 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
38 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
41 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
48 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
61 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
133 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
142 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
28 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
41 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
461 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
203 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
74 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
68 views

SFML: How to draw/render from Screen class

Game architecture is as follows: // main.cpp ...
1
vote
1answer
144 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
650 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
94 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: ...
0
votes
0answers
137 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
42 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
84 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
40 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
95 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
69 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
189 views

SFML Keyboard Input

I've implemented a basic Keyboard Input manager: ...
1
vote
0answers
333 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
37 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
251 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
51 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 ...
0
votes
0answers
65 views

Why won't my triangle draw in OpenGL C#?

I am currently working on messing around with OpenGL and graphics programming and decided to work on OpenGL in C# using the OpenGL4CSharp Library and SFML .NET library. I am currently following this ...
1
vote
1answer
399 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
208 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
231 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
69 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
395 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
120 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
197 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 ...
0
votes
1answer
100 views

Not placing tiles correctly on a grid

I recently created a map editor, and i came across a problem: I can't position some tiles on some grid blocks, but if i go farther from Y-axis near 0, i can place blocks correctly. This is the video: ...
3
votes
0answers
82 views

Problem with shooting. Projectile is missing target from about 5 degrees to about 30 degrees

I'm trying to make projectile shooting code. But there is a problem, in most cases projectile is missing target. -sprite is origin of projectile -bulletSprite is a projectile -mouse is a target <...
1
vote
0answers
88 views

SFML 2.4's RectangleShape is running slow when rendered multiple times

I am creating a level for my game and currently, there is a Tile class where I have a black RectangleShape rendering without any weirdness, except when I look at the FPS, its 200. Now, I have a pretty ...
1
vote
1answer
392 views

SFML position problem when drawing a CircleShape

I am not sure but I think it's a problem with Windows 10 borderless windows The problem is when I draw the circle its always drawn with a little offset from where it should be. In the top of the ...
2
votes
2answers
258 views

How do I understand a big c++ gaming project in SFML? [closed]

Currently I am doing SFML- c++ as a basement in game development before starting out Unreal When I see a game project in SFML, the codebase is huge, like above 30 classes, 100 functions, how can I ...
0
votes
1answer
177 views

2D Collision Detection Problem

while making my game called "Journeys of Nemo the Fish" i stumbled upon a collision detection problem. Please, help me to solve it. The problem is: the program runs only the first if statement ...