Пример #1
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);	

}
Пример #2
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);

}
Пример #3
0
void GameInterface::initGUI()
{
	int* option= &((XMLScene*) scene)->option;
	/*
	GLUI_Panel *varPanel1 = addPanel("Cameras", 1);
	int* camera = &((XMLScene*) scene)->camera;
	GLUI_Listbox *texturesListbox =addListboxToPanel(varPanel1,"Camera: ",camera,7);
	unsigned int size=((XMLScene*) scene)->file->sceneCameras.size();
	for(unsigned int i = 0;i<size;i++)
	{
	texturesListbox->add_item (i, ((XMLScene*) scene)->file->sceneCameras[i].first);
	}

	//addColumn();
	GLUI_Panel *varPanel2 = addPanel("Draw Mode", 1);
	varPanel2->set_alignment(0);
	GLUI_RadioGroup* radioGroup = addRadioGroupToPanel(varPanel2,&((XMLScene*) scene)->drawmode,3);
	addRadioButtonToGroup(radioGroup,"Fill");
	addRadioButtonToGroup(radioGroup,"Line");
	addRadioButtonToGroup(radioGroup,"Point");

	addColumn();
	*/
	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");
	GLUI_Button* undo = addButtonToPanel(gameModePanel,"Undo",12);
	addColumnToPanel(gameModePanel);
	GLUI_Listbox* gameModeListbox=addListboxToPanel(gameModePanel,"Game Mode", &((XMLScene*) scene)->data->gameMode,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->difficulties[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->difficulties[1],11);
	difficulty2Listbox->add_item(1,"Normal");
	difficulty2Listbox->add_item(2,"Hard");
	GLUI_Button* gameFilm = addButtonToPanel(gameModePanel,"Game Film",15);

}
Пример #4
0
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++;

}