Stack Exchange Network

Stack Exchange network consists of 174 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
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [sfml]

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

1
vote
0answers
39 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 ...
-1
votes
0answers
35 views

Unique_ptr window draw, how can i make it work?

How can I access the member functions of my window? I have a unique_ptr for my window and I am trying to draw my circle shape and I don't get it to work. ...
-3
votes
1answer
57 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
109 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
122 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
votes
0answers
30 views

Angle Between One Vector and its Reflected Vector coming out to be wrong

I’m making a 2d game where reflection of an object is required. I’m solving the relfection porn=blem using vectors like this: float x = (bullet.x - player.x); float y = (bullet.y - player.y); ...
1
vote
0answers
27 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
39 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
143 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
164 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
63 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
45 views

SFML: How to draw/render from Screen class

Game architecture is as follows: // main.cpp ...
1
vote
1answer
128 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
466 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
92 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
136 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
38 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
79 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
36 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
81 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
67 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
123 views

SFML Keyboard Input

I've implemented a basic Keyboard Input manager: ...
1
vote
0answers
272 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
35 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
220 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
47 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
39 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
126 views

screen coords to map coords isometric CSFML

I am implementing a game with 2d/isometric graphics using a height-map. Map looks like this: https://i.imgur.com/xEcZAwm.png I'm having a hard time converting from screen coordinates (ie a mouse ...
0
votes
0answers
60 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
335 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
158 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
201 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
0answers
68 views

Gamespeed slows down when instantiating game objects

Im trying to create a game by using SFML. However SFML is pretty basic I wrote a small framework around it to use it for gamedevelopment. For example I have a GameObject class which every object like ...
0
votes
1answer
65 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
368 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
116 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
898 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
173 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
98 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: ...
0
votes
0answers
62 views

More tiles I create, the slower is the player movement; how can I fix this? [duplicate]

I'm currently creating a 2D tile-based game, and yesterday I started to work on a map editor. All works correctly except one thing: more tiles I create on the map, the slower is the player movement. ...
3
votes
0answers
80 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
83 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
353 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
248 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
163 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 ...
0
votes
1answer
137 views

SFML Sprite not being rendered when returned from a method

I am trying to use spritesheets in SFML. My Player class inherits from the Creature class which inherits from the Entity class. I only see a white square when I render the player. However, this is not ...
3
votes
2answers
4k views

How to create a button in SFML?

How can I get clickable buttons working in SFML? I've failed figuring it out on my own. At first I tried just putting in text and then I tried an image for the Exit button. Neither of them work in the ...
1
vote
1answer
348 views

Why is the sprite flickering in full screen mode in SFML?

I have been trying to make a simple platformer game with SFML. Here is my main method where draw and update functions call the draw and update functions of all my entities which in turn update the ...