Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - digimikeh

Pages: [1]

I'm following the "SFML Game Development" book from Packt, in its example it creates a scenenode class that inherits from sf::Drawable.. that's good, as I understand it serves to draw my scenenode as simply typing


it has so much sense..!

but then, there is a spritenode class that inherits from scenenode class... but spritenode has a sf::Sprite property..

when i try to draw mySpriteNode object, the build is success.. but nothing shows on the screen...
but when i draw mySpriteNode.m_sprite (assuming m_sprite is public), then the sprite shows on the screen...

is this the expected behaviour ?...

General / understand sf::Time
« on: April 11, 2021, 02:07:12 am »

does sf::Time stores an static point of time from clock or it is constantly taking the time from clock?...


sf::Clock clk;
//do some things
sf::Time t0 = clk.getElapsedTime();             //N0
//... do some other things that take a while
std::cout << t0.asSeconds();                       //N1

N0: lets suppose here the time is 0.002

N1: does t0 is the same time point as before or it will print a later value?.. for instance 0.01

Oh yeah!!.. i have tried it on my own... but stdout prints an e+10 very large number...

General / deltatime is 0 on my faster computer
« on: April 04, 2021, 09:06:05 pm »

I have a Windows (12 cores) machine and a Linux (1st gen i5 dual core) machine...
on windows my tick's deltatime tooks 0.0s, on Linux it tooks 0.045s

when i want to move a sprite i calculate the current position * speed * deltatime,... but deltatime on Windows is 0 (i don't know may be is really so fast in make inbetween operations...) the result is on Windows there is no movement at all..

This is my code:

void juego::tick(){
        while (rw.isOpen()){
                if (escena_actual){
                        std::clock_t clk = std::clock();    //clock starts (time is 0.0f)

                        if (!escena_actual->hasFinished){
                                sf::Event e;
                                escena_actual->gameplay(e, dt(clk));  //n1

                                if (cortina->current_state == fader::eEstado::cerrada)
                                        cortina->abrir(rw, dt(clk));   
                        } else {
                                cortina->cerrar(rw, dt(clk));
                                if (cortina->current_state == fader::eEstado::cerrada)

                        for (basic_actor*& a : escena_actual->get_vbasic_actors())


n1 : the dt(clk) is a function that returns a const float which it is deltatime that is located on juego.h

inline const float dt(std::clock_t& _clk) {
        //current second - second passed by argument
        //on Windows this is 0, on Linux it is 0.045
        return (std::clock() - _clk) / (float) CLOCKS_PER_SEC;

Then to move my sprites:
//_dt is a reference for returned dt(clk), as on windows is 0 then there is no movement.
clouds->get_spr().move(C_CLOUD_SPEED * _dt, 0);

May i'm calculating deltatime incorrectly ?
Windows compiler is msvc 2017 32bits
Linux compiler is GCC 64bits

General / compilation with msvc 2017
« on: March 20, 2021, 04:31:40 pm »

i'm trying to compile using msvc 2019 32 bits... compiling process is fine i guess... but when i execute my exe file there are some missing files:


where need to copy from to?

General / Manually compiling from CMD... [Windows]
« on: February 14, 2021, 05:28:16 pm »
SOLVED! Please remove.


I want to use VIM and need to manually compile, i have downloaded GCC 7.3.0 MinGW (DW2) - 32-bit - 2.5.1 version, but i get some errors while compiling an example:

Code: [Select]
C:\Users\simicarli\Dropbox\U7\Games\Elevatorman>"..\..\Otros\Plantillas\G_SFML_Plantilla\mingw32\bin\mingw32-make.exe" -j4
C:/Users/simicarli/Dropbox/U7/Otros/Plantillas/G_SFML_Plantilla/mingw32/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Users/simicarli/Dropbox/U7/Games/Elevatorman'
g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\Elevatorman.exe release/main.o  -Lsfml\win\lib -Lsfml\win\bin
release/main.o:main.cpp:(.text.unlikely+0x28): undefined reference to `_imp___ZTVN2sf11CircleShapeE'
release/main.o:main.cpp:(.text.unlikely+0x46): undefined reference to `_imp___ZN2sf5ShapeD2Ev'
release/main.o:main.cpp:(.text.unlikely+0x52): undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
release/main.o:main.cpp:(.text.startup+0x81): undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'
release/main.o:main.cpp:(.text.startup+0xa9): undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
release/main.o:main.cpp:(.text.startup+0xeb): undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
release/main.o:main.cpp:(.text.startup+0x128): undefined reference to `_imp___ZN2sf11CircleShapeC1Efj'
release/main.o:main.cpp:(.text.startup+0x12d): undefined reference to `_imp___ZN2sf5Color5GreenE'
release/main.o:main.cpp:(.text.startup+0x13f): undefined reference to `_imp___ZN2sf5Shape12setFillColorERKNS_5ColorE'
release/main.o:main.cpp:(.text.startup+0x158): undefined reference to `_imp___ZNK2sf6Window6isOpenEv'
release/main.o:main.cpp:(.text.startup+0x166): undefined reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'
release/main.o:main.cpp:(.text.startup+0x1b3): undefined reference to `_imp___ZN2sf5ColorC1Ehhhh'
release/main.o:main.cpp:(.text.startup+0x1c5): undefined reference to `_imp___ZN2sf12RenderTarget5clearERKNS_5ColorE'
release/main.o:main.cpp:(.text.startup+0x1ca): undefined reference to `_imp___ZN2sf12RenderStates7DefaultE'
release/main.o:main.cpp:(.text.startup+0x1e6): undefined reference to `_imp___ZN2sf12RenderTarget4drawERKNS_8DrawableERKNS_12RenderStatesE'
release/main.o:main.cpp:(.text.startup+0x1f5): undefined reference to `_imp___ZN2sf6Window7displayEv'
release/main.o:main.cpp:(.text.startup+0x208): undefined reference to `_imp___ZN2sf6Window5closeEv'
release/main.o:main.cpp:(.text.startup+0x212): undefined reference to `_imp___ZTVN2sf11CircleShapeE'
release/main.o:main.cpp:(.text.startup+0x230): undefined reference to `_imp___ZN2sf5ShapeD2Ev'
release/main.o:main.cpp:(.text.startup+0x23c): undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [Makefile.Release:68: release/Elevatorman.exe] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/simicarli/Dropbox/U7/Games/Elevatorman'
mingw32-make: *** [Makefile:45: release] Error 2

i have sfml bin and lib folders inside my project root folder...

My first approach is that i was using Mingw81 so i downloaded 7.3.0 but still the same...
Seems that ming make is not recognizing lib and bin folders, ...

My cpp main.cpp is:
#include <SFML/Graphics.hpp>

int main(){
        sf::RenderWindow window(sf::VideoMode(200, 200), "OK!");
        sf::CircleShape shape(100.f);
        while (window.isOpen()){
                sf::Event event;
                while (window.pollEvent(event)){
                        if (event.type == sf::Event::Closed)
        return 0;

General discussions / SFML and Box2d
« on: September 05, 2020, 03:50:41 am »

does Box2d converts SFML into a Game Engine ?

a pretty absurd question, but i still don't get what a Game Engine is, since many people have done games using SFML (indeed, a packt book exists)


General / set parent...
« on: July 16, 2020, 05:49:33 pm »
Im wondering if there is a built in set parent function ...
If not, then i have a raw solution but i don't know how elegant is it, is setting the position and rotation of the child object using the current rotation and position of the parent in the game loop....

Is that the only way to do it?


General / BG & FG Level design ?
« on: July 12, 2020, 11:30:41 pm »

I'm pretty new to 2d game development, i only worked on 3d and 2.5d views, but those are quite bit different since they are model based..

On 2d, how do you design your background and foreground's sprites for your level?...

1) Use big and long sprites as layers for all the level.
for instance,  a long 4096 x 256 texture that cover everything for your background, you put everything in that texture so do not need to repeat anything, the same for foreground alpha texture.  (This maybe absurd if the game is really long or need better bg details).

2) use single sprites repeating them on the whole level
reusing short textures like 128xx and 256xx as many copies over the level.  (To make game look good should be using many kinds of trees, rocks, plants and so....

3) any other?


General / Using opengl
« on: July 10, 2020, 05:10:15 am »

I'm looking for a way to do a game just like Donkey Kong Country from Super Nintendo, you know, the game is smooth, good graphics and animations.....

After seeing some showcases i saw that many of the games runs a bit lag, i don't know either if thats because recording screen or something else... so i investigated a little more and found that i can use opengl for 2d content which means that SFML by default does not uses openGl... is this right?

In such case, do you think i'm forced to use opengl to create something like Donkey Kong Country or the default SFML video system is ok?..

In case i need opengl, does someone has a good book or resource to learn SFML + Opengl?

Thanks so much!..

I understood that SFML uses OpenGL, so i think i neee to focus on learning how to move sprites smoothly using time & physics..

System / Threading
« on: July 08, 2020, 12:40:46 am »

The first time i post here so i thanks for admiting me..

If i'm linux user... what should i select for threading?


Thanks in advance.

Pages: [1]