271
General / Re: You must select a host application to "run" a commands-only target
« on: May 01, 2015, 06:30:46 pm »
Did you select "empty project" when creating your project?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Num1) && sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Num2))
{
//code here
}
This should do it. Of course you can replace 1 and 2 with whatever you want, or use Numpad instead of Num like Rosme said if you want.
You should not store the texture inside the alien class, because it is needlessly duplicated for every alien. Pass a texture reference to the alien's constructor instead.Is there any reason not to take this further and do the following? Pass a sprite reference in the constructor, then use float positions in the class, give the class a draw function that should be called between window.clear() and window.display() and then make each call of the draw function move the refenced sprite (which can be shared between objects) to the correct position and print it on the screen. Thus making many objects that use the same texture only uses one texture and one sprite.
the topic 3D has been discussed numerous times and the answer will never change...This seems to sum things up pretty well: if you want to do 3d and use SFML, you pretty much have to do it yourself and use SFML for other parts of your program like window/audio etc.
SFML only provides 2D functionality period.
Also OpenGL is always needed with SFML but you don't have to explicitly link it, except if you were going to do some custom drawing.
If you want 3D you can use some other simple libraries like Irrlicht or do everything on your own with SFML as window 'creator' and OpenGL.