1
Graphics / SetFramerateLimit problem
« on: July 08, 2009, 10:26:19 pm »
Are you sure you don't have vertical sync enabled??
That leap from 60 to 30 fps is a bit suspect...
That leap from 60 to 30 fps is a bit suspect...
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.
sf::RenderWindow m_window;
HICON hIcon = (HICON) LoadImage(instance, MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
m_window.SetIcon(32, 32, ???);
m_sound_buffer = new sf::SoundBuffer();
if(!m_sound_buffer->LoadFromFile(GetConfigFile()->GetDataPath() + "mig.ogg"))
{
return;
}
m__sound = new sf::Sound(*m_sound_buffer, true);
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main()
{
sf::String text;
return 0;
}
atioglxx.dll!69029503()
[Frames below may be incorrect and/or missing, no symbols loaded for atioglxx.dll]
opengl32.dll!5f145709()
opengl32.dll!5f139aad()
opengl32.dll!5f139c5f()
> sfml-window-d.dll!sf::priv::WindowImplWin32::SetActive(bool Active=true) Line 302 + 0x1c bytes C++
sfml-window-d.dll!sf::Context::SetActive(bool Active=true) Line 64 + 0x18 bytes C++
sfml-graphics-d.dll!sf::priv::GraphicsContext::GraphicsContext() Line 69 C++
sfml-graphics-d.dll!sf::Image::DestroyTexture() Line 776 + 0x8 bytes C++
sfml-graphics-d.dll!sf::Image::~Image() Line 117 C++
sfml-graphics-d.dll!sf::Font::~Font() + 0x63 bytes C++
sfml-graphics-d.dll!`sf::Font::GetDefaultFont'::`2'::`dynamic atexit destructor for 'DefaultFont''() + 0x28 bytes C++
sfml-graphics-d.dll!_CRT_INIT(void * hDllHandle=0x007f0000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 446 C
sfml-graphics-d.dll!__DllMainCRTStartup(void * hDllHandle=0x007f0000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 557 + 0x11 bytes C
sfml-graphics-d.dll!_DllMainCRTStartup(void * hDllHandle=0x007f0000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 507 + 0x11 bytes C
ntdll.dll!7c91118a()
ntdll.dll!7c933ada()
ntdll.dll!7c920435()
ntdll.dll!7c92043e()
ntdll.dll!7c933c88()
kernel32.dll!7c81cb26()
msvcr90d.dll!__crtExitProcess(int status=0) Line 732 C
msvcr90d.dll!doexit(int code=0, int quick=0, int retcaller=0) Line 644 + 0x9 bytes C
msvcr90d.dll!exit(int code=0) Line 412 + 0xd bytes C
main.exe!__tmainCRTStartup() Line 595 C
main.exe!mainCRTStartup() Line 399 C
kernel32.dll!7c817077()
main.exe!__CTA1?AVexception@std@@() + 0x86bd bytes C++
c7fff6b9()
#include <iostream>
#include <sstream>
#include <SFML/Network.hpp>
struct UserEventPkt
{
sf::Uint32 Op;
sf::Uint32 Par1;
sf::Uint32 Par2;
};
enum UserEvent
{
SET_POSITION,
SET_PRESSURE,
SET_ISNEAR,
SET_ISTRIGGERDOWN,
SET_BEGIN
};
sf::Packet& operator <<(sf::Packet& Packet, const UserEventPkt& C)
{
return Packet << C.Op << C.Par1 << C.Par2;
}
sf::Packet& operator >>(sf::Packet& Packet, UserEventPkt& C)
{
return Packet >> C.Op >> C.Par1 >> C.Par2;
}
int main()
{
sf::SelectorTCP Selector;
sf::SocketTCP Listener;
sf::Packet packet;
UserEventPkt e;
sf::SocketTCP Client;
// Client or server ?
char Who;
std::cout << "Do you want to be a server ('s') or a client ('c') ? ";
std::cin >> Who;
if (Who == 's')
{
if(!Listener.Listen(4567))
{
printf("Can't listen");
exit(0);
}
Selector.Add(Listener);
while(true)
{
unsigned int NbSockets = Selector.Wait();
for(unsigned int i = 0; i < NbSockets; ++i)
{
sf::SocketTCP Socket = Selector.GetSocketReady(i);
if (Socket == Listener)
{
// If the listening socket is ready, it means that we can accept a new connection
sf::IPAddress Address;
Listener.Accept(Client, &Address);
std::cout << "Client connected ! (" << Address << ")" << std::endl;
// Add it to the selector
Selector.Add(Client);
e.Op = SET_BEGIN;
e.Par1 = 0;
e.Par2 = 0;
// Send INIT to Client
packet << e;
Client.Send(packet);
}
else
{
// Else, it is a client socket so we can read the data he sent
sf::Packet Packet;
if (Socket.Receive(Packet) == sf::Socket::Done)
{
UserEventPkt e;
Packet >> e;
switch(e.Op)
{
case SET_POSITION:
printf("Set Position from Client");
break;
case SET_PRESSURE:
printf("Set Pressure from Client");
break;
case SET_ISNEAR:
printf("Set IsNear from Client");
break;
case SET_ISTRIGGERDOWN:
printf("Set IsTriggerDown from Client");
break;
case SET_BEGIN:
printf("Set Begin from Client");
break;
default:
std::cout << "A client says : " << e.Op << "(" << e.Par1 << "," << e.Par2 << ")" << std::endl;
}
}
else
{
// Error : we'd better remove the socket from the selector
Selector.Remove(Socket);
}
}
}
}
}
else // Client
{
if (Client.Connect(4567, "127.0.0.1") != sf::Socket::Done)
{
std::cout << "Client can't connect to server" << std::endl;
exit(0);
}
while(true)
{
if (Client.Receive(packet) == sf::Socket::Done)
{
packet >> e;
if(e.Op == SET_BEGIN)
{
printf("SET BEGIN received!");
}
}
e.Op = SET_ISNEAR;
e.Par1 = 0;
e.Par2 = 0;
packet << e;
Client.Send(packet);
}
}
}