Jump to content
  • Advertisement
Sign in to follow this  
CelticSir

Problem with my script

This topic is 2478 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey

I have been following "Game From Scratch" tutorials on building a game but my script won't build.

I got to step 6 here: http://www.gamefroms...ion-Part-6.aspx

I get the following errors:



playerpaddle.cpp(32): error C2039: 'IsKeyDown' : is not a member of 'tagINPUT'
c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winuser.h(5332) : see declaration of 'tagINPUT'

playerpaddle.cpp(36): error C2039: 'IsKeyDown' : is not a member of 'tagINPUT'
c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winuser.h(5332) : see declaration of 'tagINPUT'

playerpaddle.cpp(40): error C2039: 'IsKeyDown' : is not a member of 'tagINPUT'
c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winuser.h(5332) : see declaration of 'tagINPUT'

1>c:\users\dave\c++\pang\playerpaddle.cpp(54): error C2064: term does not evaluate to a function taking 1 arguments
[/quote]

Its related to this :



void PlayerPaddle::Update(float elapsedTime)
{
if(Game::GetInput().IsKeyDown(sf::Key::Left))
{
_velocity-=3.0f;
}
if(Game::GetInput().IsKeyDown(sf::Key::Right))
{
_velocity+=3.0f;
}
if(Game::GetInput().IsKeyDown(sf::Key::Down))
{
_velocity = 0.0f;
}

if(_velocity > _maxVelocity)
_velocity = _maxVelocity;

if(_velocity < -_maxVelocity)
_velocity = -_maxVelocity;

sf::Vector2f pos = this->GetPosition();

if(pos.x <= GetSprite().GetSize().x/2 ||
pos.x >= (Game::SCREEN_WIDTH - GetSprite().GetSize().x/2))
{
_velocity = -_velocity;
}

GetSprite().Move(_velocity * elapsedTime, 0);
}


What does the error mean so i can work out how i fix it =/ ?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
The author seems to have forgotten to #include "SFML/Input.hpp", leaving your compiler confused as to what this "sf::Input" nonsense is, making a guess, and guessing incorrectly.

If I'm guessing correctly, at any rate.

Share this post


Link to post
Share on other sites

The author seems to have forgotten to #include "SFML/Input.hpp", leaving your compiler confused as to what this "sf::Input" nonsense is, making a guess, and guessing incorrectly.

If I'm guessing correctly, at any rate.



There is no Input.hpp in 1.6, at least not one you invoke directly.


That said, I think that is exactly what the problem is. I did make one massive stupid mistake in the tutorial, in that I put the includes in the stdafx.h files, then.... well, forgot to document that step. I've since fixed that ommission, but if you started after I made that fix things would be extremely stupid.

@theFollower, check your stdafx.h and make sure it includes "#include "SFML/Window.hpp".

Share this post


Link to post
Share on other sites
Hi,

Yes line 15 has:

#include <SFML/Window.hpp>

Should i upload my project to check it or is there something else i can check ?

Share this post


Link to post
Share on other sites

Hi,

Yes line 15 has:

#include <SFML/Window.hpp>

Should i upload my project to check it or is there something else i can check ?



So, in seeing the code ( posted on StackOverflow ) I see the problem ( your typo ), but you already have your answer on that site, so no need to go into further detail here, unless you are still unclear why you have a problem here.

Share this post


Link to post
Share on other sites
Ah okay didn't know any one had replied! Knew it was going to be a needle in the haystack ! What a headache that was :P Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!