gboolean FPSFunc(gpointer user) { ENGD *engd = user; intptr_t *data; char fout[64]; cOutputFPS(engd, fout); cEngineCallback(engd, ECB_GUSR, (intptr_t)&data); gtk_window_set_title(GTK_WINDOW(data[0]), fout); printf("%s\n", fout); return TRUE; }
LRESULT APIENTRY WindowProc(HWND hWnd, UINT uMsg, WPARAM wPrm, LPARAM lPrm) { switch (uMsg) { case WM_CREATE: SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)((CREATESTRUCT*)lPrm)->lpCreateParams); SetTimer(hWnd, 1, 1000, 0); return 0; case WM_KEYDOWN: if (wPrm == VK_ESCAPE) case WM_CLOSE: cEngineCallback((ENGD*)GetWindowLongPtr(hWnd, GWLP_USERDATA), ECB_QUIT, ~0); return 0; case WM_LBUTTONDOWN: SetCapture(hWnd); return 0; case WM_LBUTTONUP: ReleaseCapture(); return 0; case WM_TIMER: { char fout[64]; cOutputFPS((ENGD*)GetWindowLongPtr(hWnd, GWLP_USERDATA), fout); SetWindowText(hWnd, fout); printf("%s\n", fout); return 0; } case WM_DESTROY: KillTimer(hWnd, 1); PostQuitMessage(0); return 0; default: return DefWindowProc(hWnd, uMsg, wPrm, lPrm); } }