1
System / For newcomers to Parallel Computing/Threading
« on: January 16, 2012, 02:47:36 am »
I believe link to "old movie" is broken, although I've found this and I believe THIS is the same
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.
Window.Draw(Meh);
to work, used texture=>sprite=>window instead
#include <SFML/Graphics.hpp>
int main()
{
sf::VideoMode Vmode(800, 600, 32);
sf::RenderWindow Window(Vmode,"");
sf::Vector2f ppos;
sf::Vector2f vec;
sf::Event Event;
vec.x = 5;
vec.y = -1.5;
sf::CircleShape D;
D.SetRadius(3.0f);
D.SetFillColor(sf::Color(255,0,0));
while (Window.IsOpened())
{
if(ppos.x+vec.x<800 && ppos.y+vec.y<600 &&(ppos.x+vec.x)>1 && (ppos.y+vec.y)>1)
{
ppos.x=ppos.x+vec.x;
ppos.y=ppos.y+vec.y;
D.SetPosition(ppos);
}
while (Window.PollEvent(Event))
{
switch (Event.Type)
{
case sf::Event::Closed:
Window.Close();
break;
case sf::Event::KeyPressed:
if(Event.Key.Code == sf::Keyboard::Escape)
Window.Close();
break;
case sf::Event::MouseButtonPressed:
if(sf::Mouse::IsButtonPressed(sf::Mouse::Right))
{
ppos.x=Event.MouseButton.X;
ppos.y=Event.MouseButton.Y;
}
break;
default:
break;
}
}
Window.Draw(D);
Window.Display();
}
return 0;
}