git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@160 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-04 14:54:46 +00:00
parent f0383582b5
commit 1143a3d0d6
3 changed files with 67 additions and 108 deletions

View File

@@ -1,10 +1,6 @@
/* $Id$ */
#include <Mw/Milsko.h>
#include <Mw/OpenGL.h>
#include <GL/gl.h>
MwWidget opengl;
#define TITLE "boing"
#include "oldglut.c"
/*
* Bouncing ball demo.
@@ -157,51 +153,3 @@ static void init(void) {
glDisable(GL_DITHER);
glShadeModel(GL_FLAT);
}
static void tick(MwWidget handle, void* user, void* client) {
(void)handle;
(void)user;
(void)client;
draw();
idle();
MwOpenGLSwapBuffer(opengl);
}
static void resize(MwWidget handle, void* user, void* client) {
int ww, wh;
(void)handle;
(void)user;
(void)client;
ww = MwGetInteger(handle, MwNwidth) - 100;
wh = MwGetInteger(handle, MwNheight) - 100;
MwVaApply(opengl,
MwNwidth, ww,
MwNheight, wh,
NULL);
reshape(ww, wh);
}
int main() {
MwWidget window;
window = MwVaCreateWidget(MwWindowClass, "main", NULL, 0, 0, 500, 500,
MwNtitle, "boing",
NULL);
opengl = MwCreateWidget(MwOpenGLClass, "opengl", window, 50, 50, 400, 400);
MwOpenGLMakeCurrent(opengl);
init();
reshape(400, 400);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
MwLoop(window);
}