Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Messages - NorthernGate

Pages: [1]
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.

2
Window / Unhandled exception at 0x759a9f11 in sfml-test.exe
« on: December 29, 2010, 03:47:47 am »
If I'm not mistaken it's going to crash because you haven't setup the event receiver for your window, just add this to your code.

Code: [Select]

sf::Event Event;

while(App.IsOpened())
{
    while(App.GetEvent(Event))
    {
        if(Event.Type == Event.Closed) App.Close();
    }

    App.Clear();
    App.Display();
}


It should work, but I can't make any guarantees, hope this helped.

3
Network / SFML2 Split Packets and Cut Strings
« on: October 18, 2010, 05:26:19 pm »
Thanks, I think I'm going to stick to std::string from now on. Character arrays are really not my thing apparently. I haven't gotten the chance to cast yet, but I'm sure it'll work, thanks for your time.

4
Network / SFML2 Split Packets and Cut Strings
« on: October 18, 2010, 12:33:18 pm »
Thanks, I managed to get the proper length of the array. But now I'm coming up with a separate problem, in my classes I have a 'char Data[]' variable. And after I send my first message or define a default value for Data I can't send any data larger than the first string I sent, or at least the server refuses to take it. I assume this is because char Data[] defines it's max length based on it's first value ( I jumped right into std::string when I learned C++ so I'm a bit ignorant on this sort of thing. ) So I made the char *Data instead, but this causes a crash during run-time, and my debugger ( as unreliable as it may be ) tells me it occurs on the line the Client's Send Function is called. This may be a bit off the side from any actual SFML business, but I was wondering what sort of string I should be passing to sf::UdpSocket::Send, the prototype says const char *, but as seen before that doesn't make my Server too happy.

5
Network / SFML2 Split Packets and Cut Strings
« on: October 18, 2010, 10:13:37 am »
That might be it, this is the function I'm using for my Send function.

Code: [Select]
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" );
}


Here's my Servers Receive Function

Code: [Select]
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 );
}


But if I'm not mistaken that code is near identical to what you used in the SDK Sample, including the sizeof parameter.

6
Network / SFML2 Split Packets and Cut Strings
« on: October 18, 2010, 08:54:02 am »
I have my Server and Client. My issue is that when I send a message through my client to my server the server receives it as chunks and if the word was longer than 4 characters it expunges any characters past the fourth and if it's 4 or greater it appends a set of funky symbols to the end of each packet.

Screens:

Client


Server

7
Graphics / sf::View breaks Object Rotation
« on: September 02, 2010, 07:05:48 pm »
Figured it out, I didn't realize sf::RenderWindow::ConvertCoords() returned a value, I thought it modified the values you gave it. Now it works, cool.

8
Graphics / sf::View breaks Object Rotation
« on: September 02, 2010, 06:19:10 pm »
Quote from: "Laurent"
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?


Code: [Select]

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();
}
}


After running that I also realize it has something to do with sf::View::SetCenter(), as it didn't start breaking until I put that in.

(( I'm also aware it's standard for std::atan to hold pos.y - mouse.y, pos.x - mouse.x instead of how I'm doing it, but I've tested it with the proper atan2 parameters and it didn't make any difference other than which direction the sprite faces by default ))

9
Graphics / sf::View breaks Object Rotation
« on: September 01, 2010, 11:55:08 pm »
I just added that and it's still got the same issue, maybe it has something to do with the order of my functions?

Loop:

1. Update To the New View
2. Assign Mouse X and Y to new variables.
3. Convert Mouse X and Y to the New View via sf::RenderWindow
4. Event Managing
5. Rotate Entity To Mouse X and Y
6. Entity Think Code ( Just modifies Position by Velocity )
7. Clear Window, Render Entity, Display Rendered Items
8. Goto 1

10
Graphics / sf::View breaks Object Rotation
« on: September 01, 2010, 09:19:41 pm »
I have an Entity that points towards my mouse using this function:
Code: [Select]

Object.SetRotation( Math::Convert::RadToDeg( std::atan2( Pos.x - x, Pos.y - y ) ) )


It works fine when I don't have any views applied. However, when I apply a view through my camera class the rotation breaks and is limited to a ninety agree angle.

Pages: [1]
anything