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

Pages: [1]
1
Graphics / Cannot Access Private Member in class "sf::NonCopyable&
« on: June 23, 2011, 03:18:58 am »
You're missing the break statements in your switch block. It should look like this:

Code: [Select]
  case left:
      object->Move(-5, 0);
      break;
   case right:
      object->Move(5, 0);
      break;
   case up:
      object->Move(0, -5);
      break;
   case down:
      object->Move(0, 5);
      break;


Otherwise, if you press left, it will also run the code for right, up, and down.

2
I think the issue is that you declare "sf::Mouse::Button b", but you never initialize it before you use it, so it contains a garbage value that causes IsMouseButtonDown to crash.

You should instead do something like this:
Code: [Select]
sf::Mouse::Button b(sf::Mouse::Left);
or this:
Code: [Select]
...App.GetInput().IsMouseButtonDown(sf::Mouse::Left)

The reason it doesn't crash until you move your mouse over the sprite is because of "short-circuit evaluation".

3
Graphics / SFML 2.0 Creating OpenGL 3.2 Context
« on: June 05, 2011, 09:19:03 pm »
You are only calling the ContextSettings constructor, you aren't passing it to the RenderWindow constructor.

Here is what I use in my project, except using Window instead of RenderWindow:

Code: [Select]
sf::Window window(sf::VideoMode(800, 600, 32), "Game", sf::Style::Close, sf::ContextSettings(24, 8, 16, 3, 3));

4
Network / UDP packet occasionally not received correctly?
« on: October 16, 2010, 05:11:12 pm »
Great, thank you.  :)

5
Network / UDP packet occasionally not received correctly?
« on: October 16, 2010, 09:57:59 am »
No problem  :)

I added some additional information to my first post which may help.

Also, thanks for making such an awesome library. It is much nicer than SDL and others that I have used.

6
Network / UDP packet occasionally not received correctly?
« on: October 16, 2010, 08:49:18 am »
[SFML 2.0, rev 1582]

I set up two UDP sockets on localhost, and have one socket constantly send a packet containing '42' to the other (nonblocking) socket. Occasionally '0' will be received instead of '42'.

Am I doing something wrong?

Thank you.

Here is my code:

Code: [Select]

const int CLIENT_PORT = 2364;
const int SERVER_PORT = 2365;
sf::UdpSocket socketClient, socketServer;
socketClient.Bind(CLIENT_PORT);
socketClient.SetBlocking(false);
socketServer.Bind(SERVER_PORT);
sf::IpAddress theAddress("127.0.0.1");

while (true)
{
{
sf::Packet packet;
packet << 42;
socketServer.Send(packet, theAddress, CLIENT_PORT);
}

{
sf::Packet packet;
sf::IpAddress address;
unsigned short port;
if (socketClient.Receive(packet, address, port) == sf::UdpSocket::Done)
{
if (address == theAddress && port == SERVER_PORT)
{
int temp;
packet >> temp;
if (temp == 0)
{
printf("Value is 0\n");
}
}
}
}
}


[EDIT]
Some additional information: if I grab the size of the packet before trying to set temp, and then print it out when temp is not correct, these are some of the values I get:
131022,393050,65515,2227246,196525,982609,262032,7533309
Note that they all seem to roughly be multiples of the same number, 65515.

Pages: [1]