commit 947da901694194e37c35781af87865ecf63680e6 Author: Gwyn Date: Mon Jan 12 23:59:02 2026 -0500 First commit diff --git a/Gwyn_L.bmp b/Gwyn_L.bmp new file mode 100644 index 0000000..b35ab24 Binary files /dev/null and b/Gwyn_L.bmp differ diff --git a/Gwyn_R.bmp b/Gwyn_R.bmp new file mode 100644 index 0000000..2b0ccae Binary files /dev/null and b/Gwyn_R.bmp differ diff --git a/main.c b/main.c new file mode 100644 index 0000000..7e18ae4 --- /dev/null +++ b/main.c @@ -0,0 +1,192 @@ +# include + + +HBITMAP gwynL, gwyn; //These are our .bmp files. +HBITMAP mgwynL, mgwyn; //These are masks we're gonna make because +HBITMAP draw, drawmask;//transparentcy is too scary for windows. +int frame = 0; +//BOOL startup = TRUE; +int frameWidth = 500; +int frames = 4; +int gwynpos = 0; +int dir = 1; +int gwyny; + + + +HBITMAP MakeMask(HBITMAP hbmColor, COLORREF ColorVanish) +{ + HDC hdcmem, hdcmem2; + HBITMAP hbmMask; + BITMAP bmp; + // Make Monochrome Mask of bitmap + GetObject(hbmColor, sizeof(BITMAP), &bmp); + hbmMask = CreateBitmap(bmp.bmWidth, bmp.bmHeight, 1, 1, NULL); + // Ask windows to socialize with the driver and set me up with mem objs + hdcmem = CreateCompatibleDC(0); + hdcmem2 = CreateCompatibleDC(0); + SelectObject(hdcmem, hbmColor); + SelectObject(hdcmem2, hbmMask); + // Now we can do the things. + SetBkColor(hdcmem, ColorVanish); + + BitBlt(hdcmem2, 0,0, bmp.bmWidth, bmp.bmHeight, hdcmem, 0,0, SRCCOPY); + BitBlt(hdcmem, 0,0, bmp.bmWidth, bmp.bmHeight, hdcmem2, 0,0, SRCINVERT); + + // Throw out garbage + DeleteDC(hdcmem); + DeleteDC(hdcmem2); + return hbmMask; +} +// Let's make a Window's brain. +LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM NoOneCares, LPARAM NoOneCares2) +{ + switch(msg) + { + case WM_PAINT: + { + if (dir == 0) + { + draw = gwynL; + drawmask= mgwynL; + } + else + { + draw = gwyn; + drawmask= mgwyn; + } + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hwnd, &ps); + HDC hdcmem = CreateCompatibleDC(hdc); + SelectObject(hdcmem, drawmask); + BitBlt(hdc, 0,0, frameWidth, 500, hdcmem, frame*frameWidth, 0, SRCAND); + SelectObject(hdcmem, draw); + BitBlt(hdc, 0,0, frameWidth, 500, hdcmem, frame*frameWidth, 0, SRCCOPY); + //Clean it! + DeleteDC(hdcmem); + EndPaint(hwnd, &ps); + } + break; + case WM_TIMER: + { + // We need to know our direction. + int scrn_x = GetSystemMetrics(SM_CXSCREEN); + if (dir > 0) + { + if (scrn_x-500 > gwynpos){ + gwynpos = (gwynpos + 15); + } + else{ + //startup = TRUE; + dir = 0; + } + } + else + { + if (gwynpos > -50) + { + gwynpos = gwynpos - 15; + } + else + { + //startup = TRUE; + dir = 1; + } + } + frame = (frame+1) % frames; + //if (startup){ + // if (frame > 2){ + // startup = FALSE; + // } + //} + //else + //{ + // frame = frame; //Control Start up frames here. + //} + // + SetWindowPos(hwnd, NULL, gwynpos, gwyny, 0, 0, SWP_NOSIZE |SWP_NOZORDER); + + InvalidateRect(hwnd, NULL, FALSE); + UpdateWindow(hwnd); + } + break; + case WM_CREATE: + { + } + break; + case WM_CLOSE: + { + DestroyWindow(hwnd); + } + break; + case WM_DESTROY: + { + PostQuitMessage(0); + } + break; + default: + { + return DefWindowProc(hwnd, msg, NoOneCares, NoOneCares2); + } + } + return 0; +} +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE freeNull, LPSTR argv, int ncmdshow) +{ + WNDCLASSEX wc ={0}; + const char WIN_CLASS[] = "Foxxer"; + // Set the props. + wc.hInstance = GetModuleHandle(NULL); + wc.lpszClassName = WIN_CLASS; + wc.cbSize = sizeof(WNDCLASSEX); + wc.style = 0; + wc.lpfnWndProc = WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wc.lpszMenuName = NULL; + wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); + + // Let's put ourselves at the bottom left, so Gwyn's feet touch. + int screen_y = GetSystemMetrics(SM_CYSCREEN); + gwyny = screen_y -525; + // Give Windows our new window, then ask for it back + RegisterClassEx(&wc); + HWND hwnd = CreateWindowEx( + WS_EX_LAYERED, + WIN_CLASS, + NULL, + WS_POPUP, + 0, gwyny, + 500, 500, + NULL, NULL, GetModuleHandle(NULL), NULL + ); + // Let's load our bmp This will need to be moved somewhere else. + gwyn = (HBITMAP)LoadImage(NULL, "Gwyn_R.bmp", IMAGE_BITMAP, 0,0, LR_LOADFROMFILE); + gwynL = (HBITMAP)LoadImage(NULL, "Gwyn_L.bmp", IMAGE_BITMAP, 0,0, LR_LOADFROMFILE); + mgwyn = MakeMask(gwyn, RGB(255,255,255)); + mgwynL= MakeMask(gwynL, RGB(255,255,255)); + // Final Window tweaks + SetLayeredWindowAttributes(hwnd, RGB(0,0,0), 0, LWA_COLORKEY); + //Start timer, need to tweak + SetTimer(hwnd, 1, 150, NULL); + + //Launch! + ShowWindow(hwnd, SW_SHOWNORMAL); + UpdateWindow(hwnd); + + MSG msg = {0}; + while (GetMessage(&msg, NULL, 0,0) > 0) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + // Clean up! + KillTimer(hwnd, 1); + DeleteObject(gwyn); // So sad :( + return 0; +} + +