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
30 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
520 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
1answer
221 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 ...
1
vote
1answer
77 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 ...
0
votes
0answers
8 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 . ...
1
vote
2answers
258 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
0answers
34 views

Sfml c++ scrollbar

Im making a program and i need to create a scrollbar class.My prgrams screen is 1200x800;The size of the little left arrow and little right arrow is 15x15; I calculate the width of the scrollbar in ...
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
28 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
48 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 ...
0
votes
1answer
59 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 ...
1
vote
3answers
128 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
151 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
31 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
45 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 ...
4
votes
0answers
72 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 ...
0
votes
0answers
78 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
45 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
86 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
117 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
82 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
132 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
115 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
42 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
60 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
36 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
72 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
73 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, ...
3
votes
1answer
105 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 ...
0
votes
1answer
38 views

SFML RectangleShape won't render

I have a sf::RectangleShape in my code which is defined like this : sf::RectangleShape shape_1; And it's values are set like this : shape_1.setFillColor(sf::Color::White); ...
0
votes
1answer
39 views

SFML dynamically loading images

So I'm screwing around with c++ and SFML, when I thought to myself the following: If the images are compiled into the executable, with enough sprites for the game, memory might become a problem at ...
0
votes
2answers
101 views

sf::RectangleShape's position is not same as I set it to

When I try to print my box.getSfShape()'s position it does not print out the position I set it to have. ( The box.getSfShape()'s position is by default set to 0 ) Wrong output : ( printing the ...
15
votes
3answers
3k views

Should I use a database for storing game content? [closed]

I have a 2D Game written in C++ using SFML. I want to make the game expandable in such a way that content like items or entities could easily be added by adding a line/entry/row to a file or ...
2
votes
2answers
65 views

Should I be returning weak/shared_ptrs or unique_ptr's to my resources?

A friend of mine told me instead of normal pointers, I should use unique_ptr, i asked him why unique_ptr's if some resources are going to be shares, like multiple grass tiles, or enemies. I currently ...
2
votes
1answer
217 views

Why do my Box2D bodies not fall, even though world.step is called?

I have SFML set up with a Box2D world that has gravity, but my bodies won't move. I std::cout'ed the position of the body in the game loop, but it's always at (0, 14)! No errors or warnings, just no ...
16
votes
6answers
4k views

How do I correctly use singletons in C++ engine programming?

I know singletons are bad, my old game engine used a singleton 'Game' object that handles everything from holding all data to the actual game loop. Now I'm making a new one. The problem is, to draw ...
1
vote
0answers
52 views

What game development tool can I use on a computer that does not support shaders? [closed]

I tried SFML, but found out that my computer does not support shaders. Given this restriction, what could I use instead?
0
votes
0answers
54 views

Trying to get Box2D bodies to fall [SFML, Box2D, C++] [duplicate]

As the title says I'm trying to make my Box2D body to fall, but it won't work. It just stays at the same position. Sorry for the long codes but I have no idea where I'm doing something wrong, so I ...
1
vote
1answer
155 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
80 views

Strange artifacting with textures (Pseudo 3D)

I'm using SFML to make a pseudo 3d engine (Technically not software rendered since SFML uses OpenGL) and things are going rather swimmingly, but then I tried to make another wall, the picture says ...
1
vote
2answers
129 views

FPS drop when detecting collision (sfml, c++)

So, I have this small class with a collision detection function in it, it's called every frame. When I run the game I get around 8000 FPS, but when the collision function gets called it drops to ...
0
votes
0answers
207 views

Setting Up A Visual Studio 2015 Android C++ Project To Utilise The SFML Library And compile On An Android Device

So in Visual Studio I have installed the cross platform tools to set up a C++ project for Android and iOS such as the Android SDK, NDK and the corresponding USB drivers required to debug the program ...
1
vote
1answer
88 views

Method of handling audio and memory in game

I've started coding a new game project and I've implemented Ogre for the graphics rendering and begun thinking about the audio side of things. I was considering using the SFML audio component for ...
61
votes
9answers
13k views

How can you put all images from a game to 1 file?

I've just finished a basic RPG game written in C++ SFML, I've put a lot of effort into the game and I'd want to distribute it, however I've ran into a small issue. Problem is, I have well over 200 ...
1
vote
1answer
2k views

undefined reference to std::__throw_out_of_range_fmt

after some time with oxygine i have decided to start learning SFML, i configured codeblocks to link the header files and .so files, and whenever i try to compile i get this error: ||=== Build: Debug ...
3
votes
1answer
94 views

Testing SFML sf::Touch on ordinary PC

So I’ve created a small app that is designed to be used on smartphones and tablets. Accordingly the app makes use of the sf::Touch class which determines the point on the screen of the device that the ...
0
votes
1answer
125 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 ...
1
vote
1answer
49 views

sf::Shader not working properly on texture

I'm having trouble getting my sf::Shader to work on an sf::Texture that I've drawn myself. The vertex shader is pretty standard (I think it's just a copy of the example from SFML's page). The fragment ...