assaultfish/client/main.c

53 lines
1.1 KiB
C
Raw Normal View History

2026-01-09 03:38:29 +09:00
#define MW_OPENGL_NO_INCLUDE
#define _MILSKO
2026-01-12 01:54:35 +09:00
#include <GearSrc/Foundation.h>
2026-01-09 00:40:51 +09:00
2026-01-09 03:38:29 +09:00
#include <Mw/Milsko.h>
#include <Mw/Widget/OpenGL.h>
MwWidget window, opengl;
static void gl_swapbuffer(void){
MwOpenGLSwapBuffer(opengl);
}
static void ready(int width, int height){
MwSizeHints sh;
sh.min_width = sh.max_width = width;
sh.min_height = sh.max_height = height;
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, width, height,
MwNtitle, "AssaultFish",
MwNsizeHints, &sh,
NULL);
opengl = MwCreateWidget(MwOpenGLClass, "opengl", window, 0, 0, width, height);
MwOpenGLMakeCurrent(opengl);
}
static void tick(void){
while(!window->close && MwPending(window)) MwStep(window);
}
2026-01-09 00:40:51 +09:00
int main(int argc, char** argv){
2026-01-12 01:54:35 +09:00
GSEngineParam param;
GSEngine engine;
2026-01-09 00:40:51 +09:00
2026-01-12 01:54:35 +09:00
GSEngineParamInit(&param);
2026-01-09 03:38:29 +09:00
param.ready = ready;
param.tick = tick;
param.get_tick = MwTimeGetTick;
param.sleep = MwTimeSleep;
param.gl_swapbuffer = gl_swapbuffer;
2026-01-09 00:40:51 +09:00
2026-01-12 01:54:35 +09:00
GSInit();
2026-01-09 00:40:51 +09:00
2026-01-12 01:54:35 +09:00
if((engine = GSEngineCreate(&param)) != NULL){
GSEngineLoop(engine);
GSEngineDestroy(engine);
2026-01-09 03:38:29 +09:00
}
2026-01-09 00:40:51 +09:00
}