math and things

This commit is contained in:
Nishi 2026-01-09 03:38:29 +09:00
commit 2fe23438b0
Signed by: nishi
GPG key ID: 27EF69B208EB9343
17 changed files with 243 additions and 35 deletions

View file

@ -3,6 +3,6 @@ project(af_client)
file(GLOB af_client_SRC *.c)
add_executable(af_client ${af_client_SRC})
target_link_libraries(af_client PRIVATE GearBox)
target_link_libraries(af_client PRIVATE GearBox Mw)
install_target(af_client)

View file

@ -1,14 +1,58 @@
#define MW_OPENGL_NO_INCLUDE
#define _MILSKO
#include <GearBox/Foundation.h>
#include <Mw/Milsko.h>
#include <Mw/Widget/OpenGL.h>
MwWidget window, opengl;
static void* gl_getprocaddress(const char* name){
return MwOpenGLGetProcAddress(opengl, name);
}
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);
}
int main(int argc, char** argv){
GBEngineParam param;
GBEngine engine;
param.server = 0;
param.client = 1;
GBEngineParamInit(&param);
param.ready = ready;
param.tick = tick;
param.get_tick = MwTimeGetTick;
param.sleep = MwTimeSleep;
param.gl_getprocaddress = gl_getprocaddress;
param.gl_swapbuffer = gl_swapbuffer;
GBInit();
engine = GBEngineCreate(&param);
GBEngineLoop(engine);
if((engine = GBEngineCreate(&param)) != NULL){
GBEngineLoop(engine);
GBEngineDestroy(engine);
}
}