How do you like my new wrapper? Who said Win32 is hard?
It's mostly inspired by .NET langauges where I normally work in professionally. I wrote this wrapper to build native games, but I thought of adding a simple GUI interace with basic controls. I have buttons right now but can add text boxes, radio buttons, etc. What's nice is the WndProc function isn't visible. It's called by default, but if a callback function is assigned, it calls that instead. Each common event has a callback function option. I also use references instead of regular pointers (C++ feature). Even though it makes it look cleaner, it's hard to tell on the surface. If X3DForm_StartGameMode(frm, myGameLogicFunc) is called, it starts in real-time mode and you do your game logic in myGameLogicFunc() or whatever you call it. If it's not called, it's just a regular event-driven application. It's fun to build on, but also keeps everything fairly simple and something I might share soon after.
Code:
#include "stdafx.h"
X3DFORM frm;
X3DBUTTON btnSubmit;
void myCommandFunc(int id)
{
if (btnSubmit.ID == id) {
// do work
}
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
X3DForm_Init(frm, hInstance);
X3DForm_OnCommand(frm, myCommandFunc);
// init button
X3DForm_CreateButton(frm, btnSubmit, "Submit", 50, 50);
X3DForm_AddButton(frm, btnSubmit);
X3DForm_Show(frm);
return 0;
}