DEV Community

Audi Nugraha
Audi Nugraha

Posted on

Minimal Game Window

#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/wglext.h>

void main() {
    // Create full screen window
    HWND wnd = CreateWindow("STATIC", 0, WS_POPUP | WS_MAXIMIZE | WS_VISIBLE, 0,  0,  0,  0,  0,  0,  0,  0);
    HDC dc = GetDC(wnd);

    // Set pixel format
    PIXELFORMATDESCRIPTOR pfd = { .dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER };
    SetPixelFormat(dc, ChoosePixelFormat(dc, &pfd), &pfd);

    // Intialize OpenGL context
    wglMakeCurrent(dc, wglCreateContext(dc));

    // Enable vsync
    ((PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT"))(1);

    // More OpenGL initialization code here...

    while (TRUE) {
        // Process window message
        MSG msg;
        if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        // Break loop on ALT+F4
        if (GetAsyncKeyState(VK_MENU) && GetAsyncKeyState(VK_F4)) {
            break;
        }

        // Draw using OpenGL here...

        SwapBuffers(dc);
    }
}
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more