Questions tagged [sfml]
Simple and Fast Multimedia Library - a free, portable API that provides access to graphics, input, audio, etc.
377 questions
1
vote
1
answer
175
views
How to properly change resolution dynamically in SFML?
I am working on creating an options menu through which I can change resolution and toggle full screen mode. I am allowing only those resolutions that have aspect ratio 16:9, as my game was originally ...
0
votes
0
answers
161
views
My fragment shader is being run on every pixel of the screen
This is my first time using this website and I'm a beginner too, so sorry if what I'm asking doesn't make sense.
I am using C++ and OpenGL to make a basic platformer.
My issue is that the fragment ...
3
votes
1
answer
150
views
How to determine drivers placement in a race with shortcuts and offroading?
Thinking of doing a little Micro Machines clone in SFML/C++.
I know Micro Machines 'ai' was handled by having 2d array positions (or tiles) marked as being 'on-track' or 'off-track and directing the ...
1
vote
0
answers
71
views
Outline Position in pool game
I'm developing a pool game using SFML and Box2D, and I'm currently facing an issue with creating the cue ball outline when the player aims. I have three rays that are cast: two black ones and one ...
0
votes
1
answer
87
views
When does SFML deal with user input
I have an SFML programme using window.setFramerateLimit() to determine the time step of the game.
I have a game loop that looks like this:
...
0
votes
0
answers
44
views
CircleShape crashing program when defined as an instance variable
I am encountering a perplexing issue in my SFML game development where my program crashes instantly during runtime when I add a CircleShape as an instance variable ...
0
votes
1
answer
505
views
Implementing a Fixed Time Step?
This has been bugging me for few days now. I'm trying to stop movement jittering in my game. I've looked towards semi and fixed time steps - moving towards the latter below so I can really understand (...
1
vote
1
answer
119
views
Infinite jump issue
I am currently making a game in c++ using sfml, I encountered a problem where if I jump in my game, the jump mechanic allows the player to jump repeatedly in mid-air which is something I do not want. ...
0
votes
1
answer
202
views
How to develop a game on a 2015 MacBook Pro without learning Metal?
I'm on Mac and OpenGL and Vulcan are not supported. Even worse, I'm on a 2015 MBP 13". Yeah, can't do much with that.
I spent a full year learning C++ and I have no patience to try and learn ...
0
votes
1
answer
77
views
c++ SFML Window in std::thread ignore animation
I have a main window whose loop is just in the program and a Window class in which separate sf::RenderWindow objects are created and the loops for them are in ...
0
votes
1
answer
750
views
Should networking and rendering be separated in multiple threads?
I've been trying to code a multiplayer client/server prototype game using SFML's networking.
My server and client use TcpSelectors to wait for a certain amount of time for incoming packets without ...
0
votes
2
answers
259
views
Is there a logical reason for SFML's Vector2 being templated?
The game development library SFML has a Vector2 class template (and a Vector3 for that matter), which can use any arithmetic ...
1
vote
1
answer
445
views
Creating a Renderer class using SFML
I currently have a Renderer class, which as in the example code, looks like this:
...
0
votes
1
answer
411
views
Swept AABB corners collisions
I'm working on a small SFML engine, and i'm trying to implement continuous collisions. It's working great, but the corners are getting detected as collisions and i can't figure out why. I already ...
1
vote
0
answers
440
views
Raycasting floor/ceiling textures sliding
I'm writing a raycasting engine in C++ and SFML.
I have the wall texturing done and I'm trying to get floor and ceiling texturing right.
I almost got it but the textures are "sliding" when ...
0
votes
2
answers
773
views
Defining path for tower defense game
I'm currently developing a tower defense game as a part of a group project in school. This game will be programmed in C++ using SFML. We are having trouble with finding a good way to define the path ...
0
votes
1
answer
81
views
Viewport offset from top also creates a gap at the bottom
I am trying to do something really basic with sf::View.
On a 1280x720 pixel window. I need to place a viewport which is 560x560 with a 160px gap from the top.
What ...
1
vote
1
answer
518
views
Raycasting : computing x position of sprite on the screen
I am trying to create a raycasting engine using C and CSFML, I already have the walls and textures rendering done and right now I would like to be able to render sprites into the scene.
The difficulty ...
-1
votes
2
answers
344
views
Why does the setPosition function in SFML require the x and y arguments both floating-point numbers, not integers?
Why do the coordinates x and y in the 2D game both floating-point numbers, not integers? For example, the SFML setPosition function requires two floating-point ...
0
votes
1
answer
105
views
Does the bee move very fast in the very first frame of the game?
Does the bee move very fast in the very first frame of the game? I think the Clock object when it is declared, the clock starts automatically as this documentation ...
0
votes
3
answers
155
views
Should the coordinates, and rotation angles of all the sprites be stored in variables?
I've learned that magic numbers are bad in code. However, should the coordinates, and rotation angles of all the sprites be stored in variables? Is the convention in game development to leave those ...
1
vote
0
answers
77
views
How should I deal with the use of deprecated features encountered in learning material?
I'm using SFML & the book I am reading has that snippet of deprecated code.
Specifically, it uses the deprecated enum Return value from the keyboard. The newer ...
-1
votes
1
answer
155
views
Are there any practical applications for clearing the screen with a specific color?
Why is it common in the 2D game frameworks for the clear function to have the option of clearing the entire screen with a color? Why is this option available to us? Are there any practical ...
0
votes
1
answer
48
views
What will happen if I intend to display the hidden surface after clearing the window, draw the game objects, and then display the window again?
What will happen if I intend to display the hidden surface after clearing the window, draw the game objects, and then display the window again? Am I watching the drawing process of the objects? Is ...
0
votes
1
answer
73
views
I did changed the text of a graphical text and set its new center origin. Should I reposition it in dead center again?
Should I re-position a graphical text in the dead center again, which I previously do, after editing the text of the graphical text, recalculate its new center origin of the text? I did see that with ...
0
votes
1
answer
85
views
Is it useless to check whether a window is requested to be closed in full-screen mode?
Is it still necessary to check if the window is requested to be closed when I prepare a 1920x1080 window, in full-screen mode? How could the user close the window in full-screen mode, when you could ...
1
vote
1
answer
166
views
When detecting a keyboard key is released. What happened if the key is released at the end of the game loop?
When detecting a keyboard key is released. What happened if the key is released at the end of the game loop, how could the pollEvent function, which is at the top of the game loop, and it is a brand ...
0
votes
1
answer
137
views
Do I have to clear the entire target with a single color every frame?
Do I have to clear the entire target with a single color every frame? I thought the newly drawn ones will overwrite the old ones.
0
votes
1
answer
278
views
When implementing pressing Enter to restart the game, should I use Keyboard::IsKeyPressed or use Event::KeyReleased in some way?
When implementing pressing Enter to restart the game, should I use Keyboard::IsKeyPressed or use Event::KeyReleased in some way? I am afraid that Keyboard::IsKeyPressed will restart the game in excess ...
0
votes
1
answer
275
views
How can I create an instance of an object on mouse click where the cursor is in SFML?
I'm new to coding. I'm trying to make a simple game where you can left click to spawn a salt "molecule" and right click to spawn a water one where the mouse cursor is. I don't know how to ...
0
votes
1
answer
114
views
SFML: Object's shape not rendered on the window [closed]
I want to be able to render sf::CircleShape (representing pointwise charges) when pressing mouse buttons on the window. The problem is easy enough, however the ...
1
vote
1
answer
888
views
Transforming 3D coordinates to 2D isometric position
I'm trying to render isometric maps, my final goal is to render scenes that resembles Snake Rattle 'n' Roll:
So I started by rendering cubes:
For now I have an array with a collection of 3D vectors ...
0
votes
0
answers
73
views
problems with displaying sfml textures
I have created a kind of framework for a game that combines box2d and sfml. All game scenes are stored in the Game class. The scenes also contain information about static and dynamic objects: ...
0
votes
0
answers
202
views
My jump never stops
I'm making a short jump test in SFML. However I have a problem: whenever the jump button is pressed the character will jump but will not fall down, he will keep going higher. However, in the beginning ...
0
votes
1
answer
186
views
1
vote
1
answer
286
views
Storing 2D animation frames and sharing them between objects
I store 2D animation frames in some class.
But the problem is that when I want to create multiple objects for example I want to spawn explosion or enemy
...
1
vote
2
answers
1k
views
Centering Image inside ImGui window causes bug
I've tried drawing RenderTexture directly to the ImGui window and I've stumbled upon a bug. Everything is drawn correctly until I center ImGui Image inside the ImGui window.
Centered Image:
Not ...
0
votes
1
answer
1k
views
How to implement drawing only to the specific area of the window?
I'm trying to implement "canvas" where I will display loaded texture and select specific parts of it so I can put them on tilemap, I'm also trying to add zooming and panning only in "...
1
vote
1
answer
190
views
How to allow infinite custom inputs?
Summary: What approach should I take to allow custom inputs saved in a file be interpreted in the engine?
So I am making a game engine similar to Mugen where I want characters to have their own ...
0
votes
1
answer
270
views
How do I get my sprite to do a regular jump instead of jolt up?
I have been getting into game development and I have made some progress. I have come across an obstacle which is jumping I managed to get the Jumping to semi work but it doesn't look like a jump but ...
0
votes
2
answers
1k
views
Smooth out movement of the snake in a 2d Snake game
I am working on a 2-D snake game in C++ with the SFML library. I would like to smooth out the movement of my snake as it looks extremely choppy currently.
How the Snake moves
The snake is made up of a ...
0
votes
1
answer
364
views
SFML test app feels slow/clunky
Similar to this question https://stackoverflow.com/questions/33904998/sfml-extremly-slow-irregular-framerate, I have created a small program to experiment with SFML
I have a very simple SFML test ...
0
votes
2
answers
216
views
How do you disable frame skips in a game, in SFML preferably
by frame skip off i mean that the game should just slow down if the fps drops, just like in terraria, i got this code currently and want to implement it to it:
...
1
vote
1
answer
177
views
What is the process for porting my game SFML from Windows to Mac
I've recently finished version one of a simple arcade game I've been making in SFML. I've already spent months on the physics engine and game, and I'm wondering how much time it will take to port it ...
2
votes
0
answers
172
views
How can an Entity trigger changes to the world in C++?
I'm writing a simple physics based game in C++ using SFML. I want to trigger a scene change when my playerCharacter collides with a door. Since C++ does not have any native Event Sender/Listener ...
2
votes
1
answer
104
views
Tilemaps are loading differently each time
Tilemap data is stored in a 2D array.
It is saved using the following code
...
0
votes
0
answers
90
views
Instance vs individual updating
I am making a game in SFML, and whilst I was making an AI moving system I was wondering which would be better, If I was to instance update all my entities at once, or individually update them via a ...
0
votes
1
answer
176
views
Chunk Culling system causes deltatime to slow down
I am making a 2D top-down game in C++ and the graphics library SFML.
I have designed a chunk system by myself and have successfully made it so that when a chunk is off-screen, it isn't rendered, to ...
0
votes
1
answer
131
views
Confused, maybe the mistake ik is the foreach loop
I dont know why but my jump method does not work. My character can only jump on one single object. The other obstacle haven't any influence on the player. I really don't see my mistake
...
0
votes
0
answers
423
views
Graphics look blurry in SFML
I'm working on a 2D game using SFML and many textures (which I'm loading from PNG files, created with Gimp) I use are appearing blurry. They're being drawn without any kind of scaling and ...