SFML community forums

Help => General => Topic started by: Devero on November 25, 2011, 06:12:55 am

Title: Vector2f Help
Post by: Devero on November 25, 2011, 06:12:55 am
Hello Everyone,
I'm in the process of learning c++ and SFML and I've been working on a game in my spare time.
I've recently starting converting everything to using sf::Views and sf::Vector2f's but I've run into two problems I can't seem to figure out:


1.) I can't access the X or Y individually from a Vector2f's (to use in trigonometric calculations) and I'm curious how exactly to do this. I've tried treating it like a normal vector; however, I only receive errors.

2.) In addition, can anyone give advice on making a Vector of Vector2f's?
For example I have 100 Asteroids that each need their own Vector2f. Any examples or links to examples would be unbelievably beneficial as I'm having a hard time finding a relevant article.

Thanks in advance!
Title: Vector2f Help
Post by: ActionBoy on November 25, 2011, 07:14:48 am
1) yourvector2f.x and yourvector2f.y
2) http://new.cplusplus.com/reference/stl/vector/ and http://new.cplusplus.com/reference/stl/vector/push_back/
Title: Vector2f Help
Post by: Devero on November 25, 2011, 06:21:52 pm
Excellent, thank you so much!