viewcontrol.cc

来自「本文件中收录了多种3D文件格式」· CC 代码 · 共 93 行

CC
93
字号
//// File: ViewControl.h// Created by: <Andrea Ingegneri>//#include <vector>#include <string>using namespace std;#include <GL/glut.h>#include "Window.h"#include "ViewControl.h"//////////////////////////////////////////////////////////////////////// Construction/Destruction//////////////////////////////////////////////////////////////////////CWindow *gViewPorts[8];CViewControl::CViewControl(string ApplicationName) : mCount(0), 													 mApplicationName(ApplicationName){   char *Argv[1];   Argv[0] = (char *) mApplicationName.c_str();   int Argc = 1;   glutInit(&Argc, Argv);}void CViewControl::Reshape(int Width, int Height){	int hWnd = glutGetWindow();	gViewPorts[hWnd]->Reshape(Width, Height);}void CViewControl::Display(){	int hWnd = glutGetWindow();	gViewPorts[hWnd]->Display();}void CViewControl::Idle(){	int hWnd = glutGetWindow();	gViewPorts[hWnd]->Idle();}void CViewControl::Keyboard(unsigned char key, int x, int y){	int hWnd = glutGetWindow();	gViewPorts[hWnd]->Keyboard(key, x, y);}bool CViewControl::AppendWindow(CWindow *Window){	glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);	glutInitWindowPosition(Window->GetPosX(), Window->GetPosY());	int hWnd = glutCreateWindow(Window->GetTitle().c_str());	gViewPorts[hWnd] = Window;	glutSetWindow(hWnd);	Window->Init();	glutDisplayFunc(Display);	glutReshapeFunc(Reshape);	glutIdleFunc(Idle);	glutKeyboardFunc(Keyboard);	glutReshapeWindow(Window->GetDimX(), Window->GetDimY());	mCount++;	mHandles.push_back(hWnd);	return true;}bool CViewControl::Start(){	glutMainLoop();	return true;}bool CViewControl::RedrawAll(){	int nHandles = mHandles.size();	if (nHandles == 0)		return false;	for (int i = 0; i < nHandles; i++)	{		int hWnd = mHandles[i];		glutSetWindow(hWnd);		glutReshapeWindow(gViewPorts[i]->GetDimX(), gViewPorts[i]->GetDimY());	}	return true;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?