예제 #1
0
void GameInterface::initGUI()
{
	int* option= &((XMLScene*) scene)->option;
	GLUI_Panel* viewPanel= addPanel("View Points",1);
	viewPanel->set_alignment(1);
	GLUI_RadioGroup* group = addRadioGroupToPanel(viewPanel,&((XMLScene*) scene)->viewPoint,16);
	addRadioButtonToGroup(group,"Lateral");
	addRadioButtonToGroup(group,"Upper");
	GLUI_Panel *gameModePanel = addPanel("Game", 1);
	gameModePanel->set_alignment(0);
	GLUI_Listbox* themeListBox =addListboxToPanel(gameModePanel,"Theme: ",option,8);
	themeListBox->add_item (0, "Classic");
	themeListBox->add_item (1, "Minecraft");
	themeListBox->add_item (2, "Dragon Ball");
	GLUI_Button* undo = addButtonToPanel(gameModePanel,"Undo",12);
	addColumnToPanel(gameModePanel);
	GLUI_Listbox* gameModeListbox=addListboxToPanel(gameModePanel,"Game Mode", &((XMLScene*) scene)->data->newGameMode,9);
	gameModeListbox->add_item(1,"PVP");
	gameModeListbox->add_item(2,"Player vs PC");
	gameModeListbox->add_item(3,"PC vs PC");
	GLUI_Button* redo = addButtonToPanel(gameModePanel,"Redo",13);
	addColumnToPanel(gameModePanel);
	GLUI_Panel* difficultiesPanel=addPanelToPanel(gameModePanel,"Difficulties",1);
	difficultiesPanel->set_alignment(0);
	GLUI_Listbox* difficulty1Listbox=addListboxToPanel(difficultiesPanel,"Computer 1", &((XMLScene*) scene)->data->newDifficulties[0],10);
	difficulty1Listbox->add_item(1,"Normal");
	difficulty1Listbox->add_item(2,"Hard");
	GLUI_Button* restart = addButtonToPanel(gameModePanel,"Restart",14);
	GLUI_Listbox* difficulty2Listbox=addListboxToPanel(difficultiesPanel,"Computer 2", &((XMLScene*) scene)->data->newDifficulties[1],11);
	difficulty2Listbox->add_item(1,"Normal");
	difficulty2Listbox->add_item(2,"Hard");
	GLUI_Button* gameMovie = addButtonToPanel(gameModePanel,"Game Movie",15);

}
예제 #2
0
void TPinterface::initGUI() {
	// Check CGFinterface.h and GLUI documentation for the types of controls available
	GLUI_Panel *varPanel = addPanel("Lights", 1);

	// You could also pass a reference to a variable from the scene class, if public

	addCheckboxToPanel(varPanel, "light0", &on0, 0);
	addCheckboxToPanel(varPanel, "light1", &on1, 1);
	addCheckboxToPanel(varPanel, "light2", &on2, 2);
	addCheckboxToPanel(varPanel, "light3", &on3, 3);
	addCheckboxToPanel(varPanel, "light4", &on4, 4);

	addButtonToPanel(varPanel, "Clock", 5);


	GLUI_RadioGroup* wireframeGroup = addRadioGroupToPanel(varPanel,&radioStatus, 6);

	addRadioButtonToGroup(wireframeGroup, "Textured");
	addRadioButtonToGroup(wireframeGroup, "Wireframed");



	GLUI_Listbox* listBox = addListboxToPanel(varPanel,"Textures",&listStatus, 7);

	listBox->add_item(0, "Default");
	listBox->add_item(1, "Earth");

}
예제 #3
0
파일: TPinterface.cpp 프로젝트: jpdias/CGRA
void TPinterface::initGUI()
{
	// Check CGFinterface.h and GLUI documentation for the types of controls available
	//GLUI_Panel *varPanel= addPanel("Group", 1);
	//addSpinnerToPanel(varPanel, "Val 1(interface)", 2, &testVar, 1);

	// You could also pass a reference to a variable from the scene class, if public
	//addSpinnerToPanel(varPanel, "Val 2(scene)", 2, &(((LightingScene*) scene)->sceneVar), 2);
	//addColumn ();
	GLUI_Panel *varLuz= addPanel("Luzes", 2);
	addCheckboxToPanel(varLuz, "Luz 1",&((LightingScene *) scene)->state1,NULL);
	addCheckboxToPanel(varLuz, "Luz 2",&((LightingScene *) scene)->state2,NULL);
	addCheckboxToPanel(varLuz, "Luz 3",&((LightingScene *) scene)->state3,NULL);
	addCheckboxToPanel(varLuz, "Luz 4",&((LightingScene *) scene)->state4,NULL);
	addColumn ();
	GLUI_Panel *varClock= addPanel("Relogio", 3);
	addStaticText("Relógio");
	addButton ("Pause/Start",1);
	addColumn ();
	GLUI_Panel *vartext= addPanel("Texturas",4);
	GLUI_Listbox *textvar =addListboxToPanel(vartext,"Texturas",&((LightingScene *) scene)->statetext,NULL);
	textvar->add_item (1, "Default");
	textvar->add_item (2, "Sky");
	textvar->add_item (3, "Space");
	textvar->set_int_val (3); 
	addColumn();
	GLUI_Panel *varwire= addPanel("Wireframe",5);
	GLUI_RadioGroup *group=addRadioGroupToPanel(varwire,&((LightingScene *) scene)->wire);
	addRadioButtonToGroup(group,"Normal");
	addRadioButtonToGroup(group,"Wireframe");
	addColumn();
}
예제 #4
0
void TPinterface::initGUI()
{

	pgraph = &(((LightingScene*) scene)->pgraph);

	int* wire = &(((LightingScene*) scene)->wire);

	int* wind = &(((LightingScene*) scene)->wind);

	int * cam = &(((LightingScene*) scene)->activCam);

	// Check CGFinterface.h and GLUI documentation for the types of controls available
	GLUI_Panel *varPanel= addPanel("Settings:", 1);


	GLUI_Panel *modepanel = addPanelToPanel(varPanel, "Mode", 1);
	GLUI_RadioGroup* wireFrameGroup = addRadioGroupToPanel(modepanel,wire);
	addRadioButtonToGroup(wireFrameGroup, "\tFill");
	addRadioButtonToGroup(wireFrameGroup, "\tWire");
	addRadioButtonToGroup(wireFrameGroup, "\tPoint");
	
	addColumnToPanel(varPanel);
	GLUI_Panel *cammodel = addPanelToPanel(varPanel, "Camera", 1);
	GLUI_RadioGroup* camerasGroup = addRadioGroupToPanel(cammodel,cam);
	for(int i = 0; i < cameras.size();i++)
	{

		addRadioButtonToGroup(camerasGroup, (char *)cameras[i].c_str());
	}
	addRadioButtonToGroup(camerasGroup, "Free Camera");
	

	addColumnToPanel(varPanel);
	GLUI_Panel *lightspanel = addPanelToPanel(varPanel, "Lights", 1);
	for(int i = 0; i < pgraph->getLights().size();i++)
	{
		if (pgraph->getLights()[i].enabled)
			addCheckboxToPanel(lightspanel,
			(char*)pgraph->getLights()[i].id.c_str(), NULL, i)->set_int_val(
			1);
		else
			addCheckboxToPanel(lightspanel,
			(char*)pgraph->getLights()[i].id.c_str(), NULL, i)->set_int_val(
			0);
	}

	addColumnToPanel(varPanel);
	GLUI_Panel *windpanel = addPanelToPanel(varPanel, "Wind", 1);
	GLUI_Spinner *spin=   addSpinnerToPanel(windpanel,"wind",GLUI_SPINNER_INT,wind,11);

	spin->set_int_limits(0,11,GLUI_LIMIT_WRAP);	

}
예제 #5
0
void TPinterface::initGUI()
{
	GLUI_Panel *lightPanel= addPanel("Lights",1);
	for(unsigned int i=0;i<((LightingScene*) scene)->lightState.size();i++){
		char name[30]="";
		std::string s = ((LightingScene*) scene)->lights[i]->getID();
		sprintf(name, "%s", s.c_str());
		addCheckboxToPanel(lightPanel,name,&(((LightingScene*) scene)->lightState[i]),0);
	}

	addColumn();

	GLUI_Panel *cameraPanel= addPanel("Cameras",1);
	if(((LightingScene*) scene)->cameras.size()<5){
		GLUI_RadioGroup *radioCameras=addRadioGroupToPanel(cameraPanel,&((LightingScene*) scene)->camera,1);
		for(unsigned int i=0;i<((LightingScene*) scene)->cameras.size();i++){
			char name[30]="";
			std::string s =((LightingScene*) scene)->cameras[i]->getID();
			sprintf(name, "%s", s.c_str());
			addRadioButtonToGroup(radioCameras,name);
		}
	}
	else{
		GLUI_Listbox *listbox = addListboxToPanel(cameraPanel,"Cameras",&((LightingScene*) scene)->camera,2);

		for(unsigned int i=0;i<2;i++){
			char name[30]="";
			std::string s =((LightingScene*) scene)->cameras[i]->getID();
			sprintf(name, "%s", s.c_str());
			listbox->add_item(i,name);
			((LightingScene*) scene)->camera= listbox->get_int_val();
		}
	}

	addColumn();

	GLUI_Panel *drawmodePanel= addPanel("Drawmode",1);
	GLUI_RadioGroup *radioDrawmode=addRadioGroupToPanel(drawmodePanel,&((LightingScene*) scene)->drawmode,3);
	addRadioButtonToGroup(radioDrawmode,"Point");
	addRadioButtonToGroup(radioDrawmode,"Line");
	addRadioButtonToGroup(radioDrawmode,"Fill");

	addColumn();

	GLUI_Panel *themesPanel= addPanel("Themes",1);
	GLUI_Listbox *themeslistbox = addListboxToPanel(themesPanel,"Themes",&((LightingScene*) scene)->app,4);
	themeslistbox->add_item(0, "classic");
	themeslistbox->add_item(1, "mario");
	themeslistbox->add_item(2, "dragon ball");
	themeslistbox->add_item(3, "angry birds");
}
예제 #6
0
void GraphSceneUI::initShadingModePanel() {
	char* text = new char[256];

	strcpy(text, "Shading Mode");
	GLUI_Panel* shadingModePanel = addPanel(text);

	GLUI_RadioGroup* shadingModeGroup = addRadioGroupToPanel(shadingModePanel,
			&shadingModeRadioGroupSelectedItemID, SHADING_MODE_RADIO_GROUP);

	strcpy(text, "Flat");
	addRadioButtonToGroup(shadingModeGroup, text);
	strcpy(text, "Gouraud");
	addRadioButtonToGroup(shadingModeGroup, text);
}
예제 #7
0
void Interface::initGUI()
{
	Scene * scene = ((Scene *)this->scene);
	std::vector<Light *> sceneLights = scene->getLights();
	lightsState = new int[sceneLights.size()];

	GLUI_Panel * panelLights = addPanel("Lights: ", 1);
	int * lightvalue;
	unsigned i = 0;
	for(std::vector<Light *>::iterator it = sceneLights.begin(); it != sceneLights.end() ;it++,i++){
		lights.push_back(*it);
		lightsState[i] = ((*it)->isEnabled() ? 1 : 0);
		addCheckboxToPanel (panelLights,(char *)((*it)->getIdTitle()).c_str(),&lightsState[i], i + LIGHTS_BASE_ID);
	}

	
	addColumn();

	activeCameraPosition = scene->getActiveCameraPosition();

	GLUI_Panel * cameraPanel = addPanel("Cameras: ", 1);
	GLUI_RadioGroup * rgCameras = addRadioGroupToPanel(cameraPanel,&activeCameraPosition, CAMERAS_ID);
	
	std::vector<Camera *> cameras = scene->getCameras();

	unsigned size = i + cameras.size();
	std::vector<Camera *>::iterator it = cameras.begin();	
	for(; it != cameras.end() ;it++){
		addRadioButtonToGroup (rgCameras, (char *)(*it)->getTitle().c_str());
	}

	addColumn();

	drawingMode = scene->getDrawingMode(); 

	GLUI_Panel * drawingModePanel = addPanel("Drawing mode: ", 1);
	GLUI_RadioGroup * rgDrawingMode = addRadioGroupToPanel(drawingModePanel,&drawingMode, DRAWINGMODE_ID);
	addRadioButtonToGroup (rgDrawingMode, "Fill");
	addRadioButtonToGroup (rgDrawingMode, "Line");
	addRadioButtonToGroup (rgDrawingMode, "Point");
	
	addColumn();

	shaddingMode = scene->getShaddingMode(); 

	GLUI_Panel * shaddingModePanel = addPanel("Shadding mode: ", 1);
	GLUI_RadioGroup * rgShaddingMode = addRadioGroupToPanel(shaddingModePanel,&shaddingMode, SHADDINGMODE_ID);
	addRadioButtonToGroup (rgShaddingMode, "Flat");
	addRadioButtonToGroup (rgShaddingMode, "Gouraud");
	
	addColumn();
	
	GLUI_Panel * axisModePanel = addPanel("Axis: ", 1);
	GLUI_RadioGroup * rgAxisMode = addRadioGroupToPanel(axisModePanel,&scene->showAxis, SHOWAXIS_ID);
	addRadioButtonToGroup (rgAxisMode, "Show");
	addRadioButtonToGroup (rgAxisMode, "Hide");
	
}
예제 #8
0
void GraphSceneUI::initDrawingModePanel() {
	char* text = new char[256];

	strcpy(text, "Drawing Mode");
	GLUI_Panel* drawingModePanel = addPanel(text);

	GLUI_RadioGroup* drawingModeGroup = addRadioGroupToPanel(drawingModePanel,
			&drawingModeRadioGroupSelectedItemID, DRAWING_MODE_RADIO_GROUP);

	strcpy(text, "Point");
	addRadioButtonToGroup(drawingModeGroup, text);
	strcpy(text, "Line");
	addRadioButtonToGroup(drawingModeGroup, text);
	strcpy(text, "Fill");
	addRadioButtonToGroup(drawingModeGroup, text);
}
예제 #9
0
void GraphSceneUI::initCamerasPanel() {
	char* text = new char[256];

	strcpy(text, "Cameras");
	GLUI_Panel* camerasPanel = addPanel(text);

	GLUI_RadioGroup* camerasGroup = addRadioGroupToPanel(camerasPanel,
			&activeCameraRadioGroupSelectedItemID, ACTIVE_CAMERA_RADIO_GROUP);

	map<string, Camera*>* cameras =
			((GraphScene*) scene)->getCameras()->getCameras();
	map<string, Camera*>::iterator it;

	for (it = cameras->begin(); it != cameras->end(); it++) {
		strcpy(text, it->second->getId().c_str());
		addRadioButtonToGroup(camerasGroup, text);
	}
}
예제 #10
0
파일: Interface.cpp 프로젝트: ZPaulo/LAIG
void Interface::initGUI()
{
	GLUI_Panel *geral =addPanel("Opcoes", 1);
	addColumnToPanel(geral);
	GLUI_Panel *luzesPanel = addPanelToPanel(geral,"Luzes", 1);

	for(unsigned int i=0;i<((ANFScene *) scene)->parser.lights.size();i++){

		string str=((ANFScene *) scene)->parser.lights[i]->id;
		char * writable = new char[str.size() + 1];
		copy(str.begin(), str.end(), writable);
		writable[str.size()] = '\0';


		if(((ANFScene *) scene)->parser.lights[i]->enabled==true){
			addCheckboxToPanel(luzesPanel,writable,NULL,i)->set_int_val(1);
		}
		else{
			addCheckboxToPanel(luzesPanel,writable,NULL,i)->set_int_val(0);
		}
		delete[] writable;

	}

	addColumnToPanel(geral);
	GLUI_Panel *camerasPanel = addPanelToPanel(geral,"Camaras", 1);
	GLUI_RadioGroup *cameraList = addRadioGroupToPanel(camerasPanel,&(((ANFScene *) scene)->parser.activeCam));
	
	for(unsigned int i=0;i<((ANFScene *) scene)->parser.cameras.size();i++){

		string str=((ANFScene *) scene)->parser.cameras[i]->id;
		char * writable = new char[str.size() + 1];
		copy(str.begin(), str.end(), writable);
		writable[str.size()] = '\0';

		if(i == ((ANFScene *) scene)->parser.activeCam)
			addRadioButtonToGroup(cameraList, writable)->set_int_val(1);
		else
			addRadioButtonToGroup(cameraList, writable);

		delete[] writable;

	}
	addRadioButtonToGroup(cameraList, "Default");

	addColumnToPanel(geral);
	GLUI_Panel *drawPanel = addPanelToPanel(geral,"Draw Mode", 1);
	GLUI_RadioGroup *drawList = addRadioGroupToPanel(drawPanel,&(((ANFScene *) scene)->parser.globals->drawing.mode));
	addRadioButtonToGroup(drawList, "Fill");
	addRadioButtonToGroup(drawList, "Line");
	addRadioButtonToGroup(drawList, "Point");

	addColumnToPanel(geral);
	GLUI_Panel *windPanel = addPanelToPanel(geral,"Wind Value", 1);

	GLUI_Spinner *spinner = addSpinnerToPanel(windPanel, "windScale",GLUI_SPINNER_INT,&(((ANFScene *) scene)->parser.wind),9);
	
	spinner->set_speed(0.5);
	spinner->set_int_limits(0,10,GLUI_LIMIT_WRAP);

	
	GLUI_Panel *varPanel= addPanelToPanel(geral,"Animations", 1);
	addButtonToPanel(varPanel, "Reset", 8);
}
void DemoInterface::initGUI()
{
	this->pieceSelected=false;
	scorep1=0;
	scorep2=0;
	glutReshapeWindow(680,550);
	GLUI_Panel *masterPanel=addPanel("Interface",GLUI_PANEL_RAISED);
	addStaticTextToPanel(masterPanel,"Interface");
	int atual=2;
	GLUI_Panel *globalPanel= addPanelToPanel(masterPanel,"Globals", 1);
	GLUI_RadioGroup * g1 = addRadioGroupToPanel(globalPanel,&(((DemoScene *) scene)->drawMode),1);
	addRadioButtonToGroup(g1,"Fill");
	addRadioButtonToGroup(g1,"Wireframe");
	addRadioButtonToGroup(g1,"Point");

	addColumnToPanel(masterPanel);
	addStaticTextToPanel(masterPanel,"");
	GLUI_Panel *cameraPanel= addPanelToPanel(masterPanel,"Cameras",1);
	GLUI_RadioGroup * g2 = addRadioGroupToPanel(cameraPanel,&(((DemoScene*) scene)->activeCameraNumber),atual);
	atual++;
	map<string,Camera *>::const_iterator it;

	for(it=((DemoScene*) scene)->cameras.begin();it!=((DemoScene*) scene)->cameras.end();it++){
		addRadioButtonToGroup(g2,(char*)it->second->id.c_str());
	}

	addColumnToPanel(masterPanel);
	addStaticTextToPanel(masterPanel,"");
	GLUI_Panel *lighPanel=addPanelToPanel(masterPanel,"Lights",1);
	for(unsigned int i=0;i<((DemoScene *) scene)->graphLights.size();i++){
		addCheckboxToPanel(lighPanel,(char*)((DemoScene *) scene)->graphLights.at(i)->id.c_str(),(int *)&((DemoScene *) scene)->graphLights.at(i)->state,atual);
	}
	atual++;

	atual++;
	addColumnToPanel(masterPanel);
	GLUI_Panel * ambientPanel=addPanelToPanel(masterPanel,"Game Ambient",1);
	GLUI_RadioGroup * amb=addRadioGroupToPanel(ambientPanel,&((DemoScene *) scene)->theme,atual);
	atual++;
	addRadioButtonToGroup(amb,"Wood");
	addRadioButtonToGroup(amb,"Mineral");
	addRadioButtonToGroup(amb,"Aquatic");




	GLUI_Panel * gameTimePanel = addPanel("Game Time",GLUI_PANEL_EMBOSSED);
	GLUI_Panel * timePanel = addPanelToPanel(gameTimePanel,"Game Time",1);
	GLUI_EditText * time = addEditTextToPanel(timePanel,"Current Game Time", &((DemoScene *) scene)->gameTime,1);

	GLUI_Panel * gamePanel = addPanel("Game Status",GLUI_PANEL_EMBOSSED);
	GLUI_Panel * statusPanel = addPanelToPanel(gamePanel,"Game Status",1);
	gameStatus = addStaticTextToPanel(statusPanel,"Game Status");
	char c[128];
	sprintf(c, "Current player: %d | Game score: %d - %d \n ", &((DemoScene *) scene)->player,scorep1,scorep2);
	gameStatus->set_text(c);
	addColumnToPanel(gamePanel);


	GLUI_Panel * difPanel = addPanelToPanel(gamePanel,"Game Difficulty",1);
	GLUI_RadioGroup * dif=addRadioGroupToPanel(difPanel,0,atual);
	atual++;
	addRadioButtonToGroup(dif,"Easy");
	addRadioButtonToGroup(dif,"Medium");
	addRadioButtonToGroup(dif,"Hard");	


	addColumnToPanel(gamePanel);
	GLUI_Panel * modePanel = addPanelToPanel(gamePanel,"Game Mode",1);
	GLUI_RadioGroup * mode=addRadioGroupToPanel(modePanel,&((DemoScene *) scene)->gameMode,atual);
	atual++,
	addRadioButtonToGroup(mode,"Hum vs. Hum");
	addRadioButtonToGroup(mode,"Hum vs. CPU");
	addRadioButtonToGroup(mode,"CPU vs. CPU");



	addColumnToPanel(gamePanel);
	GLUI_Panel * buttonPanel = addPanelToPanel(gamePanel,"");
	GLUI_Button * undoButton=addButtonToPanel(buttonPanel,"Undo Move",atual);
	atual++;
	GLUI_Button * replayButton=addButtonToPanel(buttonPanel,"Replay last game",atual);
	atual++;
	GLUI_Button * startButton=addButtonToPanel(buttonPanel,"Start Game",atual);
	atual++;

}