コード例 #1
0
ファイル: optionmenu.cpp プロジェクト: JoostvDoorn/TORCS
void *
TorcsOptionOptionInit(void *precMenu)
{
    if (optionHandle) return optionHandle;

    optionHandle = GfuiMenuScreenCreate("OPTIONS");

    GfuiScreenAddBgImg(optionHandle, "data/img/splash-options.png");

    GfuiMenuButtonCreate(optionHandle,
                         "Graphic", "Configure graphic parameters",
                         GraphMenuInit(optionHandle), GfuiScreenActivate);

    GfuiMenuButtonCreate(optionHandle,
                         "Display", "Configure display parameters",
                         GfScrMenuInit(optionHandle), GfuiScreenActivate);

    /*
        GfuiMenuButtonCreate(optionHandle,
    			 "Simulation", "Configure simulation parameters",
    			 SimuMenuInit(optionHandle), GfuiScreenActivate);
    */

    GfuiMenuButtonCreate(optionHandle,
                         "Sound", "Configure sound parameters",
                         SoundMenuInit(optionHandle), GfuiScreenActivate);

    GfuiMenuButtonCreate(optionHandle,
                         "OpenGL", "Configure OpenGL parameters",
                         OpenGLMenuInit(optionHandle), GfuiScreenActivate);

    GfuiMenuBackQuitButtonCreate(optionHandle,
                                 "Back",
                                 "Back to Main",
                                 precMenu,
                                 GfuiScreenActivate);

    return optionHandle;
}
コード例 #2
0
ファイル: exitmenu.cpp プロジェクト: COHRINT/cuTORCS
void * exitMenuInit(void *menu, void *menuHandle)
{
    if (menuHandle) {
		GfuiScreenRelease(menuHandle);
    }
    
    menuHandle = GfuiMenuScreenCreate("Quit ?");
    GfuiScreenAddBgImg(menuHandle, "data/img/splash-quit.png");

    GfuiMenuButtonCreate(menuHandle,
		      "No, Back to Game",
		      "Return to TORCS",
		      menu,
		      GfuiScreenActivate);
    
    GfuiMenuButtonCreate(menuHandle,
		      "Yes, Let's Quit",
		      "Exit of TORCS",
		      NULL,
		      endofprog);
    return menuHandle;
}
コード例 #3
0
ファイル: racemenu.cpp プロジェクト: COHRINT/cuTORCS
void
RmRaceParamMenu(void *vrp)
{
	int y, x, x2, dy, dx;
	const int BUFSIZE = 1024;
	char buf[BUFSIZE];

	rp = (tRmRaceParam*)vrp;
	
	snprintf(buf, BUFSIZE, "%s Options", rp->title);
	scrHandle = GfuiMenuScreenCreate(buf);
	GfuiScreenAddBgImg(scrHandle, "data/img/splash-raceopt.png");

	x = 80;
	x2 = 240;
	y = 380;
	dx = 200;
	dy = GfuiFontHeight(GFUI_FONT_LARGE) + 5;

	if (rp->confMask & RM_CONF_RACE_LEN) {
		GfuiLabelCreate(scrHandle, "Race Distance (km):", GFUI_FONT_MEDIUM_C, x, y, GFUI_ALIGN_HL_VB, 0);
		rmrpDistance = (int)GfParmGetNum(rp->param, rp->title, RM_ATTR_DISTANCE, "km", 0);
		if (rmrpDistance == 0) {
			strcpy(buf, "---");
			rmrpLaps = (int)GfParmGetNum(rp->param, rp->title, RM_ATTR_LAPS, NULL, 25);
		} else {
			snprintf(buf, BUFSIZE, "%d", rmrpDistance);
			rmrpLaps = 0;
		}
		
		rmrpDistId = GfuiEditboxCreate(scrHandle, buf, GFUI_FONT_MEDIUM_C,
						x + dx, y,
						0, 8, NULL, (tfuiCallback)NULL, rmrpUpdDist);

		y -= dy;
		GfuiLabelCreate(scrHandle, "Laps:", GFUI_FONT_MEDIUM_C, x, y, GFUI_ALIGN_HL_VB, 0);
		if (rmrpLaps == 0) {
			strcpy(buf, "---");
		} else {
			snprintf(buf, BUFSIZE, "%d", rmrpLaps);
		}
		
		rmrpLapsId = GfuiEditboxCreate(scrHandle, buf, GFUI_FONT_MEDIUM_C,
						x + dx, y,
						0, 8, NULL, (tfuiCallback)NULL, rmrpUpdLaps);
		y -= dy;
	}

	if (rp->confMask & RM_CONF_DISP_MODE) {
		GfuiLabelCreate(scrHandle, "Display:", GFUI_FONT_MEDIUM_C, x, y, GFUI_ALIGN_HL_VB, 0);
		GfuiGrButtonCreate(scrHandle, "data/img/arrow-left.png", "data/img/arrow-left.png",
				"data/img/arrow-left.png", "data/img/arrow-left-pushed.png",
				x2, y, GFUI_ALIGN_HL_VB, 1,
				(void*)0, rmChangeDisplayMode,
				NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);	    
		GfuiGrButtonCreate(scrHandle, "data/img/arrow-right.png", "data/img/arrow-right.png",
				"data/img/arrow-right.png", "data/img/arrow-right-pushed.png",
				x2 + 150, y, GFUI_ALIGN_HL_VB, 1,
				(void*)1, rmChangeDisplayMode,
				NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);
		if (!strcmp(GfParmGetStr(rp->param, rp->title, RM_ATTR_DISPMODE, RM_VAL_VISIBLE), RM_VAL_INVISIBLE)) {
			rmCurDispMode = 1;
		} else {
			rmCurDispMode = 0;
		}
		rmDispModeEditId = GfuiLabelCreate(scrHandle, rmCurDispModeList[rmCurDispMode], GFUI_FONT_MEDIUM_C, x2 + 35, y, GFUI_ALIGN_HL_VB, 20);
		y -= dy;
	}

	GfuiButtonCreate(scrHandle, "Accept", GFUI_FONT_LARGE, 210, 40, 150, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
				NULL, rmrpValidate, NULL, NULL, NULL);

	GfuiButtonCreate(scrHandle, "Cancel", GFUI_FONT_LARGE, 430, 40, 150, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
				rp->prevScreen, rmrpDeactivate, NULL, NULL, NULL);

	rmrpAddKeys();

	GfuiScreenActivate(scrHandle);
}
コード例 #4
0
void *
GraphMenuInit(void *prevMenu)
{
	int		x, y, x2, dy;
	
	/* screen already created */
	if (scrHandle) {
		return scrHandle;
	}
	
	scrHandle = GfuiMenuScreenCreate("Graphic Configuration");
	
	GfuiScreenAddBgImg(scrHandle, "data/img/splash-graphconf.png");
	
	sprintf(buf, "%s%s", GetLocalDir(), GR_PARAM_FILE);
	void * grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
	
	x = 50;
	x2 = 200;
	y = 370;
	dy = 30;
	
	GfuiLabelCreate(scrHandle, "Visibility (%):", GFUI_FONT_MEDIUM, x, y, GFUI_ALIGN_HL_VB, 0);
	FovFactorValue = (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_FOVFACT, "%", 100.0);
	sprintf(buf, "%d", FovFactorValue);
	FovEditId = GfuiEditboxCreate(scrHandle, buf, GFUI_FONT_MEDIUM_C,
					x2+10, y, 100, 16, NULL, (tfuiCallback)NULL, ChangeFov);
	
	y -= dy;
	GfuiLabelCreate(scrHandle, "Smoke:", GFUI_FONT_MEDIUM, x, y, GFUI_ALIGN_HL_VB, 0);
	SmokeValue = (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SMOKENB, NULL, 300.0);
	sprintf(buf, "%d", SmokeValue);
	SmokeEditId = GfuiEditboxCreate(scrHandle, buf, GFUI_FONT_MEDIUM_C,
					x2+10, y, 100, 16, NULL, (tfuiCallback)NULL, ChangeSmoke);
	
	y -= dy;
	GfuiLabelCreate(scrHandle, "Skid Marks:", GFUI_FONT_MEDIUM, x, y, GFUI_ALIGN_HL_VB, 0);
	SkidValue = (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_MAXSTRIPBYWHEEL, NULL, 20.0);
	sprintf(buf, "%d", SkidValue);
	SkidEditId = GfuiEditboxCreate(scrHandle, buf, GFUI_FONT_MEDIUM_C,
					x2+10, y, 100, 16, NULL, (tfuiCallback)NULL, ChangeSkid);
	
	y -= dy;
	GfuiLabelCreate(scrHandle, "LOD factor:", GFUI_FONT_MEDIUM, x, y, GFUI_ALIGN_HL_VB, 0);
	LodFactorValue = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_LODFACTOR, NULL, 1.0);
	sprintf(buf, "%g", LodFactorValue);
	LodFactorEditId = GfuiEditboxCreate(scrHandle, buf, GFUI_FONT_MEDIUM_C,
					x2+10, y, 100, 16, NULL, (tfuiCallback)NULL, ChangeLodFactor);
	
	
	GfuiButtonCreate(scrHandle, "Accept", GFUI_FONT_LARGE, 210, 40, 150, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
				prevMenu, SaveGraphicOptions, NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);
	
	GfuiButtonCreate(scrHandle, "Cancel", GFUI_FONT_LARGE, 430, 40, 150, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
				prevMenu, GfuiScreenActivate, NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);
	
	GfuiAddKey(scrHandle, 27, "Cancel", prevMenu, GfuiScreenActivate, NULL);
	
	GfParmReleaseHandle(grHandle);
	
	return scrHandle;
}