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

Pages: [1]
1
Window / sf::Input& Input; Use within a class.
« on: March 22, 2011, 11:09:00 pm »
You Sir require Kudos. Thank you for the quick reply and it has done the job spectacularly, it was something trivial after all!

Will,

2
Window / sf::Input& Input; Use within a class.
« on: March 22, 2011, 10:50:25 pm »
Hello everybody!
I want to get the input from the window and the documentation tells me to do this:
Code: [Select]
const sf::Input& Input = App.GetInput();
Which is fine and dandy, it works as expected but I have my project situated in classes. The 'App' window is in a class and I want to have sf::Input within the class also.

The problem is I don't know how to put this into the class and use it in one of the class's functions due to it being a Const and requiring it to get the pointer from App.GetInput(); which I would need to call once the App has been initialized.

Am I missing something fundamental here?
Thanks in advance.
Will,[/code]

3
Network / Multiple connection using TCP
« on: March 19, 2011, 06:19:35 pm »
Hello!
Firstly well done on this amazing library, secondly you are very much correct. I boiled it down to a minimalistic program and I suddenly realized while doing so that I had not set:
Code: [Select]

ServerSocket.SetBlocking(0);//Make sure it doesn't hang.

To the new connection as I thought you only had to do it to the listener, I think I have already proved my self as a 'HerpDerp' but I couldn't find anything about it in the documentation so I was blindly stabbing into the dark, Hehe.

If anyone reads this thread then the problem was that you need to SetBlocking(0); To all sockets, not just the server!  Unlike SDL.

Regards,
Will.

4
Network / Multiple connection using TCP
« on: March 19, 2011, 05:38:55 pm »
Hello everyone!
Been programming with SFML for about a month now, but this is my first problem (which is most likely to be trivial).

I am not using a selector as I want to keep to a structure which has been previously planned, I have turned to sockets into nonblocking and every 'game loop' it checks for a new connection:
Code: [Select]

 sf::IPAddress ConnectionAddress;
    sf::SocketTCP Connection;
    if (ServerSocket.Accept(Connection,&ConnectionAddress) == sf::Socket::Done)
    {


I have a:
Code: [Select]
sf::SocketTCP ServerSocket

Which is effectively the listener so when a new connection is 'Done' see above.

To store the client connections I have a vector which contains this:
Code: [Select]

sf::IPAddress Address;
sf::SocketTCP Connection;


Which is inherited from the new connection function. (It also contains various other data connected to the client but that is not relevant).

My problem is when the server gets a new connection it works fine and appears to be 'Done' and the client is processed into the vector. But when a second Client connects it doesn't notice it, until the first disconnects.

What might be holding me back is the theory of how SFML works as this structure should work in my eyes? What am I misinterpreting.

Thanks in advance!
Will,

Pages: [1]
anything