Example #1
0
int main(void)
{
    long go;

    GetRoot();  /* Also creates a child process for transcribing stdout */
    GetParms();
    MakeFiles(); /* in test directory */

    InitRPC();

    MakeWorkers();
    GetConns();
    GetVar(&go, "Say when: ");
    DoBindings();
    MakeClients();

    /* wait for all clients to get ready */
    while (ClientsReady < Clients) LWP_DispatchProcess();

    LWP_NoYieldSignal((char *)&ClientsReady);
    LWP_WaitProcess((char *)main);  /* infinite wait */
    
    return 0; /* make compiler happy */
}
Example #2
0
int WindowUp()
{
	mousewheel=0;
	MouseVectorOld=MouseVector;
	MouseXOld = MouseX;
	MouseYOld = MouseY;
	while(dropfiles.count)  // I had to delay this a frame since mousevector and manipulator needs updating.
		FuncInterp(dropfiles.Pop());
	MSG   msg;				/* message */
	while(PeekMessage(&msg, hWnd, 0, 0, PM_NOREMOVE)) {
		if(GetMessage(&msg, hWnd, 0, 0)) {
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} else {
			return 0;
		}
	}
	HRESULT hr = g_pd3dDevice->TestCooperativeLevel();
	while(hr==D3DERR_DEVICELOST) 
	{
		Sleep(1);
		if(GetMessage(&msg, hWnd, 0, 0)) {
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} else {
			return 0;
		}
		hr = g_pd3dDevice->TestCooperativeLevel();
	} 
	if (hr==D3DERR_DEVICENOTRESET) 
	{
		resetdevice(NULL);
	}

	if(vsync_current != vsync)
	{
		resetdevice(NULL);
	}

	MouseDiff = MouseVector-MouseVectorOld;
	MouseDX=(MouseX-MouseXOld)/(Width/2.0f);
	MouseDY=(MouseY-MouseYOld)/(Height/2.0f);
	if(centermouse && focus) {
		RECT rect;
		RECT crect;
		POINT pt;
		GetWindowRect(hWnd,&rect);
		GetClientRect(hWnd,&crect);
		GetCursorPos(&pt);
		if(windowed)
		{	
			rect.left -= window_inset.left; // todo: look into the function: ScreenToClient(hwnd,point)
			rect.top  -= window_inset.top;
		}
		if(centered_last_frame)
		{
			MouseDX = (float)(pt.x-rect.left-(Width/2))/(Width/2.0f);
			MouseDY = -(float)(pt.y-rect.top-(Height/2))/(Height/2.0f);
		}
		SetCursorPos(Width/2+rect.left,Height/2+rect.top);
		MouseVector = float3(0,0,-1);
		centered_last_frame =1;
	}
	else
	{
		centered_last_frame =0;
	}

	CalcFPSDeltaT();
	if(!entertext && !ManipulatorKeysGrab()) {
		DoBindings();
	}
	else {
		PrintStats();
	}
	return (msg.message!=WM_QUIT && !quitrequest);
}