1
SFML website / Can't download SFML2
« on: January 28, 2011, 05:08:31 am »
Sourceforge SVN is down atm. Really do need SFML2 though.
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.
sf::Event Event;
while(App.IsOpened())
{
while(App.GetEvent(Event))
{
if(Event.Type == Event.Closed) App.Close();
}
App.Clear();
App.Display();
}
void Client::Send( const char message[] )
{
if( Socket.Send( message, sizeof( message ), ConnectedTo.Address, ConnectedTo.Port ) != sf::Socket::Done )
Debug( "Network", "Error sending Packet" );
else Debug( "Network", "Message Sent" );
}
void Server::Listen( void )
{
if( Socket.Receive( Data, sizeof( Data ), Received, Sender, Port ) != sf::Socket::Done )
Debug( "Network", "Error receiving Packet" );
else printf( "%s \"%s\"\n", Sender.ToString().c_str(), Data );
}
It looks OK, I think we'll need to see the actual code. Maybe you can show us a complete and minimal example that reproduces the problem?
int main()
{
sf::RenderWindow Game( sf::VideoMode( 800, 600, 32U ), "Game", sf::Style::Close );
Game.SetFramerateLimit( 60 );
sf::Event Events;
sf::View View( sf::FloatRect( 0, 0, 800, 600 ) );
sf::Image Img;
Img.LoadFromFile( "textures/picture.png" );
sf::Sprite Entity;
Entity.SetImage( Img );
Entity.SetPosition( 100, 100 );
Entity.SetOrigin( Entity.GetSize().x/2, Entity.GetSize().y/2 );
while( Game.IsOpened() )
{
Game.SetView( View );
View.SetCenter( Entity.GetPosition() );
while( Game.GetEvent( Events ) )
{
if( Events.Type == Events.Closed )
Game.Close();
}
Entity.SetRotation( ( 180/3.14159f ) * (std::atan2( Entity.GetPosition().x - float( Game.GetInput().GetMouseX() ), Entity.GetPosition().y - float( Game.GetInput().GetMouseY() ) ) ) );
Game.Clear();
Game.Draw( Entity );
Game.Display();
}
}
Object.SetRotation( Math::Convert::RadToDeg( std::atan2( Pos.x - x, Pos.y - y ) ) )