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

learn more… | top users | synonyms

0
votes
0answers
19 views

Setting up SFML and Box2D at the same time on VS2013 [closed]

How do I add SFML and Box2D at the same time and both workable, while I can add them independently after I put them into the same project one of them doesn't seem to work.
-3
votes
0answers
36 views

How to display a error/message box? [closed]

As the title says I would like to know how to display a error box without needing to download any more libraries. I would like it to look something like this : I've google'd some and I could ...
0
votes
1answer
50 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
34 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
76 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* ...
1
vote
3answers
89 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 ...
1
vote
1answer
40 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
1answer
34 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
108 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
101 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
30 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
43 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
32 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
46 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
62 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, ...
0
votes
1answer
34 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
32 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 ...
3
votes
1answer
92 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 ...
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 ...
0
votes
2answers
99 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 ...
2
votes
1answer
198 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 ...
2
votes
2answers
54 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 ...
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 ...
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 ...
0
votes
1answer
71 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
0answers
49 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?
1
vote
2answers
98 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
88 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
77 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 ...
1
vote
1answer
626 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
59 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 ...
1
vote
1answer
41 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 ...
1
vote
1answer
111 views

SFML Trying to shoot bullets but it moves with the gun

I'm pretty new to SFML and C++ and I'm trying to figure out how to shoot bullets. I've done the shooting part and it's origin is from a moving shape controlled by the user called Player. The problem ...
0
votes
2answers
97 views

Problem designing my pseudo-3D game with SFML

I am designing the game so the objects I create (Character, Enemy, Enemycast...) can inherit all from Collider SpineDrawable // Sprite // AnimatedSprite D2D // D3D Both D2D and D3D inherit from ...
0
votes
1answer
45 views

OpenGL: Objects wont draw at certain angles while using lighting(shaders)

I was following this tutorial (http://www.lighthouse3d.com/tutorials/glsl-12-tutorial/point-light-per-pixel/) but when the camera is at a certain angle, if I had alpha test and blend enabled the cube ...
15
votes
2answers
2k views

How to avoid ghosting when pressing multiple keys?

I am working on a 2d side-scrolling pc game that uses SFML game library. The problem that I am not able to solve is that in many keyboards combination of three or more keys (like w + d + k) is not ...
1
vote
1answer
72 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 ...
1
vote
1answer
67 views

Basic game loop, what does Update() and HandleInput() mean to you?

I have been developing a game and until now I have been handling input like so: Player presses a key HandleInput() acknowledges a key is pressed calls a function within the Player class which ...
2
votes
1answer
60 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
128 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
29 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
40 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.
5
votes
1answer
227 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
93 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: ...
2
votes
1answer
194 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
63 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
28 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
78 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
253 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
188 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" ...