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

learn more… | top users | synonyms

2
votes
0answers
30 views

Perlin Noise unwanted artifacts

I am trying to write a perlin noise class with c++ and sfml, but I am experiencing unwanted visual artifacts in the output. In the image, there are obvious lines being drawn between the points of the ...
2
votes
0answers
44 views

Problem with collisions with tiles, using AABB

After having a little look around about collisions. I can't seem to find what i'm doing wrong every time i touch the bottom of the tile it send's me through it and throws me out to the right of the ...
1
vote
1answer
47 views

vector subscript out of range

I'm trying to setup a 2d game and have been thrown up an error on vector subscript out of range. I've been trying to look up about it, but have not seen anything that helps. If someone could help and ...
-1
votes
0answers
41 views

SFML game is very laggy with cpu spikes

I've been trying to learn SFML and it is running very laggy. When I look at the monitor in Visual Studio, I see the CPU usage spiking from 1%-7% constantly. So I think some of my code is bad or I'm ...
0
votes
1answer
39 views

SFML collisions

I'm needing help with the collision response of my player "Mario". I would like my player to be able to stand on the tiles that i add if he jumps as well as collide wit them if he walks into them i'll ...
0
votes
2answers
75 views

sfml drawing text c++

using visual studio 2015 and SFML . relevant code: sf::Font font; font.loadFromFile("Arial.ttf"); sf::Text text; text.setFont(font); text.setString("hello "); _mainWindow.draw(text); It doesn't ...
0
votes
1answer
98 views

Where do I handle my input in a basic game loop?

I recently had the occasion to work on a game during a gamejam at my college and it really got me into it so I've decided with a friend of mine to start something more polished. During the gamejam, I ...
0
votes
1answer
82 views

Why this simple SFML app produce such high CPU usage?

I written the following SFML.NET app. It draw a single 128x128 sprite on the screen. RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML window"); window.SetVerticalSyncEnabled(...
0
votes
0answers
15 views

How to make a viewport in Cocos

I have been using SFML for all the games I developed so far. I recently switched to cocos, and I am facing difficulties, since the learning tutorials provided on the website are way too shallow. Most ...
1
vote
1answer
41 views

Isometric tile picking algorithm not working

Starting to gamedev again and Trying an isometric game. However, all I try, I can't seem to figure out tile picking properly.. Using SFML Here's how I'm detecting the clicks and moving around a sf::...
0
votes
1answer
41 views

Why is the SFML shape not being displayed when I make it a member of the Game class instead of a local function variable?

I created a window successfully in SFML using a Game class which hold all of the key components of the game. I then tried to start rendering shapes on the screen. When I first rendered the shapes, I ...
0
votes
0answers
62 views

SFML 2.4 Jumping and animation

i'm quite new to game developing and i have a question about animations , jumping , gravity and stuff. Since i'm new to game developing, i was following this tutorial to have an idea to animation, ...
3
votes
2answers
142 views

Physics for curved edges?

I'm learning how to program simple two-dimensional games in C++ using SFML, I've done a relatively simple pong game already I would like to ask how I could go about creating the physics for a curved ...
0
votes
1answer
67 views

What way to draw random sprite from spritesheet in SFML?

I have a spritesheet(900x100) with of different colored shapes each size 100x100. I am trying to code a program such that, after every 2 seconds, one random sprite appears on screen. If I click, it ...
0
votes
1answer
79 views

Drawing in SFML outside of the main function (passing the window over to other fuctions) doesn't work

Why does the drawn Sprite only appear in the Window when drawn from the main-function, but not when drawn from an external function and how can I change this? class Class { private: sf::Sprite ...
1
vote
1answer
188 views

How do I make a sprite fire a bullet in a direction using SFML and C++?

I'm learning game programming for the first time using sfml and c++. I have sucessfully animated my sprite in all four directions watching some video tutorials. But now i want my sprite to fire in a ...
0
votes
1answer
128 views

SFML with Box2D

I'm using SFML and Box2D to create an application that spawns circles, triangles and rectangles at the current mouse point when the user presses the C, T, and R keys. The problem is that the shapes ...
0
votes
0answers
119 views

Finite State Machine Input Handling

I'm working on a 2d Super Smash Bros like fighter in SFML/C++. As a game that handles a lot of inputs and states in a very detailed manner, I'm following the state pattern. So I have an abstract ...
1
vote
1answer
63 views

How can I give the mouse position to my GameObject nicely?

I am making a basic Asteroids game in SFML, and I want the Player ship to always look at the mouse. I have a LookAt(x,y) function which works, but I am not sure how to get the mouse position from the ...
0
votes
1answer
33 views

Control stick map analysis

I'm implementing this map of inputs (from the gamecube title Super Smash Bros. Melee) and translating it into code for my game: The map is depicted using hardware coordinates (the square shape of ...
0
votes
1answer
74 views

Moving ship towards mouse click not working well in the “boundary deadzone”?

#pragma once #include "SFML\Graphics.hpp" #include "ResourceIdentifier.h" #include "ResourceManager.h" class Entity { public: Entity() : m_angle(0) { } float getX() const noexcept { ...
1
vote
1answer
150 views

2D simulating light sources (subtract a texture from an other)

I want to simulate a night and day cycle with SFML (plain 2D, no shadows). What I want is to get a smooth transition from day to night, and during night having some lights "on". So the approach I've ...
1
vote
1answer
80 views

Having trouble writing a controller class

Okay so I'm writing a controller class to expand the SFML joystick library capabilities. Since the different controllers I want to use for this game have different integer values mapped to different ...
1
vote
1answer
454 views

Setting up SFML with CLion on Windows 10

For a school project I am trying to set up SFML on my computer that runs Windows 10. The assignment is developing a small engine, based on SFML, in a few weeks. I am very new to C++, and I am not used ...
0
votes
1answer
38 views

SFML - Difficulty with Rect Motion when using 1028x720 image per frame

Hello their just having a little tediously annoying problem that I just can't seem to figure out I've tried numerous things from using for loops on iterators and index values , iterating a index for ...
0
votes
1answer
44 views

Reference sf::RenderWindow from another source file in SFML

In SFML, How would you be able to reference a window in your main.cpp file to another source file? I want to be able to reference the window made in main.cpp from player.cpp, so I can keep everything ...
0
votes
1answer
73 views

Where to put SFML Window in GameStateManager

I have a Pong game using SFML organized after the this tutorial. This is the UML diagram from the tutorial. Start http://blog.nuclex-games.com/wp-content/uploads/pages/game-states/...
0
votes
0answers
58 views

SFML game only runs smooth at high framerate (Windows 10)

I am trying to make my game smooth on low and high fps. Right now, it only runs smooth when I don't limit the framerate. If I run it at 60, then my sprite is noticeably "sluggish". I believe this ...
0
votes
1answer
61 views

Handling collisions with objects that use vector of unique pointers

#pragma once #include "Entity.h" #include <iostream> class Projectile : public Entity { public: Projectile() {} Projectile(float x, float y) { load("Graphics/Projectile.png"); ...
0
votes
1answer
89 views

C++ Pass the reference of the class to a vector inside the constructor [closed]

Okay so i have an extern vector of pointer type 'Entity', and what i want to do is, when a new Entity type class gets constructed it gets pushed back in the vector of Entities, in C# this would be ...
0
votes
0answers
84 views

pollEvent confusion in SFML

I am new to game development, and I am starting with SFML. I am confused with the window.pollEvent() event in this code: sf::RenderWindow window(sf::VideoMode(800, 600), "SFML"); sf::Event event; ...
0
votes
3answers
179 views

Simple state pattern and circular dependancies

I'm creating a game engine which utilizes a state machine following this GameDevGeek tutorial. My concern is the use of circular dependency which I've heard is bad. The game engine has the game ...
1
vote
2answers
105 views

SFML: Optimizing sf::Text?

I've been noticing that using multiple sf::Text objects has a huge impact on performance. The difference between using 1 or 4 sf::Text objects can result in almost a 40FPS drop (From 120 to 80). ...
0
votes
0answers
15 views

Collision with top half of paddle vs bottom half [duplicate]

I want to be able to change the way that a ball collides with the top half of the paddle as opposed to its bottom half in SFML. if (CheckCollision(player1)) { paddleHit = true; ...
-1
votes
0answers
58 views

Game chess sprite not moving across board

#include "Tile.h" Tile::Tile() : sf::RectangleShape(sf::Vector2f(105, 105)), m_isHighlighted(false) { if (!m_cBuffer.loadFromFile("penclick.wav")) { std::cout << "Failed to load ...
-1
votes
1answer
72 views

Way to check if rectangle contains anything (without passing the “anything” as a parameter)

Using it for a chess game, i want the tiles to be able to tell if anything is on it without the function passing the other object as a parameter so it can see if the tile global bounds of the tile ...
0
votes
2answers
186 views

Limiting framerate with a fixed timestep

UPDATE: I still need help determining how MAX_UPDATES works. I want my game to be designed in such a way that if the user can't run the game at full speed, it slows down so that no updates are ...
2
votes
1answer
104 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
83 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-&...
1
vote
1answer
95 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::...
2
votes
0answers
104 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
119 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(...
2
votes
1answer
280 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::...
0
votes
1answer
198 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
0answers
60 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
106 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
0answers
73 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
95 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 ...
0
votes
2answers
171 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 ...
1
vote
1answer
249 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 ...