1
General / Key press.
« on: February 12, 2012, 10:08:59 pm »
I don't get it..
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.
sprite.SetPosition(mouse.GetPosition(Window).x, mouse.GetPosition(Window).y);
#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;
int main()
{
sf::VideoMode vmode(800,600,32);
sf::RenderWindow Window(vmode, "Pong");
sf::Texture tex;
tex.LoadFromFile("Paddle.png");
sf::Sprite sprite;
sprite.SetTexture(tex);
sf::Mouse mouse;
while(Window.IsOpened())
{
sf::Event event;
while(Window.PollEvent(event))
{
if(event.Type == sf::Event::Closed || sf::Keyboard::IsKeyPressed(sf::Keyboard::Escape))
{
Window.Close();
}
}
Window.Clear(sf::Color::Cyan);
sprite.SetPosition(mouse.GetPosition().x,mouse.GetPosition().y);
Window.Draw(sprite);
Window.Display();
}