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 - PewPew

Pages: [1]
1
General / Spike lag
« on: August 06, 2016, 07:28:08 am »
I keep having this spike lag on my pong game

here is the code

while (window.isOpen())
        {
                window.setFramerateLimit(60);
                sf::Event event;
                dt = deltatime.getElapsedTime().asSeconds();
               
                update(event,dt);
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                                window.close();
                }
                if (mClock.getElapsedTime().asSeconds() >= 1.f)
                {
                        mFps = mFrame;
                        mFrame = 0;
                        mClock.restart();
                       
                }

                ++mFrame;
                //std::cout << mFps << std::endl;

                this->deltatime.restart();
                window.clear(color);
                player->Render(window);
                ball->Render(window);
                window.display();
       

        }

IM guessing its the deltatime. But I dont see the connection. My computer is a medium gaming rig so I shouldnt have this lag spike.

2
General / Questions about SF::Clock
« on: July 11, 2016, 03:58:24 pm »
So I bought the SFML GameDev by example.

I was just curious if why is the clock keeps getting called without being called in the game loop

        sf::Clock clock;
        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                }

                window.clear();
                window.draw(shape);
                window.display();
               
                sf::Time a = clock.restart();
                std::cout << a.asSeconds() << std::endl;

        }

The restart function puts the time counter back to zero so it should be the the output I will get is 0 up until the end. Does that mean the the clock has its own game loop under the hood?

3
General / How do you get the 60 value fps
« on: July 07, 2016, 02:43:27 pm »
Ive been searching how to get the framerate to display as 60fps in the windows screen

this code

 float Framerate = 1.f / Clock.GetElapsedTime();
    Clock.Reset();
is not suited for that kind of thing.
I saw on some previos post here made by laurent
He said

Quote
There are two ways to compute the FPS:
1. counting how many frames you have in one second (that's your code)
2. counting how many seconds you have in one frame, and inverting the result (that's my code)

Basically I just wanna count how many frames is called in one second?

4
General / Having some issues with SFML
« on: January 26, 2016, 11:55:07 am »
I was following this http://www.gamefromscratch.com/post/2015/06/02/Creating-an-SFML-project-on-Mac-OS-using-CLion-and-CMake.aspx tutorial on setting up SFML with Clion.  I have the correct working directory but I got an error  saying

Quote
Error:Could NOT find SFML (missing: SFML_GRAPHICS_LIBRARY SFML_WINDOW_LIBRARY SFML_SYSTEM_LIBRARY)

This is my cmake

Quote
cmake_minimum_required(VERSION 3.2)
project(SFMLTest)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(SFMLTest ${SOURCE_FILES})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/SFML-2.3.2/cmake/Modules/")
find_package(SFML REQUIRED graphics window system)
if (SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    target_link_libraries(SFMLTest ${SFML_LIBRARIES})
endif(SFML_FOUND)

Please help..

5
General / Additional question about the official code on the book
« on: October 28, 2014, 02:32:27 pm »
Since this is not included on the book..
Just wanna know whats the purpose of this and what does it do


const sf::Time Game::TimePerFrame = sf::seconds(1.f/60.f);

Its on the very top of game.cpp before the declaration of constructor

6
General / Some errors on official SFML book code in github
« on: October 22, 2014, 07:03:44 pm »
Have not read the book yet. I just want to try if every code is working before reading the book.

Turns out i got 2 unresolved externals.

Here are they

Error   2       error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl toString<__int64>(__int64 const &)" (??$toString@_J@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AB_J@Z) referenced in function "private: void __thiscall Game::updateStatistics(class sf::Time)"

Error   1       error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl toString<unsigned int>(unsigned int const &)" (??$toString@I@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABI@Z) referenced in function "private: void __thiscall Game::updateStatistics(class sf::Time)"      

7
General / Help VS 2013 cannot open file
« on: October 20, 2014, 07:16:38 pm »
Hi. I followed the instructions here clearly but i still get an error

Error   1       error LNK1104: cannot open file 'sfml-graphics-d.lib'

Is this compatible on VS 2013?

Pages: [1]
anything