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

learn more… | top users | synonyms

1
vote
1answer
57 views

Event-/Input system with SFML: Cannot move diagonally in 2D

I am a beginner in anything with game development. I written a small prototype in which i can move a square around with the arrow keys. For that i use SFML. At the moment i experiment around with my ...
1
vote
1answer
31 views

SFML Library Not Rendering Sprite Texture Updates When Accessing Sprite From Lower In Framework Heirarchy

So currently I am working on a framework for a game utilising the SFML graphics library and in one of the classes representing a renderable object in the framework there is an sf::Sprite that is used ...
0
votes
1answer
67 views

Working but flawed bullet spread (vector math)

I'm trying to implement random bullet spread into my game, and I've managed something that works, but is consistently flawed. The spread doesn't vary depending on the distance the mouse is from the ...
0
votes
1answer
74 views

Deferred Rendering with SFML

I've been looking to implement a deferred rendering system in SFML. I've read the tutorials on OGLdev for it, and I was wondering how to draw a scene built in SFML (sprites, text, etc) to the ...
0
votes
1answer
72 views

Slow tile map rendering

I'm having an issue with my tilemap renderer, with small maps (like 40*40 tiles) it works fine but with maps that have 400*400 tiles the framerate becomes really slow when I try to move the camera. ...
1
vote
1answer
57 views

Will Frame Independant Movement break collision

Using my game loop to give my game movement which is independant from the framerate, has been working fine for me but, I've started to consider my games running on machines which cannot keep up with ...
0
votes
0answers
50 views

Implementing a 2D Collision method that can tell direction of collision (boxes)

Been searching for quite a while now and really struggling to find an easy way, or a good tutorial on how to create a collision detection system which can indicate what side on a box a collision has ...
0
votes
5answers
159 views

How to properly pass sprites to a std::vector without destroying the sprite's texture in SFML?

From the official SFML tutorials, The White Box Problem:- "When you set the texture of a sprite, all it does internally is store a pointer to the texture instance. Therefore, if the texture is ...
0
votes
1answer
45 views

No RenderWindow class in SFML?

In their official tutorials it is said that to draw graphics on screen, i have to use RenderWindow instead of Window. But when i write sf:: RenderWindow window, error pops up saying that there is no ...
0
votes
2answers
107 views

How to keep a shape inside a rectangle

So i'm making a game which is based on randomly generated rooms and i need a way to keep the player inside them and make the player glide when he collides with the room's bounds. I currently have a ...
3
votes
1answer
207 views

How do I create a multiplayer server also suitable for local single-player?

I've created a voxel game in C++, OpenGL and SFML, and I want to make it multiplayer. I'd like to make it similar to Minecraft's client-server model: The single-player is just a client to the hidden ...
-1
votes
1answer
83 views

How can i fix my Ground detection code?

My ground detection works by checking if the player's x position is between the range of a sprite xpos+16 and xpos-16 if it is,then it uses a separate axis theorem on the y axis to see if the player ...
1
vote
2answers
102 views

Can't find out why aren't those collisions framerate independent

I'm making a 2D Platform game and I'm having trouble with my collision detection. It doesn't seems to be framerate independent even though I used deltatime there. The problem is that at 60fps, a ...
0
votes
1answer
84 views

SFML drawing Tiles low fps

int main() { sf::RenderWindow window(sf::VideoMode(800, 800), "SFML works!"); sf::VertexArray Tquad(sf::Quads, 40*40*4); int size{ 20 }; int width{ 40 }; for (int x = 0; x < width; x++) { for ...
0
votes
1answer
48 views

Why is each column being shifted down the X value of the column in my 2D Data Structure?

I have a two 2-dimensional arrays. One of which stores characters from a text file, and the other stores pointers to instances of Blocks. For some reason, in either of the arrays (I'm not sure which), ...
0
votes
3answers
97 views

2D Box Collision Trouble

Hello I am trying to handle some simple box collision (axis-aligned) in my top-down 2d game, but running into a problem. My game is running at a fixed time step, and checks for player-wall collision ...
0
votes
3answers
213 views

SFML game loop and FPS problems

I've been building an SFML engine and I've been very confused on the FPS, frame independent movement and game loop. My particular problem is that I have a variable set to 60 for the frame limit but ...
0
votes
1answer
97 views

Sorting sprite's layers in isometric view

I'm making a strategy game with isometric view and I'm having some problems with deciding which sprite should be drawn first (I'm using SFML 2.2 as graphic library). I'm using std::sort to sort ...
1
vote
1answer
141 views

C++ Frogger game - Logs on Water bounding boxes?

I am making a Frogger game in C++ using SFML but have come across a problem. I have a block of water and log rectangles moving over it (All sprites) and would like the Frog sprite to do something when ...
0
votes
1answer
51 views

Extra sprite spawning when the enemies are redrawn SFML

I am making a game in sfml and at the moment when all of the enemies die. They are set to respawn however when this is happening they are respawning with one extra sprite than before. The code for ...
0
votes
1answer
90 views

Moving a Sprite using Mouse in SFML (setOrigin logic needed)

I trying to make a card game using SFML. I want to move the card relative to the position the player selects on the card. I managed to check if the card is pressed. However, when I click and drag, the ...
0
votes
1answer
156 views

Handling (spawning/removing) entities in SFML

I am unsure which method to use to handle my enemies in SFML. The idea that I am trying to recreate is to spawn enemies every so many seconds. Initially I wanted to do this using a vector such as ...
1
vote
1answer
269 views

How can I do sprite batching in SFML?

I'm new to game dev and using SFML. I need to use lots of sprites at the same time, so I will probably need sprite batching. I know that sprite batching is used to draw multiple sprites with a single ...
1
vote
1answer
111 views

How can I hide game asset files in my release build?

My SFML 2.0 release build has a file path to game assets relative to the .exe file, so folders such as Fonts, SoundEffects, etc. are explicitly listed in Windows Explorer with the .exe. I'd like to ...
1
vote
2answers
349 views

How do I create and implement a sprite sheet for my SFML game?

I have a game I am currently working on, and I have created 6 16 frame animations for my player character. Currently each of these are saved as seperate .jpg files, which are about 1.5x bigger than I ...
0
votes
0answers
96 views

Preferred way to integrate box2d with SFML

I'm trying to integrate Box2D with sfml. My current solution is to have overloaded functions creating sfml shapes from box2d fixtureDef shapes. I store created sfml shapes under the name 'visual' in a ...
0
votes
1answer
130 views

Drawing faded lightmap in 2D polygon

I have been making a 2D visiblity algorithm by following this tutorial http://simblob.blogspot.se/2012/07/2d-visibility.html I have managed to create the light vertices and it works fine when I draw ...
0
votes
1answer
62 views

Using Box2D for soccer physics

I've learned quite a bit of Box2D and I've succeeded basic stuff concluding ball physics. I want to implement 'opposing forces', as the character kicks the ball with a certain strength, with the leg ...
0
votes
1answer
73 views

How do I center the view around specific coordinates in SFML

I want to use sf::View in SFML in order to change the position of the view, such that the player sprite is always in the center of the screen. Thus I want to write a function which allows me to input ...
0
votes
1answer
121 views

Can I display text in SFML without setting a font?

I'm trying to render text without setting a font. #include <SFML/Graphics.hpp> #include <iostream> using namespace std; string culoare; int main() { sf::RenderWindow ...
0
votes
1answer
74 views

SFML - How do I create an OpenGL context before showing the window?

I want to create an OpenGL context to initialize some assets before actually showing the window with SFML. How can I do this?
1
vote
1answer
152 views

Static SFML 2.2 libraries and Code::Blocks on windows 7 [closed]

I am starting to program games for the first time, but I've been doing general programming for a couple years now. I have Code::Blocks, which I am fairly comfortable with, but now I am struggling with ...
0
votes
0answers
137 views

Scrolling background loop however produces little gaps

I have myself a parallaxing background, i'm using SFML to render my background, I have myself 3 sf::Sprites, each sprite has the width of 576, I create myself 3 sprites with x positions 0, 576 and ...
0
votes
0answers
160 views

Alternative to a timer in a separate thread in a turn-based game

I'm making a 2d turn based game and I'm having some difficulties with the timer itself. 3 characters vs 3 characters, two players. A timer giving them a chance to preform acts within a set amount of ...
1
vote
1answer
403 views

Problem with update/render in game loop (scrolling view, render interpolation)

I use SFML 2.2 and program a 2d prototype game (2d mario style where the camera follows the player). I am experiencing the buggy imagery during rendering, for example a chunk of vertex array blocks ...
0
votes
0answers
58 views

SFML - Rendering a torch with a fire animation [duplicate]

I have coded a 3D maze simulator in SFML using raycasting. However, I want to add a torch to the screen, so that the lighting seems more realistic. From my understanding, I would have to use ...
0
votes
0answers
121 views

C++ - SFML - OpenGL - GLSL - smooth waving texture

I have this shaders: Fragment: uniform float time; uniform sampler2D texture; void main() { float t = time; vec2 aux = gl_TexCoord[0].xy; // This would also make waving/deform the ...
0
votes
2answers
215 views

Collision Direction Detection

I'm making an RPG game where players and enemies can collide with walls. Right now it pushes the player off the wall when he tries to 'go through' it. However, I detect which way he should be pushed ...
1
vote
1answer
78 views

How can I fix user input for this pong paddle?

I have been having trouble with my pong paddle - It responds to user input as if it was typing. Sometimes, people try to react to KeyPressed events directly to implement smooth movement. Doing so ...
3
votes
1answer
282 views

How to read neighbor pixels in GLSL?

I'm using SFML 2.1, it's much more straightforward for me so I can jump directly to learning the shading language. I'm trying to do something similar to conway's game of life. I already learned that ...
0
votes
1answer
138 views

Can't seem to get Sprite to face left in sfml c++

I am having some small issues getting my sprite character to flip around. Basically I have a character that can walk to the right.. I am looking to flip it so that it looks like it is walking left. I ...
3
votes
5answers
386 views

Is it bad practise to have an object for every tile?

In the game I am working on, many of my tiles must have special attributes (such as triggers when the player steps on them). I was wondering if it would be bad practise to create an object for every ...
2
votes
0answers
149 views

Problems with instaling SFML [closed]

I've followed the instructions on installing SFML on the website to the letter. But, I get this when I try to build the sample program on the same page using Code::Blocks. ...
0
votes
0answers
133 views

How do I scale a Spine animation at runtime?

The spine docummentation shows how to scale the skeleton when loading. Is it a must to reload the skeleton to scale the animation while playing it?
2
votes
1answer
170 views

How do I pause a single bone with spine?

I'm using spine along with SFML. I have a character that is always animated. When he shots, I set an animation that affects only his arm. The arm goes up, but I need to stop this animation in the ...
-2
votes
1answer
284 views

GLSL- How to change a certain color of a sprite, to another color passed into the shader?

There are sprites, with certain pixels being bright pink, and a shader dyes these pink or grayscale pixels to a custom color determined by the player. For example, a character looks normal except for ...
0
votes
0answers
101 views

OpenGL textures trigger error 1281 if SFML is not called

I am using SOIL to apply textures to VBOs, without textures i could change the background and display black (default color) vbos easily, but now with textures, openGL is giving an error 1281, the ...
0
votes
2answers
181 views

SFML: Monster following player on a straight line

I've searched for this and found a few topics , usually they used a function normalize and using simple vector subtracting which is ok , but how should I do it in sfml ? Instead of using: Movement = ...
0
votes
0answers
50 views

How does character creation work in 2D games? [duplicate]

My question is how does character creation work in (multiplayer) 2D game? For example player wants to have long yellow hair, black armor and white leggings. What should I do? Already have all ...
1
vote
1answer
95 views

Henry Hatsworth kind of blocks minigame, std::vector sorting or alternative?

I'm not sure if this is the right place to post this, or if I'm doing it right. But I believe I've kept to the rules. If not, please let me know and I'll remove my post or edit it accordingly. I'm ...