📄 glutcallback.cpp
字号:
/*********************************************************** * Copyright (C) 1997, Be Inc. Copyright (C) 1999, Jake Hamby. * * 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. * * * FILE: glutCallback.cpp * * DESCRIPTION: put all the callback setting routines in * one place ***********************************************************//*********************************************************** * Headers ***********************************************************/#include <GL/glut.h>#include "glutint.h"#include "glutState.h"/*********************************************************** * Window related callbacks ***********************************************************/void APIENTRY glutDisplayFunc(GLUTdisplayCB displayFunc){ /* XXX Remove the warning after GLUT 3.0. */ if (!displayFunc) __glutFatalError("NULL display callback not allowed in GLUT 3.0; update your code."); gState.currentWindow->display = displayFunc;}void APIENTRY glutKeyboardFunc(GLUTkeyboardCB keyboardFunc){ gState.currentWindow->keyboard = keyboardFunc;}void APIENTRY glutSpecialFunc(GLUTspecialCB specialFunc){ gState.currentWindow->special = specialFunc;}void APIENTRY glutMouseFunc(GLUTmouseCB mouseFunc){ gState.currentWindow->mouse = mouseFunc;}void APIENTRY glutMotionFunc(GLUTmotionCB motionFunc){ gState.currentWindow->motion = motionFunc;}void APIENTRY glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc){ gState.currentWindow->passive = passiveMotionFunc;}void APIENTRY glutEntryFunc(GLUTentryCB entryFunc){ gState.currentWindow->entry = entryFunc; if (!entryFunc) { gState.currentWindow->entryState = -1; }}void APIENTRYglutWindowStatusFunc(GLUTwindowStatusCB windowStatusFunc){ gState.currentWindow->windowStatus = windowStatusFunc;}static voidvisibilityHelper(int status){ if (status == GLUT_HIDDEN || status == GLUT_FULLY_COVERED) gState.currentWindow->visibility(GLUT_NOT_VISIBLE); else gState.currentWindow->visibility(GLUT_VISIBLE);}void APIENTRY glutVisibilityFunc(GLUTvisibilityCB visibilityFunc){ gState.currentWindow->visibility = visibilityFunc; if (visibilityFunc) glutWindowStatusFunc(visibilityHelper); else glutWindowStatusFunc(NULL);}void APIENTRY glutReshapeFunc(GLUTreshapeCB reshapeFunc){ if (reshapeFunc) { gState.currentWindow->reshape = reshapeFunc; } else { gState.currentWindow->reshape = __glutDefaultReshape; }}/*********************************************************** * General callbacks (timer callback in glutEvent.cpp) ***********************************************************//* DEPRICATED, use glutMenuStatusFunc instead. */void APIENTRYglutMenuStateFunc(GLUTmenuStateCB menuStateFunc){ gState.menuStatus = (GLUTmenuStatusCB) menuStateFunc;}void APIENTRYglutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc){ gState.menuStatus = menuStatusFunc;}void APIENTRYglutIdleFunc(GLUTidleCB idleFunc){ gState.idle = idleFunc;}/*********************************************************** * Unsupported callbacks ***********************************************************/void APIENTRYglutOverlayDisplayFunc(GLUTdisplayCB displayFunc){}void APIENTRYglutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc){}void APIENTRYglutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc){}void APIENTRYglutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc){}void APIENTRYglutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc){}void APIENTRYglutDialsFunc(GLUTdialsCB dialsFunc){}void APIENTRYglutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc){}void APIENTRYglutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc){}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -