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.


Messages - PewPew

Pages: [1] 2
1
General / Re: Spike lag
« on: August 10, 2016, 07:19:41 am »
Every time I move the paddle theres this spike lag happening. Same as the ball. Might be my computer but it doesnt seem to be like that on monogame.

2
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.

3
Hello. Im still on chapter 4 input and events. Ive been trying to debug how the game handles single input only on mouse? at what part of the code it handles it? Ive been trying to do a simple prototype of the code couldnt achieve the same result.

4

However, this could have been used much clearer by using the actual value sf::Keyboard::Unknown instead of the 'magic' -1.

Totally agree! Readable without having to guess what that means

5


Speaking of which, I also just caught a mistake that was fixed in the final drafts, but somehow made it into production:
if (bind->m_details.m_keyCode == -1) { // <-- Supposed to be ==, not !=.
     bind->m_details.m_keyCode = e_itr.second.m_code;
}


Weird cause somehow it is working the way the book expected it to work

6
There is a lot of confusing stuff in this Chapter about events without the book explaining it. Even a comment on the source code might help.

This code

void Clear(){
                m_size = sf::Vector2i(0, 0);
                m_textEntered = 0;
                m_mouse = sf::Vector2i(0, 0);
                m_mouseWheelDelta = 0;
                m_keyCode = -1;
        }

why is m_keyCode initialize in -1? Whats wrong with 0? Is it because 0 is also a value in SFML events?

Cause later on this m_keyCode will be used in if statement

                if (bind->m_details.m_keyCode != -1){
                                                bind->m_details.m_keyCode = e_itr.second.m_code;
                                        }

7
Im on the event chapter now. I still dont understand why did you do this

        Keyboard = sf::Event::Count + 1, Mouse, Joystick

I check the value of the count and in my console it says 23. I check the meaning of the event::count and it says that    

Quote
Keep last – the total number of event types.

So i got 23 event types. How did I even get 23?

8
General / Re: Questions about SF::Clock
« on: July 12, 2016, 04:12:22 pm »
I see. it makes sense now.. Thanks

9
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?

10
General / Re: How do you get the 60 value fps
« on: July 07, 2016, 03:57:51 pm »
Hi. Thanks I got it from here

https://github.com/SFML/SFML/wiki/Source:-FPS

Anyway just wanna ask does 0 counts in the FPS? cause I set the framelimit on 60 and I most of the time get 61.. weird

11
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?

12
General / Re: Having some issues with SFML
« on: January 29, 2016, 05:08:35 am »
Okay so I just remove the IFs on CmakeLists as it turns out the SFML FOUND is returning invalid argument in message. I also remove the REQUIRED on find_package(). This did the trick on removing the errors on CMAKE but now gives another problem.

The intellisense is showing every function of the SFML but I have this error

Quote
CMakeFiles\SFMLDemo3.dir/objects.a(main.cpp.obj): In function `main':
ClionProjects/SFMLDemo3/main.cpp:8: undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'
ClionProjects/SFMLDemo3/main.cpp:8: undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
ClionProjects/SFMLDemo3/main.cpp:8: undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
ClionProjects/SFMLDemo3/main.cpp:17: undefined reference to `_imp___ZN2sf6Window5closeEv'
ClionProjects/SFMLDemo3/main.cpp:13: undefined reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'
ClionProjects/SFMLDemo3/main.cpp:21: undefined reference to `_imp___ZN2sf5ColorC1Ehhhh'
ClionProjects/SFMLDemo3/main.cpp:21: undefined reference to `_imp___ZN2sf12RenderTarget5clearERKNS_5ColorE'
ClionProjects/SFMLDemo3/main.cpp:22: undefined reference to `_imp___ZN2sf6Window7displayEv'
ClionProjects/SFMLDemo3/main.cpp:10: undefined reference to `_imp___ZNK2sf6Window6isOpenEv'
ClionProjects/SFMLDemo3/main.cpp:25: undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
ClionProjects/SFMLDemo3/main.cpp:25: undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'

The intellisense is working. It can see the function of SFML when I press window. for example. or sf::Renderwindow. Is there something wrong in the CMAKE again? thanks

This is btw my CMAKELISTS


Quote
set(SOURCE_FILES main.cpp)
add_executable(SFMLDemo3 ${SOURCE_FILES})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/SFML-2.3.2/cmake/Modules/")
set(SFML_LIBRARIES "${CMAKE_SOURCE_DIR}/SFML-2.3.2/lib")
set(SFML_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/SFML-2.3.2/include")
MESSAGE(${SFML_INCLUDE_DIR} "   hahahaha")
find_package(SFML COMPONENTS system window graphics network audio)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(SFMLDemo3 ${SFML_LIBRARIES})

13
General / Re: Having some issues with SFML
« on: January 29, 2016, 04:48:10 am »
Hi,
So i just message all the directory. Copy it and paste it to the address bar of my file explorer. and yes I got the working directory. here is the updated cmake

Quote
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/SFML-2.3.2/cmake/Modules/")
set(SFML_LIBRARIES "${CMAKE_SOURCE_DIR}/SFML-2.3.2/lib")
set(SFML_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/SFML-2.3.2/include")

MESSAGE(${SOURCE_FILES})
find_package(SFML COMPONENTS system window graphics network audio REQUIRED)

if (SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    target_link_libraries(SFMLDemo3 ${SFML_LIBRARIES})
endif(SFML_FOUND)

 but i still have this problem
Quote
(missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
  SFML_GRAPHICS_LIBRARY SFML_NETWORK_LIBRARY SFML_AUDIO_LIBRARY)

I am hundred percent sure that the directory is working. I message the SOURCE DIR  and the MODULE PATH. All of them points to the directory of the SFML inside my demo project.
I remove the PREFIX PATH and put the SFML LIBRARIES there to point it to the correct lib folder as I notice that the SFML LIBRARIES return invalid in MESSAGE. Still having the same issue.

14
General / Re: Having some issues with SFML
« on: January 27, 2016, 07:58:28 am »
Yes, it will help. Also, using the REQUIRED keyword will trigger a fatal error if the library is not found, so it is totally useless to test SFML_FOUND after that.

Hi, thanks but still not working. I tried bot the COMPONENTS and REQUIRED both gave me the same error messages

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

Still have any idea why? The SFML folder is on my DemoProject. So im pretty sure I have the correct directory.

This is the updated CmakeList

Quote
cmake_minimum_required(VERSION 3.2)
project(SFMLDemo3)

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

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

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/SFML-2.3.2/cmake/Modules/")
set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH} ${CMAKE_SOURCE_DIR}/SFML-2.3.2/lib")
set(SFML_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/SFML-2.3.2/include/SFML")
find_package(SFML COMPONENTS system window graphics network audio REQUIRED)

if (SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    target_link_libraries(SFMLDemo3 ${SFML_LIBRARIES})
endif(SFML_FOUND)

15
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..

Pages: [1] 2
anything