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 - texus

Pages: 1 ... 31 32 [33]
481
Graphics / Two questions.
« on: September 05, 2011, 08:33:13 pm »
You call "App.Draw(diala)" but you aren't displaying it (with App.Display).
I would use a bool (e.g. DrawText) and do something like this:
Code: [Select]
App.Clear();
App.Draw(Textbox);

if (DrawText)
    App.Draw(diala);

App.Display();

The only thing you have to do when the user presses enter is to make DrawText true.

If you use objects over multiple files then you will have to put everything in a class and put the class in a header.

482
Graphics / How to center sf::Text (SFML2)
« on: September 05, 2011, 08:15:02 pm »
I am creating a button class for SFML2 and I am trying to center a text in my button (a texture).
The problem is that a text is not draw exactly at the correct coordinates (when drawing e.g. a text on position 0 then it will be drawn a little lower).

This is the code I am using:
Code: [Select]
sf::FloatRect rect = Text.GetRect();
rect.Left = (Texture.GetWidth() / 2.0f) - (rect.Width / 2.0f);
rect.Top = (Texture.GetHeight() / 2.0f) - (rect.Height / 2.0f);
Text.SetPosition(rect.Left, rect.Top);

Is there a way to get the top position of the text right?
At this moment the text is always too low.

483
Network / SocketUDP.Receive returns Error when sending delete
« on: August 14, 2011, 12:33:54 pm »
It was indeed stupid to assume that the fault was with sending delete.
When I sent "delete" then the server gave my a different answer than when I sent something else.
The only difference was that the text I received was a few characters longer.

After searching for a while I finally found my mistake: I had defined BUFFER_SIZE as 25 instead of 256.

Thanks for your time and sorry for starting this useless topic.

484
Network / SocketUDP.Receive returns Error when sending delete
« on: August 13, 2011, 08:29:04 pm »
I was using the SocketUDP while I noticed something strange.
When I use
Code: [Select]
SocketUDP.Send("delete", 7, IP_ADDRESS, 5000);
SocketUDP.Receive(ReceiveBuffer, BUFFER_SIZE, BytesReceived, IP_Address, Port);
then the last line returns sf::Socket::Error.
The return value of the first line is always Done.

If I change "delete" into any other word then it returns Done, but when it starts with delete then it fails (even "delete_test" fails).

This happens with both blocking and non-blocking. (Of course in non-blocking there has to be a sleep between the lines.)
Is there some reason why you can't send "delete"?

PS: I am using SFML 1.6.

Pages: 1 ... 31 32 [33]
anything