Get screen dimension.
RECT rect;
GetWindowRect(wnd, &rect);
#define SCREEN_WIDTH rect.right
#define SCREEN_HEIGHT rect.bottom
Is keyboard key or mouse button down?
See: https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
GetAsyncKeyState(VK_SPACE)
Get mouse location.
POINT point;
GetCursorPos(&point);
#define MOUSE_X point.x
#define MOUSE_Y point.y
Load texture from file (using GDI+).
ULONG_PTR token;
GdiplusStartupInput gsi = { .GdiplusVersion = 1 };
GdiplusStartup(&token, &gsi, 0);
// ...
GpBitmap* bitmap;
GdipCreateBitmapFromFile(L"texture.jpg", &bitmap);
BitmapData data = {};
GdipBitmapLockBits(bitmap, 0, 0, PixelFormat32bppARGB, &data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, data.Width, data.Height, 0, GL_BGRA, GL_UNSIGNED_BYTE, data.Scan0);
GdipBitmapUnlockBits(bitmap, &data);
GdipDisposeImage(bitmap);
Top comments (0)