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

Author Topic: Issue with SFML Game Development book example  (Read 1728 times)

0 Members and 1 Guest are viewing this topic.

James A

  • Newbie
  • *
  • Posts: 9
    • View Profile
Issue with SFML Game Development book example
« on: September 01, 2017, 08:23:00 am »
Hi,

I am reading through 'SFML Game Development' and I was up to the first example - getting a player to move a circle with WASD. Unfortunately, after going through the steps, when I ran my code the circle did nothing. Furthermore, I ran the example off github and It didn't do anything either. My goal is to get this to work. Do you have any advice?

Github links:

https://github.com/SFML/SFML-Game-Development-Book/blob/master/01_Intro/Include/Book/Game.hpp
https://github.com/SFML/SFML-Game-Development-Book/blob/master/01_Intro/Source/Game.cpp
https://github.com/SFML/SFML-Game-Development-Book/blob/master/01_Intro/Source/Main.cpp
« Last Edit: September 01, 2017, 10:35:07 am by James A »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Issue with SFML Game Development book example
« Reply #1 on: September 01, 2017, 11:18:32 am »
Should work fine. What's your OS?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

James A

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Issue with SFML Game Development book example
« Reply #2 on: September 01, 2017, 11:21:45 am »
Should work fine. What's your OS?
My OS is Windows 10.
« Last Edit: September 01, 2017, 11:23:49 am by James A »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Issue with SFML Game Development book example
« Reply #3 on: September 01, 2017, 04:07:34 pm »
So when you run it in debug mode, do you get key press events?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

James A

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Issue with SFML Game Development book example
« Reply #4 on: September 02, 2017, 01:17:07 am »
So when you run it in debug mode, do you get key press events?
Yes. I changed the handlePlayerInput function to print what key was pressed, however, as I said, the circle is not doing anything.
« Last Edit: September 02, 2017, 02:17:20 am by James A »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Issue with SFML Game Development book example
« Reply #5 on: September 02, 2017, 10:16:29 am »
The question was whether the events get triggered or not.

Start your debugger and step to the program to figure out where things go wrong.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything