Simple and Fast Multimedia Library - a free, portable API that provides access to graphics, input, audio, etc.
1
vote
1answer
40 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
19 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
23 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
56 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
58 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
41 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
54 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
58 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
44 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
94 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
26 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
36 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.
4
votes
1answer
128 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
85 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
162 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
50 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
26 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
59 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
166 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
146 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
123 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
61 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
91 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
111 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
159 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
64 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
108 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
508 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
56 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
130 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
273 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
99 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
110 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
147 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
3answers
105 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
558 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
163 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
154 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
72 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
154 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
275 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
614 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
141 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
1k 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
153 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
248 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
95 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
126 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
230 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 ...