Simple and Fast Multimedia Library - a free, portable API that provides access to graphics, input, audio, etc.
0
votes
1answer
30 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 { ...
0
votes
0answers
39 views
Spaceship not stopping as intended on boundaries and more?
#pragma once
#include "Globals.h"
#include "ResourceManager.h"
#include "ResourceIdentifier.h"
#include "Entity.h"
#include <iostream>
#include <cmath>
class Shooter : public Entity{
...
1
vote
1answer
76 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
41 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
64 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
27 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
30 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
0answers
20 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.
Now I am not sure where I should put my SFML RenderWindow variable (and other things ...
0
votes
0answers
36 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
38 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
44 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
35 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
1answer
60 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 ...
0
votes
1answer
46 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;
...
0
votes
0answers
50 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
65 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
90 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
66 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
53 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
58 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
54 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
67 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
132 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
80 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>
...
0
votes
1answer
86 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
27 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
99 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
65 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
89 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
123 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
139 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 ...
1
vote
2answers
117 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 ...
-1
votes
2answers
59 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
94 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 ...
2
votes
1answer
219 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
19 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
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
106 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
591 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(...
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
64 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 ...
9
votes
1answer
207 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
2answers
421 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
75 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 ...
0
votes
1answer
298 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 ...
0
votes
0answers
92 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
56 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
191 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
238 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 ...