/*
 * Copyright (c) 2011-2024 Ross Cunniff
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

/* OADL version of glut.h for portable OpenGL windowing.  The original
 * GLUT copyright is:
 *
 *      Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. *
 *
 *      This program is freely distributable without licensing fees  and is
 *      provided without guarantee or warrantee expressed or  implied. This
 *      program is -not- in the public domain.
 */

namespace glut {

const API_VERSION = 5;
const XLIB_IMPLEMENTATION = 15;

/* Display mode bit masks. */
const RGB = 0;
const RGBA = 0; // RGB
const INDEX = 1;
const SINGLE = 0;
const DOUBLE = 2;
const ACCUM = 4;
const ALPHA = 8;
const DEPTH = 16;
const STENCIL = 32;
const MULTISAMPLE = 128;
const STEREO = 256;
const LUMINANCE = 512;

/* Mouse buttons. */
const LEFT_BUTTON = 0;
const MIDDLE_BUTTON = 1;
const RIGHT_BUTTON = 2;

/* Mouse button  state. */
const DOWN = 0;
const UP = 1;

/* function keys */
const KEY_F1 = 1;
const KEY_F2 = 2;
const KEY_F3 = 3;
const KEY_F4 = 4;
const KEY_F5 = 5;
const KEY_F6 = 6;
const KEY_F7 = 7;
const KEY_F8 = 8;
const KEY_F9 = 9;
const KEY_F10 = 10;
const KEY_F11 = 11;
const KEY_F12 = 12;
/* directional keys */
const KEY_LEFT = 100;
const KEY_UP = 101;
const KEY_RIGHT = 102;
const KEY_DOWN = 103;
const KEY_PAGE_UP = 104;
const KEY_PAGE_DOWN = 105;
const KEY_HOME = 106;
const KEY_END = 107;
const KEY_INSERT = 108;

/* Entry/exit  state. */
const LEFT = 0;
const ENTERED = 1;

/* Menu usage  state. */
const MENU_NOT_IN_USE = 0;
const MENU_IN_USE = 1;

/* Visibility  state. */
const NOT_VISIBLE = 0;
const VISIBLE = 1;

/* Window status  state. */
const HIDDEN = 0;
const FULLY_RETAINED = 1;
const PARTIALLY_RETAINED = 2;
const FULLY_COVERED = 3;

/* Color index component selection values. */
const RED = 0;
const GREEN = 1;
const BLUE = 2;

/* Layers for use. */
const NORMAL = 0;
const OVERLAY = 1;

/* Stroke font constants (use these in GLUT program). */
const STROKE_ROMAN = 0;
const STROKE_MONO_ROMAN = 1;

/* Bitmap font constants (use these in GLUT program). */
const BITMAP_9_BY_15 = 2;
const BITMAP_8_BY_13 = 3;
const BITMAP_TIMES_ROMAN_10 = 4;
const BITMAP_TIMES_ROMAN_24 = 5;
const BITMAP_HELVETICA_10 = 6;
const BITMAP_HELVETICA_12 = 7;
const BITMAP_HELVETICA_18 = 8;

/* Get parameters. */
const WINDOW_X = 100;
const WINDOW_Y = 101;
const WINDOW_WIDTH = 102;
const WINDOW_HEIGHT = 103;
const WINDOW_BUFFER_SIZE = 104;
const WINDOW_STENCIL_SIZE = 105;
const WINDOW_DEPTH_SIZE = 106;
const WINDOW_RED_SIZE = 107;
const WINDOW_GREEN_SIZE = 108;
const WINDOW_BLUE_SIZE = 109;
const WINDOW_ALPHA_SIZE = 110;
const WINDOW_ACCUM_RED_SIZE = 111;
const WINDOW_ACCUM_GREEN_SIZE = 112;
const WINDOW_ACCUM_BLUE_SIZE = 113;
const WINDOW_ACCUM_ALPHA_SIZE = 114;
const WINDOW_DOUBLEBUFFER = 115;
const WINDOW_RGBA = 116;
const WINDOW_PARENT = 117;
const WINDOW_NUM_CHILDREN = 118;
const WINDOW_COLORMAP_SIZE = 119;
const WINDOW_NUM_SAMPLES = 120;
const WINDOW_STEREO = 121;
const WINDOW_CURSOR = 122;
const SCREEN_WIDTH = 200;
const SCREEN_HEIGHT = 201;
const SCREEN_WIDTH_MM = 202;
const SCREEN_HEIGHT_MM = 203;
const MENU_NUM_ITEMS = 300;
const DISPLAY_MODE_POSSIBLE = 400;
const INIT_WINDOW_X = 500;
const INIT_WINDOW_Y = 501;
const INIT_WINDOW_WIDTH = 502;
const INIT_WINDOW_HEIGHT = 503;
const INIT_DISPLAY_MODE = 504;
const ELAPSED_TIME = 700;
const WINDOW_FORMAT_ID = 123;

/* DeviceGet parameters. */
const HAS_KEYBOARD = 600;
const HAS_MOUSE = 601;
const HAS_SPACEBALL = 602;
const HAS_DIAL_AND_BUTTON_BOX = 603;
const HAS_TABLET = 604;
const NUM_MOUSE_BUTTONS = 605;
const NUM_SPACEBALL_BUTTONS = 606;
const NUM_BUTTON_BOX_BUTTONS = 607;
const NUM_DIALS = 608;
const NUM_TABLET_BUTTONS = 609;
const DEVICE_IGNORE_KEY_REPEAT = 610;
const DEVICE_KEY_REPEAT = 611;
const HAS_JOYSTICK = 612;
const OWNS_JOYSTICK = 613;
const JOYSTICK_BUTTONS = 614;
const JOYSTICK_AXES = 615;
const JOYSTICK_POLL_RATE = 616;

/* LayerGet parameters. */
const OVERLAY_POSSIBLE = 800;
const LAYER_IN_USE = 801;
const HAS_OVERLAY = 802;
const TRANSPARENT_INDEX = 803;
const NORMAL_DAMAGED = 804;
const OVERLAY_DAMAGED = 805;

/* VideoResizeGet parameters. */
const VIDEO_RESIZE_POSSIBLE = 900;
const VIDEO_RESIZE_IN_USE = 901;
const VIDEO_RESIZE_X_DELTA = 902;
const VIDEO_RESIZE_Y_DELTA = 903;
const VIDEO_RESIZE_WIDTH_DELTA = 904;
const VIDEO_RESIZE_HEIGHT_DELTA = 905;
const VIDEO_RESIZE_X = 906;
const VIDEO_RESIZE_Y = 907;
const VIDEO_RESIZE_WIDTH = 908;
const VIDEO_RESIZE_HEIGHT = 909;

/* UseLayer parameters. */
const NORMAL = 0;
const OVERLAY = 1;

/* GetModifiers return mask. */
const ACTIVE_SHIFT = 1;
const ACTIVE_CTRL = 2;
const ACTIVE_ALT = 4;

/* SetCursor parameters. */
/* Basic arrows. */
const CURSOR_RIGHT_ARROW = 0;
const CURSOR_LEFT_ARROW = 1;
/* Symbolic cursor shapes. */
const CURSOR_INFO = 2;
const CURSOR_DESTROY = 3;
const CURSOR_HELP = 4;
const CURSOR_CYCLE = 5;
const CURSOR_SPRAY = 6;
const CURSOR_WAIT = 7;
const CURSOR_TEXT = 8;
const CURSOR_CROSSHAIR = 9;
/* Directional cursors. */
const CURSOR_UP_DOWN = 10;
const CURSOR_LEFT_RIGHT = 11;
/* Sizing cursors. */
const CURSOR_TOP_SIDE = 12;
const CURSOR_BOTTOM_SIDE = 13;
const CURSOR_LEFT_SIDE = 14;
const CURSOR_RIGHT_SIDE = 15;
const CURSOR_TOP_LEFT_CORNER = 16;
const CURSOR_TOP_RIGHT_CORNER = 17;
const CURSOR_BOTTOM_RIGHT_CORNER = 18;
const CURSOR_BOTTOM_LEFT_CORNER = 19;
/* Inherit from parent window. */
const CURSOR_INHERIT = 100;
/* Blank cursor. */
const CURSOR_NONE = 101;
/* Fullscreen crosshair (if available). */
const CURSOR_FULL_CROSSHAIR = 102;

/* GLUT initialization sub-API. */
extern Init; //int *argcp, char **argv
extern InitDisplayMode; //unsigned int mode
extern InitDisplayString; //const char *string
extern InitWindowPosition; //int x, int y
extern InitWindowSize; //int width, int height
extern MainLoop; //void

/* GLUT window sub-API. */
extern /* int */ CreateWindow; //const char *title
extern /* int */ CreateSubWindow; //int win, int x, int y, int width, int height
extern DestroyWindow; //int win
extern PostRedisplay; //void
extern PostWindowRedisplay; //int win
extern SwapBuffers; //void
extern /* int */ GetWindow; //void
extern SetWindow; //int win
extern SetWindowTitle; //const char *title
extern SetIconTitle; //const char *title
extern PositionWindow; //int x, int y
extern ReshapeWindow; //int width, int height
extern PopWindow; //void
extern PushWindow; //void
extern IconifyWindow; //void
extern ShowWindow; //void
extern HideWindow; //void
extern FullScreen; //void
extern SetCursor; //int cursor
extern WarpPointer; //int x, int y

/* GLUT menu sub-API. */
extern /* int */ CreateMenu; //void (*func)(int)
extern DestroyMenu; //int menu
extern /* int */ GetMenu; //void
extern SetMenu; //int menu
extern AddMenuEntry; //const char *label, int value
extern AddSubMenu; //const char *label, int submenu
extern ChangeToMenuEntry; //int item, const char *label, int value
extern ChangeToSubMenu; //int item, const char *label, int submenu
extern RemoveMenuItem; //int item
extern AttachMenu; //int button
extern DetachMenu; //int button

/* GLUT window callback sub-API. */
extern DisplayFunc; //void (*func)(void)
extern ReshapeFunc; //void (*func)(int width, int height)
extern KeyboardFunc; //void (*func)(unsigned char key, int x, int y)
extern MouseFunc; //void (*func)(int button, int state, int x, int y)
extern MotionFunc; //void (*func)(int x, int y)
extern PassiveMotionFunc; //void (*func)(int x, int y)
extern EntryFunc; //void (*func)(int state)
extern VisibilityFunc; //void (*func)(int state)
extern IdleFunc; //void (*func)(void)
extern TimerFunc; //unsigned int millis, void (*func)(int value), int value
extern MenuStateFunc; //void (*func)(int state)
extern SpecialFunc; //void (*func)(int key, int x, int y)
extern MenuStatusFunc; //void (*func)(int status, int x, int y)
extern OverlayDisplayFunc; //void (*func)(void)
extern WindowStatusFunc; //void (*func)(int state)
extern KeyboardUpFunc; //void (*func)(unsigned char key, int x, int y)
extern SpecialUpFunc; //void (*func)(int key, int x, int y)
extern JoystickFunc; //void (*func)(unsigned int buttonMask, int x, int y, int z), int pollInterval

/* GLUT state retrieval sub-API. */
extern /* int */ Get; //enum type
extern /* int */ DeviceGet; //enum type
/* GLUT extension support sub-API */
extern /* int */ ExtensionSupported; //const char *name
extern /* int */ GetModifiers; //void

/* GLUT font sub-API */
extern BitmapCharacter; //void *font, int character
extern /* int */ BitmapWidth; //void *font, int character
extern StrokeCharacter; //void *font, int character
extern /* float */ StrokeWidth; //void *font, int character
extern /* int */ BitmapLength; //void *font, const unsigned char *string
extern /* int */ StrokeLength; //void *font, const unsigned char *string

/* GLUT pre-built models sub-API */
extern WireSphere; //double radius, int slices, int stacks
extern SolidSphere; //double radius, int slices, int stacks
extern WireCone; //double base, double height, int slices, int stacks
extern SolidCone; //double base, double height, int slices, int stacks
extern WireCube; //double size
extern SolidCube; //double size
extern WireTorus; //double innerRadius, double outerRadius, int sides, int rings
extern SolidTorus; //double innerRadius, double outerRadius, int sides, int rings
extern WireDodecahedron; //void
extern SolidDodecahedron; //void
extern WireTeapot; //double size
extern SolidTeapot; //double size
extern WireOctahedron; //void
extern SolidOctahedron; //void
extern WireTetrahedron; //void
extern SolidTetrahedron; //void
extern WireIcosahedron; //void
extern SolidIcosahedron; //void

/* GLUT debugging sub-API. */
extern ReportErrors; //void

/* GLUT device control sub-API. */
/* SetKeyRepeat modes. */
const KEY_REPEAT_OFF = 0;
const KEY_REPEAT_ON = 1;
const KEY_REPEAT_DEFAULT = 2;

/* Joystick button masks. */
const JOYSTICK_BUTTON_A = 1;
const JOYSTICK_BUTTON_B = 2;
const JOYSTICK_BUTTON_C = 4;
const JOYSTICK_BUTTON_D = 8;

extern IgnoreKeyRepeat; //int ignore
extern SetKeyRepeat; //int repeatMode
extern ForceJoystickFunc; //void

/* GLUT game mode sub-API. */
/* GameModeGet. */
const GAME_MODE_ACTIVE = 0;
const GAME_MODE_POSSIBLE = 1;
const GAME_MODE_WIDTH = 2;
const GAME_MODE_HEIGHT = 3;
const GAME_MODE_PIXEL_DEPTH = 4;
const GAME_MODE_REFRESH_RATE = 5;
const GAME_MODE_DISPLAY_CHANGED = 6;

extern GameModeString; //const char *string
extern /* int */ EnterGameMode; //void
extern LeaveGameMode; //void
extern /* int */ GameModeGet; //enum mode

}

using extern "libglut";