+
+
+
+
+
+
+
+
+
10#define GUI_BUTTON_OK 1000
+
+
+
+
+
+
+
+
18void ShowBitmapSize(HWND hWnd, HDC hdc,
const char* name,
int x,
int y,
int w,
int h) {
+
19 HBITMAP hBitmap = LoadBitmap(hInst, name);
+
+
+
22 GetObject(hBitmap,
sizeof(bmp), &bmp);
+
23 hmdc = CreateCompatibleDC(hdc);
+
24 SelectObject(hmdc, hBitmap);
+
25 if(w == 0 && h == 0) {
+
26 StretchBlt(hdc, x, y, bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
+
+
28 StretchBlt(hdc, x, y, w, h, hmdc, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
+
+
+
31 DeleteObject(hBitmap);
+
+
+
34LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
+
+
+
37 int trig = LOWORD(wp);
+
+
39 if(trig == GUI_BUTTON_OK && ev == BN_CLICKED) {
+
40 SendMessage(hWnd, WM_CLOSE, 0, 0);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
59 GetClientRect(hWnd, &rc);
+
60 width = rc.right - rc.left;
+
61 height = rc.bottom - rc.top;
+
+
63 padding = height / 2 - sz / 2;
+
+
65 monospace = (HFONT)GetStockObject(SYSTEM_FIXED_FONT);
+
66 button_ok = CreateWindow(
"BUTTON",
"&OK", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, width - padding - 40, height - padding - 20, 40, 20, hWnd, (HMENU)GUI_BUTTON_OK, hInst, NULL);
+
+
+
+
+
+
+
+
+
+
+
+
+
79 GetClientRect(hWnd, &rc);
+
80 width = rc.right - rc.left;
+
81 height = rc.bottom - rc.top;
+
+
83 padding = height / 2 - sz / 2;
+
+
85 hdc = BeginPaint(hWnd, &ps);
+
86 SelectObject(hdc, monospace);
+
87 ShowBitmapSize(hWnd, hdc,
"GOLDFISH_BMP", padding, padding, sz, sz);
+
+
89 tx.left = padding * 2 + sz;
+
+
+
92 tx.bottom = rc.bottom - padding * 2;
+
93 SetBkMode(hdc, TRANSPARENT);
+
94 DrawText(hdc, vertxt, strlen(vertxt), &tx, DT_LEFT);
+
+
+
+
+
99 return DefWindowProc(hWnd, msg, wp, lp);
+
+
+
+
+
+
+
+
107 wc.cbSize =
sizeof(WNDCLASSEX);
+
108 wc.style = CS_HREDRAW | CS_VREDRAW;
+
109 wc.lpfnWndProc = WndProc;
+
+
+
112 wc.hInstance = hInst;
+
113 wc.hIcon = LoadIcon(hInst,
"GAME");
+
114 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+
115 wc.hbrBackground = GetSysColorBrush(COLOR_MENU);
+
116 wc.lpszMenuName = NULL;
+
117 wc.lpszClassName =
"nishbox";
+
118 wc.hIconSm = LoadIcon(hInst,
"GAME");
+
119 return RegisterClassEx(&wc);
+
+
+
122BOOL InitWindow(
int nCmdShow) {
+
+
+
125 HWND hDeskWnd = GetDesktopWindow();
+
126 GetWindowRect(hDeskWnd, &deskrc);
+
127 hWnd = CreateWindow(
"nishbox",
"GoldFish Engine Info", (WS_OVERLAPPEDWINDOW ^ WS_THICKFRAME) ^ WS_MAXIMIZEBOX, 0, 0, 500, 250, NULL, 0, hInst, NULL);
+
+
+
+
+
132 GetWindowRect(hWnd, &rc);
+
133 SetWindowPos(hWnd, HWND_TOP, (deskrc.right - (rc.right - rc.left)) / 2, (deskrc.bottom - (rc.bottom - rc.top)) / 2, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);
+
134 ShowWindow(hWnd, nCmdShow);
+
+
+
+
+
139int WINAPI WinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst, LPSTR lpsCmdLine,
int nCmdShow) {
+
+
+
+
+
+
145 gf_version_get(&ver);
+
+
147 sprintf(vertxt + strlen(vertxt),
"GoldFish Engine %s\n", ver.
full);
+
148 sprintf(vertxt + strlen(vertxt),
"Build Date : %s\n", ver.
date);
+
149 sprintf(vertxt + strlen(vertxt),
"Thread Model : %s\n", ver.
thread);
+
150 sprintf(vertxt + strlen(vertxt),
"Renderer : %s on %s\n", ver.
driver, ver.
backend);
+
+
+
+
+
+
156 if(!InitWindow(nCmdShow)) {
+
+
+
+
160 while((bret = GetMessage(&msg, NULL, 0, 0)) != 0) {
+
+
+
+
164 TranslateMessage(&msg);
+
165 DispatchMessage(&msg);
+
+
+
+
169 return (
int)msg.wParam;
+
+
+
+
char backend[32]
Name of the rendering backend.
+
char full[64]
Full version.
+
char driver[32]
Name of the rendering driver.
+
+
char thread[32]
Name of the thread model used.
+