X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=gph-gfx;a=blobdiff_plain;f=test_win.c;h=ff13e5655d1971ee5769e42d1cfb04c78b7b0825;hp=f1e75a5f548f1abb12b52553b5fe8077c2ceaba7;hb=bc47a2e646f7045437ae615127125d906656da2c;hpb=5ea3ab5302b95500424d61eab0dda97e98cc53d8 diff --git a/test_win.c b/test_win.c index f1e75a5..ff13e56 100644 --- a/test_win.c +++ b/test_win.c @@ -18,7 +18,7 @@ static HWND win; static HINSTANCE hinst; static HDC dc; static int win_width, win_height; - +static int quit; int WINAPI WinMain(HINSTANCE hinst_, HINSTANCE hprev, char *cmdline, int showcmd) { @@ -56,16 +56,63 @@ int WINAPI WinMain(HINSTANCE hinst_, HINSTANCE hprev, char *cmdline, int showcmd end: ggfx_shutdown(); - ReleaseDC(dc); + ReleaseDC(win, dc); DestroyWindow(win); UnregisterClass("gphgfxtest", hinst); return 0; } + +static void redraw(void) +{ + RECT rect; + HBRUSH brush; + + rect.left = rect.top = 0; + rect.right = win_width; + rect.bottom = win_height; + + brush = CreateSolidBrush(RGB(128, 0, 0)); + + FillRect(dc, &rect, brush); +} + +static void reshape(int x, int y) +{ +} + +static void keydown(int key, int x, int y) +{ + switch(key) { + case 27: + quit = 1; + break; + } +} + +static void keyup(int key, int x, int y) +{ +} + +static void button(int bn, int st, int x, int y) +{ +} + +static void motion(int x, int y) +{ +} + static int create_window(const char *title, int width, int height) { - if(!(win = CreateWindow("gphgfxtest", title, WS_OVERLAPPEDWINDOW, 0, 0, width, - height, 0, 0, hinst, 0))) { + RECT rect; + + rect.left = rect.top = 0; + rect.right = width; + rect.bottom = height; + AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, 0); + + if(!(win = CreateWindow("gphgfxtest", title, WS_OVERLAPPEDWINDOW, 0, 0, + rect.right - rect.left, rect.bottom - rect.top, 0, 0, hinst, 0))) { fprintf(stderr, "failed to create window\n"); return -1; } @@ -162,5 +209,5 @@ static void handle_mbutton(int bn, int st, WPARAM wparam, LPARAM lparam) { int x = lparam & 0xffff; int y = lparam >> 16; - mouse(bn, st, x, y); + button(bn, st, x, y); }