-obj = test.obj miniglut.obj\r
-bin = test.exe\r
-\r
-CC = wcc386\r
-LD = wlink\r
-CFLAGS = -d3 -6r -otexan -zq -bt=nt\r
-LDFLAGS = system nt library { opengl32 winmm }\r
-\r
-$(bin): $(obj)\r
- $(LD) name $@ debug all file { $(obj) } $(LDFLAGS)\r
-\r
-.c.obj: .autodepend\r
- $(CC) -fo=$@ $(CFLAGS) $[*\r
-\r
-!ifdef __UNIX__\r
-clean: .symbolic\r
- rm -f $(obj) $(bin)\r
-!else\r
-clean: .symbolic\r
- del $(obj)\r
- del $(bin)\r
-!endif\r
+obj = test.obj miniglut.obj
+bin = test.exe
+
+CC = wcc386
+LD = wlink
+CFLAGS = -d3 -6r -otexan -zq -bt=nt
+LDFLAGS = system nt library { opengl32 winmm }
+
+$(bin): $(obj)
+ $(LD) name $@ debug all file { $(obj) } $(LDFLAGS)
+
+.c.obj: .autodepend
+ $(CC) -fo=$@ $(CFLAGS) $[*
+
+!ifdef __UNIX__
+clean: .symbolic
+ rm -f $(obj) $(bin)
+!else
+clean: .symbolic
+ del $(obj)
+ del $(bin)
+!endif
static int translate_vkey(int vkey);
static void handle_mbutton(int bn, int st, WPARAM wparam, LPARAM lparam);
+#ifdef MINIGLUT_WINMAIN
+int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, char *cmdline, int showcmd)
+{
+ int argc = 1;
+ char *argv[] = { "miniglut.exe", 0 };
+ return main(argc, argv);
+}
+#endif
+
void glutMainLoopEvent(void)
{
MSG msg;
static int translate_vkey(int vkey)
{
- return vkey; /* TODO */
+ switch(vkey) {
+ case VK_PRIOR: return GLUT_KEY_PAGE_UP;
+ case VK_NEXT: return GLUT_KEY_PAGE_DOWN;
+ case VK_END: return GLUT_KEY_END;
+ case VK_HOME: return GLUT_KEY_HOME;
+ case VK_LEFT: return GLUT_KEY_LEFT;
+ case VK_UP: return GLUT_KEY_UP;
+ case VK_RIGHT: return GLUT_KEY_RIGHT;
+ case VK_DOWN: return GLUT_KEY_DOWN;
+ default:
+ if(vkey >= VK_F1 && vkey <= VK_F12) {
+ return vkey - VK_F1 + GLUT_KEY_F1;
+ }
+ }
+ return vkey;
}
static void handle_mbutton(int bn, int st, WPARAM wparam, LPARAM lparam)
GLUT_ELAPSED_TIME
};
+enum {
+ GLUT_KEY_HOME = 0xff50,
+ GLUT_KEY_LEFT = 0xff51,
+ GLUT_KEY_UP,
+ GLUT_KEY_RIGHT,
+ GLUT_KEY_DOWN,
+ GLUT_KEY_PAGE_UP,
+ GLUT_KEY_PAGE_DOWN,
+ GLUT_KEY_END = 0xff57,
+ GLUT_KEY_INSERT = 0xff63,
+ GLUT_KEY_F1 = 0xffbe,
+ GLUT_KEY_F2,
+ GLUT_KEY_F3,
+ GLUT_KEY_F4,
+ GLUT_KEY_F5,
+ GLUT_KEY_F6,
+ GLUT_KEY_F7,
+ GLUT_KEY_F8,
+ GLUT_KEY_F9,
+ GLUT_KEY_F10,
+ GLUT_KEY_F11,
+ GLUT_KEY_F12
+};
+
/* returned by glutGetModifiers */
#define GLUT_ACTIVE_SHIFT 1
#define GLUT_ACTIVE_CTRL 4