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

learn more… | top users | synonyms

1
vote
0answers
12 views

Problem to change window view dragging the mouse

I'm having a bad time trying to change the window view by dragging the mouse. I can precisely do that with the method: void PlayScreen::MenuView(sf::RenderWindow& window) { while ...
1
vote
0answers
69 views

Creating random nebulae for scrolling space background

If you've ever seen a picture of space, you'll most likely see that there is some kind of pretty nebula in the background. I would like to find out how I could create random, semi-realistic looking ...
0
votes
1answer
22 views

Polar movement towards cursor sfml and c++

I got smooth movement down moving based on the window but I wanted to see if I could move my sprite to my cursor when I pressed w instead of just in the -y direction but everything went wrong right ...
-1
votes
1answer
27 views

Cannot link SFML to my project in code::blocks [closed]

If anybody uses SFML, could you tell me how to add it to a project in code::blocks? Any technique will do.
3
votes
1answer
70 views

Porting a SFML game to the browser? [closed]

I've been messing around with SFML, it's my first experience with C++ and I'm enjoying it. But I'm wondering how to publish my game onto anything other than a native platform. Noting that this is my ...
0
votes
1answer
73 views

What's better - drawing every interval that the window updates, or drawing when necessary and updating when drawing?

So what's better? In case the title is a bit confusing I mean: 1) Drawing every window update interval. For example, for a 60FPS window, every 17 milliseconds. For example: ...
1
vote
1answer
96 views

2D World - How to represent my Game Objects graphically?

I want to code my own topdown 2D game with SFML+C++ that later shall have multiplayer functionality. Therefor I want to seperate the graphical and logical Parts of my game. All of my ingame Objects ...
0
votes
2answers
41 views

Traversing a pre-defined path with a delay in SFML - C++

I want the player to move smoothly & slowly through a vector of co-ordinates that define a path, below is an illustration of what i mean. [P][ ][ ][ ][ ] [.][ ][ ][ ][ ] [.][ ][ ][ ][ ] [.][ ][ ...
0
votes
1answer
22 views

sfml/opengl, two objects of same class are sharing variables

whenever I use the none-default constructor, it only adds to the coordinates of the previous class(in an array) wall_1x1 wall[2] = { wall_1x1(0, -2, 0), //first argument is x, second z, and ...
0
votes
1answer
37 views

Box2D - Platformer tiled map problem

I'm using C++, Box2D and SFML. I convert a Tiled map to world in my platformer game and I get stuck when I go against a block when I go forward like that : I can use a circle as foot of my ...
0
votes
1answer
84 views

Tile map collision C++, SFML

My problem with the collision here is more to do with how to decide which tile the player is in. Each quad of the map is 16 pixels squared (Vertex array), and the player moves in 1 pixel jumps. ...
-1
votes
1answer
83 views

C++ SFML and Box2D: Move world or move player?

I'm currently making a top-down shooter game and it's my first time developing with SFML. I came across and issue and I want to know if there is a better way to solve it. I need to get the "camera" ...
1
vote
1answer
81 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
49 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
76 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
95 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
121 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
62 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
1answer
74 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
271 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
49 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
117 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
246 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
92 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
107 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
113 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
64 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
101 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
375 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
136 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
149 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
59 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
121 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
216 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
461 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
128 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
654 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
127 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
180 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
79 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
92 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
163 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
96 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
170 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
175 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
178 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
449 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
144 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
230 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 ...