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

learn more… | top users | synonyms

0
votes
1answer
20 views

Limiting framerate with a fixed timestep

Hi I'm learning how to create a 2d platformer in C++ using the SFML2 library. My current goal is limiting the game's framerate. SFML2 has a window.setFramerateLimit(unsigned int limit) function for ...
1
vote
1answer
35 views

Correct way of managing player states?

I'm a relatively new programmer attempting to create a simple 2d fighter for fun using the SFML 2 library. As a game with interaction dependent on what the character is doing, using a state system ...
1
vote
1answer
44 views

C++ SFML: Font is clear and the other time blurred

This is my code. TextRenderer->setString(pCurrentUnit->getCHAR()->getNAME()); TextRenderer->setCharacterSize(16); TextSanitizer::CenterOrigin(TextRenderer); TextRenderer-&...
3
votes
1answer
119 views

OpenGL App not setting cursor position appropriately

I have written a small application using OpenGL, and have implemented some rudimentary camera controls. Unfortunately, I cannot get the application to set my cursor position correctly. The cursor is ...
1
vote
0answers
33 views

C++ SFML: Keypressed Event not registering half the time?

I have a very simple event handeling system at the moment. void LevelScreen::PollInput() { sf::Event event; while (pWindow->pollEvent(event)) { if (event.type == sf::Event::...
1
vote
1answer
92 views

QT SFML Integration Trouble

I have been having trouble linking sfml to qt creator I have downloaded the pre-compiled libraries and headers for MINGW on the sfml website here : http://www.sfml-dev.org/download/sfml/2.3.2/ This ...
2
votes
0answers
41 views

SFML Raycasting Problem: Textures not displaying propely

I have been lurking on gamedev.Stackexchange for a while now and finally have a question to ask. I have been working on a simple raycasting engine (like wolfenstein 3d) using the SFML Graphical ...
1
vote
1answer
49 views

What's a way to improve this wall collision detection code to keep objects within a perimeter made of these walls

// Player Collides with Wall counter1 = 0; for (iter60 = wallArray.begin(); iter60 != wallArray.end(); iter60++) { if (Player1.rect.getGlobalBounds().intersects(...
0
votes
1answer
57 views

How to create animation using sprite sheet in C++ and SFML 2.0?

I was wondering how do animation using a sprite sheet. I have a sprite sheet and the size is height:400 width:601 The code I am using is: #include<SFML/Graphics.hpp> #include<iostream> ...
1
vote
1answer
73 views

Simple 2D Platformer Collision Detection?

I'm relatively new to programming and I am attempting to write a 2d platformer in C++ using the SFML library. The structure of my code is that I have a Stage class which contains a vector of sf::...
1
vote
2answers
427 views

Animating isometric sprites

I'm having trouble coming up with a way to animate these 2D isometric sprites. The sprites are stored like this: (Game Folder Root)/Assets/Sprites/(Sprite Name)/(Sprite Animation)/(Sprite Direction)/(...
0
votes
1answer
48 views

OpenGL vbo black screen

I am using sfml with opengl and using glew Here is my code: // MainWindow.cpp // window is declared outside in the class it is a sf::Window #include "MainWindow.h" #include <iostream> //#...
1
vote
0answers
23 views

SFML Texture issue removing from memory

I am currently working on loading tmx levels into my game, all is going well and i have layers being loaded textures being loaded and all the data being loaded such as level name, tile sizes etc. The ...
1
vote
0answers
94 views

Isometric map (2D) - Click detection - Mouse mapping - How to implement it? [duplicate]

I'm building an isometric engine. I use TILE_SIZE * TILE_SIZE (minecraft like) tiles. (I'm using 64 * 64 tiles but I can change the number when I want) I can access for each tiles to this ...
0
votes
1answer
56 views

csfml wait event

I would like to spawn a separate thread to deal with inputs using c and sfml. I made a prototype that waits for input in main() and it works fine. I made a prototype that spawns a new thread and waits ...
4
votes
2answers
537 views

Jittery Movement, Uncontrollably Rotating + Front of Sprite?

So I've been looking around to try and figure out how I make my sprite face my mouse. So far the sprite moves to where my mouse is by some vector math. Now I'd like it to rotate and face the mouse as ...
0
votes
0answers
58 views

GUI, interface/listener equivilent in c++

brief intro I am currently working on a game engine using SFML for a small project, Coming from Java I know a fair bit but unfortunately I have come across a lot of snags (to be expected when ...
1
vote
1answer
80 views

C++ class hierarchy issue [closed]

I am taking the step of moving on from Java over to c++, I have been working on my own custom game engine in java for a while so have a good understanding of polymophism, inheritance etc. Now to the ...
2
votes
2answers
323 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. ...
0
votes
2answers
97 views

2D top down RPG animation architecture problem

I have a problem with my sprite animations right now. I have different animations and sequences for each character so an specific archer might do a ranged attack in which he just plays one animation ...
3
votes
1answer
142 views

Reorder a set of points in order to draw a triangle fan (example)

I'm doing a light engine (c++, using sfml), and to connect the light vertices, I thought about drawing a triangle fan. Here is a representation of a triangle fan (sfml documentation): The ...
1
vote
2answers
93 views

Drawing a level in SFML (C++)

So in an attempt to move out of the console environment I have set up an SFML poject in Visual Studio. I am currently trying to draw a stage from a vector within a vector (Matrix?), and the results ...
0
votes
1answer
271 views

AABB Collision Problems in SFML

I have a problem with AABB collision. I am making a top down rougelike in SFML and my collision algorithm does't quite work properly. HERE IS A GIF OF THE PROBLEM. It mostly works, except for when ...
9
votes
1answer
170 views

Screen tearing in fragment shader on R9 380 GPUs

two players are encountering an issue with my game where the screen is tearing when it uses a fragment shader but it only seems to be doing this for players with a R9 380 GPU. Here is what it looks ...
1
vote
0answers
68 views

Anti-Aliasing + Atlas Texture + VBO = nasty looking artifact

With my research I have found that using a VBO to render graphics is much faster than using depreciated OpenGL. I've found with this that you can't switch textures mid VBO render, so if I have ...
-1
votes
2answers
55 views

SFML Increasing random falling meteors [closed]

Im working on a small project where i have to creat a 2d game using C++ and SFML (it wasn't my choice to use them) i did every thing like creating the ship ,shooting ,score counter ..etc i managed to ...
2
votes
1answer
162 views

How i can make better jump to my game? - C++ SFML

So, I ask question about my 2D game, actually it is not game, but it is something like poor game. Well i made moving system and now is time to make jump. I made some kind of gravity with tutorial but ...
0
votes
0answers
16 views

Config SFML in QTCreator with file.pro

I know that are a method with cmake , but i wouldlike config my project in Qtcreator usinig qmake and my doubt is what my file .pro must have for work it ?. I will run in windows , maybe later linux . ...
0
votes
3answers
1k views

How does one load TMX files into a SFML game?

How does one load .tmx files from Tiled into a SFML game?
0
votes
0answers
32 views

Jumping to tiles in y coordinate before displaying all tiles in x?

I am learning how to load in tile maps and I have successfully done so, sort of. The problem is that the program is jumping to the tiles in the y coordinate before displaying all the tiles in the x. ...
0
votes
1answer
78 views

SMFL C++: IntRect intersection not working?

I'm trying to find free space to place rectangles, but even though I check for a collision using .intersects(), it still places them through eachother and somehow doesn't see the intersection ...
1
vote
1answer
266 views

how to port my game for android in sfml [closed]

i am a c++ programmer , and I want to develop games . I chose sfml , because I wanted to see what happens behind the scene better . I have an idea to make , and the desired platform is mobile devices(...
1
vote
3answers
145 views

Get the tile that my mouse pointer is currently over?

I want to get the tile that my cursor is over in my game. I did some googling though most of the examples we're in other languages/libraries and if they weren't, they didn't work for me because I use ...
0
votes
2answers
275 views

SDL or SFML: which is the best option if I only want to use OpenGL for my graphics? [closed]

I've read a lot about creating graphics with OpenGL in SDL and SFML over the past few days, and I want to know which one I should pick. As mentioned in most of the things that I've read, both allow ...
0
votes
1answer
37 views

What causes SFML pollEvent to segfault here?

I'm writing an SFML application in C. Currently sfRenderWindow_pollEvent() and sfRenderWindow_waitEvent() always segfault. Here's the cleaned code that shows the issue. sfRenderWindow* window; ...
1
vote
1answer
57 views

How can I avoid referring directly to the state type when transition to new states in a state machine?

I finally found a good way to implement a "stack-of-states" to manage what screen I am on. Minimal example: class gameEngine { public: //Removes state at the "back" of the stack and puts the ...
1
vote
1answer
86 views

Buttons implementation with regards to a basic Game Loop

As the title states I am creating a game with SFML being the only library used. I am entirely unsure how to go about this. I want the buttons to be activated by simple mouse clicks (when the mouse ...
0
votes
0answers
86 views

How can I improve my ray casting algorithm

So I finished coding this ray casting algorithm in C++ and I feel like it could be improve, despite that, I believe that it is really good since it is coded using SFML. Here is the algorithm in C++ ...
1
vote
1answer
52 views

AntTweakBar doesn't register SFML mouse events

I'm trying to add GUI for easier level editing in our game engine. We're using SFML for all the basic stuff (window management, input events etc). I've chosen AntTweakBar because it is a well known ...
0
votes
1answer
147 views

Port forwarding client and server?

So, lets say i have a client and server sending information to each other. Do i have to port forward both the server and the client, or do i just port forward the server? If i have to do both, is ...
0
votes
0answers
169 views

How do I draw a tilemap in SFML (C++)?

I've been working with SFML and I've used what I know to try and create a TileMap. However, opening the RenderWindow will only display a black screen and the image I have loaded in the files will not ...
0
votes
1answer
84 views

Can't set color of returned sprite? [closed]

So, I have some variables in my game : This is all the tiles in my game / the map. std::vector<Sprite*> tiles; This is the sprite variable which I have in a custom Sprite class. sf::Sprite* ...
0
votes
1answer
41 views

Terrain Generation - Only draws first sprite and last row on the X axis

So, I have a problem where I'm trying to loop trough columns of sprites, that later will be drawn to fill a specific area. But it only renders the first sprite and the last row of sprites on the X ...
0
votes
1answer
154 views

Looping trough a std::map won't work [closed]

Answer : Turns out the for loop did work. Lesson Learned : You might want to try putting something in it to see if the code inside actually executes.... As the title says I ...
1
vote
3answers
123 views

How to keep track of elements inside a std::vector?

Let's say I have a std::vector with sf::sprites and my maps are auto-generated. Then you won't know which element is which sprite. Example : I want THAT tree sprite to be removed, but I have no ...
0
votes
1answer
68 views

Error : No default constructor exists for “Sprite” [closed]

What i want to do is make the Player class inherit the Sprite class. So I inherited it like this : class Player: public Sprite {}; But when I go to my Player.cpp I get the following error : ...
0
votes
0answers
74 views

Can't display sf::text using custom class, crash

I have my own Text class which uses sf::Text to display text on the screen. First I couldn't get the text to display on the screen, my solution was that I forgot to give the text a font before ...
0
votes
1answer
42 views

Texture becomes white box when drawing it?

My problem is that when I try to render my sf::Sprite it only renders a white box in my window. I did some reading on this and couldn't really find anything that helped. Some said that it's because ...
0
votes
1answer
117 views

Unhandled exception at 0x0FE62707 (sfml-system-d-2.dll)

So, turned on my pc today thinking I we're gonna continue making my game but got denied by this error. Have no idea how to fix it and why it's there at all, I haven't touched my project properties in ...
-1
votes
1answer
89 views

Game crashes when trying to access function inside of a class, inside of a vector

So, I have a object, inside of a vector and I'm trying to call a function in that object : std::vector<Box>entities; entities.insert(entities.begin() +1, Box(&world, b2Vec2(Camera....