backported fixes from deeprunner
[miniglut] / miniglut.h
index af9cfcd..9eebee0 100644 (file)
@@ -1,6 +1,6 @@
 /*
 MiniGLUT - minimal GLUT subset without dependencies
-Copyright (C) 2020  John Tsiombikas <nuclear@member.fsf.org>
+Copyright (C) 2020-2022  John Tsiombikas <nuclear@member.fsf.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -21,6 +21,14 @@ along with this program.  If not, see <https://www.gnu.org/licenses/>.
 #ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN 1
 #include <windows.h>
+
+#ifdef _MSC_VER
+#pragma comment (lib, "opengl32")
+#ifndef MINIGLUT_NO_WINMM
+#pragma comment (lib, "winmm")
+#endif
+#endif /* MSVC */
+
 #endif
 #include <GL/gl.h>
 
@@ -76,7 +84,38 @@ enum {
        GLUT_INIT_WINDOW_Y,
        GLUT_INIT_WINDOW_WIDTH,
        GLUT_INIT_WINDOW_HEIGHT,
-       GLUT_ELAPSED_TIME
+       GLUT_ELAPSED_TIME,
+       GLUT_WINDOW_COLORMAP_SIZE
+};
+
+enum {
+       GLUT_RED,
+       GLUT_GREEN,
+       GLUT_BLUE
+};
+
+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 */
@@ -84,6 +123,12 @@ enum {
 #define GLUT_ACTIVE_CTRL       4
 #define GLUT_ACTIVE_ALT                8
 
+enum {
+       GLUT_KEY_REPEAT_OFF,
+       GLUT_KEY_REPEAT_ON
+};
+#define GLUT_KEY_REPEAT_DEFAULT GLUT_KEY_REPEAT_ON
+
 typedef void (*glut_cb)(void);
 typedef void (*glut_cb_reshape)(int x, int y);
 typedef void (*glut_cb_state)(int state);
@@ -94,6 +139,9 @@ typedef void (*glut_cb_motion)(int x, int y);
 typedef void (*glut_cb_sbmotion)(int x, int y, int z);
 typedef void (*glut_cb_sbbutton)(int bn, int state);
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 void glutInit(int *argc, char **argv);
 void glutInitWindowPosition(int x, int y);
@@ -113,6 +161,12 @@ void glutFullScreen(void);
 void glutSetWindowTitle(const char *title);
 void glutSetIconTitle(const char *title);
 void glutSetCursor(int cursor);
+void glutSetColor(int idx, float r, float g, float b);
+void glutWarpPointer(int x, int y);
+float glutGetColor(int idx, int comp);
+
+void glutIgnoreKeyRepeat(int ignore);
+void glutSetKeyRepeat(int repmode);
 
 void glutIdleFunc(glut_cb func);
 void glutDisplayFunc(glut_cb func);
@@ -128,7 +182,7 @@ void glutMotionFunc(glut_cb_motion func);
 void glutPassiveMotionFunc(glut_cb_motion func);
 void glutSpaceballMotionFunc(glut_cb_sbmotion func);
 void glutSpaceballRotateFunc(glut_cb_sbmotion func);
-void glutSpaceballBittonFunc(glut_cb_sbbutton func);
+void glutSpaceballButtonFunc(glut_cb_sbbutton func);
 
 int glutGet(unsigned int s);
 int glutGetModifiers(void);
@@ -146,4 +200,8 @@ void glutWireTorus(float inner_rad, float outer_rad, int sides, int rings);
 void glutSolidTeapot(float size);
 void glutWireTeapot(float size);
 
+#ifdef __cplusplus
+}      /* extern "C" */
+#endif
+
 #endif /* MINIGLUT_H_ */