mirror of
https://github.com/raysan5/raylib.git
synced 2025-11-16 07:11:11 +00:00
Remove trail spaces
This commit is contained in:
@@ -24,22 +24,22 @@ int main(void)
|
||||
InitWindow(screenWidth, screenHeight, "raylib [network] example - udp client");
|
||||
|
||||
InitNetworkDevice(); // Init network communications
|
||||
|
||||
|
||||
const char *pingmsg = "Ping!";
|
||||
const char *pongmsg = "Pong!";
|
||||
|
||||
|
||||
bool ping = true;
|
||||
bool pong = false;
|
||||
float elapsed = 0.0f;
|
||||
float delay = 1.0f;
|
||||
|
||||
SocketConfig clientConfig = {
|
||||
.host = "127.0.0.1",
|
||||
.port = "4950",
|
||||
.type = SOCKET_UDP,
|
||||
.host = "127.0.0.1",
|
||||
.port = "4950",
|
||||
.type = SOCKET_UDP,
|
||||
.nonblocking = true
|
||||
};
|
||||
|
||||
|
||||
SocketResult *clientResult = NULL;
|
||||
SocketSet *socketSet = NULL;
|
||||
char receiveBuffer[512] = { 0 };
|
||||
@@ -76,7 +76,7 @@ int main(void)
|
||||
if (IsSocketReady(clientResult->socket)) bytesRecv = SocketReceive(clientResult->socket, receiveBuffer, (int)strlen(pingmsg) + 1);
|
||||
|
||||
// If we received data, was that data a "Ping!" or a "Pong!"
|
||||
if (bytesRecv > 0)
|
||||
if (bytesRecv > 0)
|
||||
{
|
||||
if (strcmp(receiveBuffer, pingmsg) == 0) { pong = true; }
|
||||
if (strcmp(receiveBuffer, pongmsg) == 0) { ping = true; }
|
||||
@@ -86,17 +86,17 @@ int main(void)
|
||||
elapsed += GetFrameTime();
|
||||
if (elapsed > delay)
|
||||
{
|
||||
if (ping)
|
||||
if (ping)
|
||||
{
|
||||
ping = false;
|
||||
SocketSend(clientResult->socket, pingmsg, (int)strlen(pingmsg) + 1);
|
||||
}
|
||||
}
|
||||
else if (pong)
|
||||
{
|
||||
pong = false;
|
||||
SocketSend(clientResult->socket, pongmsg, (int)strlen(pongmsg) + 1);
|
||||
}
|
||||
|
||||
|
||||
elapsed = 0.0f;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -106,7 +106,7 @@ int main(void)
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
// TODO: Draw relevant connection info
|
||||
|
||||
EndDrawing();
|
||||
@@ -116,7 +116,7 @@ int main(void)
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseNetworkDevice(); // Close network communication
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user