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

Author Topic: Passing sprites, images and other things?  (Read 1945 times)

0 Members and 1 Guest are viewing this topic.

The_Mezentine

  • Newbie
  • *
  • Posts: 16
    • View Profile
Passing sprites, images and other things?
« on: July 26, 2011, 06:32:00 am »
Hey, so this is something of a beginner question but I'm running into some errors trying to compile the following:
Ball.h
Code: [Select]
#include<SFML\Graphics.hpp>

class Ball{
Private:
sf::Vector2f Velocity;
sf::Sprite BallSprite;
Public:
Ball(sf::Image &Image);
~Ball();
//void Rebound(sf::Vector2f & Velocity);

};


Ball.cpp
Code: [Select]
#include"Ball.h"
#include<SFML\Graphics.hpp>

Ball::Ball(sf::Image &Image){
BallSprite.SetImage(Image);
}

Ball::~Ball(){

}


Errors:
Code: [Select]
1>c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.h(5): error C2275: 'sf::Vector2f' : illegal use of this type as an expression
1>c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.h(5): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.h(5): error C2146: syntax error : missing ';' before identifier 'Velocity'
1>c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.h(5): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.h(8): error C2275: 'sf::Image' : illegal use of this type as an expression
1>c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.h(8): error C2146: syntax error : missing ')' before identifier 'Image'
1>c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.h(8): error C2056: illegal expression
1>c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.h(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.cpp(4): error C2511: 'Ball::Ball(sf::Image)' : overloaded member function not found in 'Ball'
1>          c:\users\alex\documents\visual studio 2010\projects\breakout\breakout\ball.h(3) : see declaration of 'Ball'


Any ideas why it doesn't like me trying to pass the Vector2f and the Image? The error on Vector2f really confuses me.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Passing sprites, images and other things?
« Reply #1 on: July 26, 2011, 07:46:32 am »
Private and Public should be lower case -- C++ is case sensitive.
Laurent Gomila - SFML developer