SFML community forums
Help => Graphics => Topic started by: jerryd on May 03, 2013, 04:30:30 am
-
SFML forum,
SFML 1.6, Visual C++ 2010
I load an image and set it as a sprite:
MyImage.LoadFromFile("Sprite2.bmp"))
// Create a sprite called Rocket from MyImage
sf::Sprite Rocket(MyImage);
This all works and the sprite appears on the screen.
Now when I try to set the origin of the sprite:
Rocket.setOrigin(25, 25);
I get a compiler error saying:
error C2039: 'setOrigin' : is not a member of 'sf::Sprite'
What am I doing wrong here?
jerryd
-
SFML 1.6 uses CamelCase where as the new SFML 2.0 uses camelCase. Try Rocket.SetOrigin(25, 25); instead and it'll probably work.
That said, if you haven't yet please check out SFML 2.0 which was just released and is MUCH better than 1.6.
-
Jebbs,
Thanks for the reply.
Tried SetOrigin but got the same error message.
I have downloaded and compiled SFML20 but can't seem to get
the include files to work yet.
Any more suggestions about the SetOrigin?
jerryd
-
Looks like I have been using SFML 2.0 longer than I thought!
The function you are looking for is SetCenter, not SetOrigin.
When in doubt, the documentation is your friend. ;)
What issues are you having with the 2.0 include files?
-
Jebbs,
That worked.
I had read about and tried setCenter() but it
also failed. Probably because of the wrong case.
Using Visual C++ 2010 I set all the properties to the SFML20
include and lib files but when I leave the properties menu
it doesn't load them? I know the paths are correct because
I use the "edit" function to set the paths.
The only thing that works is Render Window. Every other sf
type command, such as "SetFramerateLimit()" or "LoadFromFile",
is colored red in the editor. All works with SFML-1.6
jerryd
-
The only thing that works is Render Window. Every other sf
type command, such as "SetFramerateLimit()" or "LoadFromFile",
is colored red in the editor. All works with SFML-1.6
Again, as Jebbs said, the casing changed in 2.0. It's "loadFromFile" and "setFramerateLimit" etc.