1
General / [ANSWERED] Window not showing up (perhaps ATI-related)
« on: December 06, 2011, 04:56:35 pm »
I get BSOD when adding that DLL :lol:
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.
-------------- Clean: all in SFML ---------------
Cleaned "SFML - all"
-------------- Build: all in SFML ---------------
Using makefile: Makefile
[ 1%]
Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Clock.cpp.obj
[ 2%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Err.cpp.obj
[ 3%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Lock.cpp.obj
[ 4%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Mutex.cpp.obj
[ 6%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Sleep.cpp.obj
[ 7%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/String.cpp.obj
[ 8%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Thread.cpp.obj
[ 9%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/ThreadLocal.cpp.obj
[ 10%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Win32/MutexImpl.cpp.obj
[ 12%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Win32/Platform.cpp.obj
[ 13%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Win32/ThreadImpl.cpp.obj
[ 14%]
Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Win32/ThreadLocalImpl.cpp.obj
Linking CXX shared library ..\..\..\lib\sfml-system-2.dll
mingw32-g++.exe: unrecognized option '-static-libstdc++'
Creating library file: ..\..\..\lib\libsfml-system.a
process_begin: CreateProcess((null), echo Built target sfml-system, ...) failed.
make (e=2): The system cannot find the file specified.
make.exe[1]: *** [src/SFML/System/CMakeFiles/sfml-system.dir/all] Error 2
make.exe: *** [all] Error 2
[ 14%]
Process terminated with status 2 (0 minutes, 4 seconds)
0 errors, 0 warnings
-static-libgcc in linker options.
||warning: auto-importing has been activated without --enable-auto-import specified on the command line.|
||Info: resolving vtable for sf::Sprite by linking to __imp___ZTVN2sf6SpriteE |
||Info: resolving sf::Color::Black by linking to __imp___ZN2sf5Color5BlackE |
||=== Build finished: 0 errors, 1 warnings ===|
In that pic he posted u can see some clients and a server exchanging packets. Problem is the one I described previously - server is already receiving/sending ~134th packet to clients but the last packet clients received is ~80-90th.
#include <SFML/Network.hpp>
#include <iostream>
int main()
{
const unsigned short Port = 2435;
sf::SocketUDP Server;
if (!Server.Bind(Port))
{
std::cout << " error" << std::endl;
}
sf::Packet Packet;
sf::IPAddress ClientAddress;
unsigned short ClientPort;
Server.Receive(Packet, ClientAddress, ClientPort);
int a;
Packet >> a;
std::cout << "packet : " << a << " from "<< ClientAddress <<" port: "<< ClientPort << std::endl;
a=12345;
Packet.Clear();
Packet << a;
Server.Send(Packet, ClientAddress, ClientPort);
std::cin.ignore(10000, '\n');
Server.Close();
return EXIT_SUCCESS;
}
#include <SFML/Network.hpp>
#include <iostream>
int main()
{
const unsigned short Port = 2400;
sf::SocketUDP Client;
if (!Client.Bind(Port))
{
std::cout << " error" << std::endl;
}
sf::Packet Packet;
sf::IPAddress ServerAddress="127.0.0.1";
unsigned short ServerPort=2435;
int a;
a=54321;
Packet << a;
Client.Send(Packet, ServerAddress, ServerPort);
Packet.Clear();
Client.Receive(Packet, ServerAddress, ServerPort);
Packet >> a;
std::cout << "packet : " << a << " from "<< ServerAddress <<" port: "<< ServerPort << std::endl;
std::cin.ignore(10000, '\n');
Client.Close();
return EXIT_SUCCESS;
}
#include <SFML/Network.hpp>
#include <iostream>
#include <stdlib.h>
#define max_clients 5
struct client_s
{
sf::IPAddress ip;
unsigned short port;
float x;
float y;
} client [max_clients];
bool SenderExist(sf::IPAddress ip, unsigned short ports)
{
for (int n=0; n<max_clients; n++)
{
if(ip==client[n].ip && client[n].port==ports)
return true;
}
return false;
}
int main()
{
sf::IPAddress SenderIP;
sf::SocketUDP Server;
if (!Server.Bind(2323))
{
std::cout << " errors bindojot" << std::endl;
}
for (int n=0; n<max_clients; n++)
{
client[n].ip="0";
client[n].port=0;
client[n].x=0;
client[n].y=0;
}
int s=0;
float x ,y ;
unsigned short SenderPort;
while(true)
{
system("cls");
for (int n=0; n<max_clients; n++)
std::cout << "ID[" << n << "] " << client[n].ip << ":"<< client[n].port << " " << client[n].x << " " << client[n].y << std::endl;
sf::Packet Packet;
if (Server.Receive(Packet, SenderIP, SenderPort) == sf::Socket::Done)
{
Packet >> x >> y;
s++;
std::cout << s << std::endl;
if(SenderExist(SenderIP,SenderPort)==false)
{
for (int n=0; n<max_clients; n++)
{
if(client[n].ip=="0" && client[n].port==0)
{
client[n].ip=SenderIP;
client[n].port=SenderPort;
break;
}
}
}
else
{
for (int n=0; n<max_clients; n++)
{
if(client[n].ip==SenderIP && client[n].port==SenderPort)
{
client[n].x=x;
client[n].y=y;
}
}
}
}
for (int n=0; n<max_clients; n++)
{
for (int n2=0; n2<max_clients; n2++)
{
Packet.Clear();
Packet << n2 << client[n2].x << client[n2].y;
Server.Send(Packet,client[n].ip, client[n].port);
}
}
}
Server.Close();
return EXIT_SUCCESS;
}
#include <SFML/Network.hpp>
#include <iostream>
#define max_clients 5
struct client_s
{
sf::IPAddress ip;
unsigned short port;
float x;
float y;
} client [max_clients];
int main()
{
sf::IPAddress ServerAddress = "78.154.134.179";
sf::SocketUDP Client;
int port = sf::Randomizer::Random(1024, 3000);
if (!Client.Bind(port))
{
std::cout << " errors bindojot" << std::endl;
}
std::cout << " bindoju " << port << " portu" << std::endl;
Client.SetBlocking(false);
for (int n=0; n<max_clients; n++)
{
client[n].ip="0";
client[n].port=0;
client[n].x=0;
client[n].y=0;
}
float x = sf::Randomizer::Random(124.f, 200.f);
float y = 0.0;
sf::IPAddress ServerIP;
unsigned short ServerPort;
sf::Clock Clock;
float Send_Time=0;
while(true)
{
system("cls");
for (int n=0; n<max_clients; n++)
std::cout << "ID[" << n << "] "<< client[n].ip << ":"<< client[n].port << " " << client[n].x << " " << client[n].y << std::endl;
sf::Packet Packet;
if (Client.Receive(Packet, ServerIP, ServerPort) == sf::Socket::Done)
{
int nn;
float xx,yy;
Packet >> nn >> xx >> yy;
client[nn].x=xx;
client[nn].y=yy;
}
if(Clock.GetElapsedTime()-Send_Time>0.3)
{
Send_Time=Clock.GetElapsedTime();
y++;
Packet.Clear();
Packet << x << y;
Client.Send(Packet, ServerAddress, 2323);
}
}
Client.Close();
return EXIT_SUCCESS;
}
It's not, as long as you don't share variables between threads. Have you read the corresponding tutorial?