funny demo

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@59 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-09-29 06:40:08 +00:00
parent 29b344f831
commit db84c794c7
6 changed files with 122 additions and 4 deletions

View File

@@ -135,7 +135,9 @@ int MwPending(MwWidget handle) {
void MwLoop(MwWidget handle) {
while(1) {
MwStep(handle);
MwLLSleep(5);
MwDispatchUserHandler(handle, MwNtickHandler, NULL);
MwLLSleep(MwWaitMS);
}
}

View File

@@ -13,9 +13,27 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
if(msg == WM_PAINT) {
PAINTSTRUCT ps;
u->ll->hDC = BeginPaint(hWnd, &ps);
RECT rc;
HBITMAP hbmp;
HDC dc, hbdc;
GetClientRect(hWnd, &rc);
dc = GetDC(hWnd);
hbmp = CreateCompatibleBitmap(dc, rc.right - rc.left, rc.bottom - rc.top);
hbdc = CreateCompatibleDC(dc);
SelectObject(hbdc, hbmp);
ReleaseDC(hWnd, dc);
u->ll->hDC = hbdc;
MwLLDispatch(u->ll, draw);
dc = BeginPaint(hWnd, &ps);
StretchBlt(dc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hbdc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SRCCOPY);
EndPaint(hWnd, &ps);
DeleteDC(hbdc);
DeleteObject(hbmp);
} else if(msg == WM_LBUTTONDOWN) {
SetCapture(hWnd);
MwLLDispatch(u->ll, down);
@@ -127,7 +145,7 @@ MwLLColor MwLLAllocColor(MwLL handle, int r, int g, int b) {
c->green = g;
c->blue = b;
DeleteDC(dc);
ReleaseDC(handle->hWnd, dc);
return c;
}