Пример #1
0
static void onActivate(void * /* dummy */)
{
	int i;
	int index;
	int step;

	CalState = 0;
	GfuiLabelSetText(scrHandle2, InstId, Instructions[CalState]);
	glutIdleFunc(Idle2);
	glutPostRedisplay();
	for (index = 0; index < NUM_JOY; index++) {
		if (js[index]) {
			js[index]->read(&rawb[index], &ax[index * _JS_MAX_AXES]); /* initial value */
		}
	}

	for (i = 0; i < 4; i++) {
		if (i > 0) {
			step = i + 2;
		} else {
			step = i + 1;
		}
		if (Cmd[step + OFFSET_CMD].ref.type == GFCTRL_TYPE_JOY_AXIS) {
			GfuiLabelSetText(scrHandle2, LabAxisId[i], GfctrlGetNameByRef(GFCTRL_TYPE_JOY_AXIS, Cmd[step + OFFSET_CMD].ref.index));
		} else {
			GfuiLabelSetText(scrHandle2, LabAxisId[i], "---");
		}
		GfuiLabelSetText(scrHandle2, LabMinId[i], "");
		GfuiLabelSetText(scrHandle2, LabMaxId[i], "");
	}
}
Пример #2
0
static void
rmdsClickOnDriver(void * /* dummy */)
{
    char	*name;
    tDrvElt	*curDrv;
    void	*robhdle;

    name = GfuiScrollListGetSelectedElement(scrHandle, selectedScrollList, (void**)&curDrv);
    if (!name) {
	name = GfuiScrollListGetSelectedElement(scrHandle, unselectedScrollList, (void**)&curDrv);
    }
    
    if (name) {
	GfuiLabelSetText(scrHandle, PickDrvNameLabelId, curDrv->name);
	/* search driver infos */
	sprintf(buf, "%sdrivers/%s/%s.xml", GetLocalDir(), curDrv->dname, curDrv->dname);
	robhdle = GfParmReadFile(buf, GFPARM_RMODE_STD);
	if (!robhdle) {
	    sprintf(buf, "drivers/%s/%s.xml", curDrv->dname, curDrv->dname);
	    robhdle = GfParmReadFile(buf, GFPARM_RMODE_STD);
	}
	if (robhdle != NULL) {
	    sprintf(buf, "%s/%s/%d", ROB_SECT_ROBOTS, ROB_LIST_INDEX, curDrv->index);
	    GfuiLabelSetText(scrHandle, PickDrvCarLabelId, GfParmGetName(curDrv->car));
	    GfuiLabelSetText(scrHandle, PickDrvCategoryLabelId, GfParmGetStr(curDrv->car, SECT_CAR, PRM_CATEGORY, ""));
	    GfParmReleaseHandle(robhdle);
	}
    }
}
Пример #3
0
static void
rmUpdateRaceMessages()
{
	if (!rmScreenHandle)
		return;

	// Set the new text for the "message" label if it changed.
	const char *pszMsg = LmRaceEngine().outData()->_reMessage;
	if ((pszMsg && rmStrCurMsg != pszMsg) || (!pszMsg && !rmStrCurMsg.empty()))
	{
		rmStrCurMsg = pszMsg ? pszMsg : "";
		GfuiLabelSetText(rmScreenHandle, rmMsgId, rmStrCurMsg.c_str());
		
		// The menu changed.
		rmbMenuChanged = true;
	}
	
	// Set the new text for the "big message" label if it changed.
	const char *pszBigMsg = LmRaceEngine().outData()->_reBigMessage;
	if ((pszBigMsg && rmStrCurBigMsg != pszBigMsg) || (!pszBigMsg && !rmStrCurBigMsg.empty()))
	{
		rmStrCurBigMsg = pszBigMsg ? pszBigMsg : "";
		GfuiLabelSetText(rmScreenHandle, rmBigMsgId, rmStrCurBigMsg.c_str());
		
		// The menu changed.
		rmbMenuChanged = true;
	}
}
Пример #4
0
void
RmResScreenAddText(const char *text)
{
    if (!rmResScreenHdle)
		return;
	
    if (rmCurRowIndex == rmNMaxResRows)
	{
		free(rmResRowText[0]);
		for (int i = 1; i < rmNMaxResRows; i++)
		{
			rmResRowText[i - 1] = rmResRowText[i];
			GfuiLabelSetText(rmResScreenHdle, rmResRowLabelId[i - 1], rmResRowText[i]);
		}
		rmCurRowIndex--;
    }
	else
	{
		free(rmResRowText[rmCurRowIndex]);
	}
    rmResRowText[rmCurRowIndex] = rmCleanRowText(text);
    GfuiLabelSetText(rmResScreenHdle, rmResRowLabelId[rmCurRowIndex], rmResRowText[rmCurRowIndex]);
    rmCurRowIndex++;
	
	// The menu changed.
	rmbResMenuChanged = true;
}
Пример #5
0
// Read sound configuration.
static void readSoundCfg(void)
{
	const char *optionName;
	int	i;
	char buf[1024];

	// Sound interface.
	sprintf(buf, "%s%s", GfLocalDir(), SND_PARAM_FILE);
	void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
	optionName = GfParmGetStr(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_STATE, soundOptionList[0]);

	for (i = 0; i < nbOptions; i++) {
		if (strcmp(optionName, soundOptionList[i]) == 0) {
			curOption = i;
			break;
		}
	}

	GfuiLabelSetText(scrHandle, SoundOptionId, soundOptionList[curOption]);

	// Sound volume.
	VolumeValue = GfParmGetNum(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_VOLUME, "%", 100.0f);
	if (VolumeValue>100.0f) {
		VolumeValue = 100.0f;
	} 
	else if (VolumeValue < 0.0f) {
		VolumeValue = 0.0f;
	}

	sprintf(buf, "%g", VolumeValue);
	GfuiEditboxSetString(scrHandle, VolumeValueId, buf);

	optionName = GfParmGetStr(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_STATE, musicStateList[0]);

	for (i = 0; i < nbMusicStates; i++) {
		if (strcmp(optionName, musicStateList[i]) == 0) {
			curMusicState = i;
			break;
		}
	}

	GfuiLabelSetText(scrHandle, MusicStateId, musicStateList[curMusicState]);

	// Music volume.
	MusicVolumeValue = GfParmGetNum(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_VOLUME, "%", 100.0f);
	if (MusicVolumeValue>100.0f) {
		MusicVolumeValue = 100.0f;
	} 
	else if (MusicVolumeValue < 0.0f) {
		MusicVolumeValue = 0.0f;
	}

		sprintf(buf, "%g", MusicVolumeValue);
	GfuiEditboxSetString(scrHandle, MusicVolumeValueId, buf);

	GfParmReleaseHandle(paramHandle);
}
Пример #6
0
static void advanceStep (void)
{
    int i;
    int nextAxis = GFCTRL_JOY_NUMBER * GFCTRL_JOY_MAX_AXES;

    AtobCount++;

    if (CalState <= 0) {
	CalState++;
	AtobCount = 0;
    }

    /* scan through cmds looking for the next ATOB on this axis */
    while (AtobCount <= CMD_END_OF_LIST) {
	if (Cmd[AtobCount].ref.type == GFCTRL_TYPE_JOY_ATOB 
		&& Cmd[AtobCount].ref.index == AtobAxis) {
	    GfuiLabelSetText(ScrHandle, AtobCommandID, Cmd[AtobCount].name);
	    return;
	}
	AtobCount++;
    }

    /* Pause briefly to compute thresholds */
    if (CalState ==2) {
	CalState = 3;
	return;
    } 

    /* no more new ATOBs for this axis, scan for next smallest axis */
    AtobCount = 0;

    for (i = 0; i <= CMD_END_OF_LIST; i++) {
	if (Cmd[i].ref.type == GFCTRL_TYPE_JOY_ATOB 
		&& nextAxis > Cmd[i].ref.index && AtobAxis < Cmd[i].ref.index) {
	    nextAxis = Cmd[i].ref.index;
	    AtobCount ++;
	}
    }
    if (AtobCount) {
	AtobAxis = nextAxis;

	/* find first command on new axis */
	for (AtobCount = 0; AtobCount <= CMD_END_OF_LIST; AtobCount++) {
	    if (Cmd[AtobCount].ref.type == GFCTRL_TYPE_JOY_ATOB 
		    && Cmd[AtobCount].ref.index == AtobAxis) {
    		GfuiLabelSetText(ScrHandle, AtobAxisID, GfctrlGetNameByRef(GFCTRL_TYPE_JOY_ATOB, AtobAxis));
		GfuiLabelSetText(ScrHandle, AtobCommandID, Cmd[AtobCount].name);
		CalState = 1;
		return;
	    }
	}
    }

    /* no more ATOBs found, we're done */
}
Пример #7
0
static void loadSimuCfg(void)
{
	const char *simuVersionName;
	const char *multiThreadSchemeName;
	const char *threadAffinitySchemeName;
	int i;

	char buf[1024];
	snprintf(buf, sizeof(buf), "%s%s", GfLocalDir(), RACE_ENG_CFG);

	void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);

	// Simulation engine name.
	simuVersionName = GfParmGetStr(paramHandle, RM_SECT_MODULES, RM_ATTR_MOD_SIMU, SimuVersionList[DefaultSimuVersion]);
	for (i = 0; i < NbSimuVersions; i++) {
		if (strcmp(simuVersionName, SimuVersionList[i]) == 0) {
			CurSimuVersion = i;
			break;
		}
	}

	// Check if the selected simulation module is there, and fall back to the default one if not.
	snprintf(buf, sizeof(buf), "%smodules/simu/%s.%s", GfLibDir(), SimuVersionList[CurSimuVersion], DLLEXT);
	if (!GfFileExists(buf))
	{
		GfLogWarning("User settings %s physics engine module not found ; falling back to %s\n",
					 SimuVersionList[CurSimuVersion], SimuVersionList[DefaultSimuVersion]);
		CurSimuVersion = DefaultSimuVersion;
	}

	// Multi-threading.
	multiThreadSchemeName = GfParmGetStr(paramHandle, RM_SECT_RACE_ENGINE, RM_ATTR_MULTI_THREADING, MultiThreadSchemeList[0]);
	for (i = 0; i < NbMultiThreadSchemes; i++) {
		if (strcmp(multiThreadSchemeName, MultiThreadSchemeList[i]) == 0) {
			CurMultiThreadScheme = i;
			break;
		}
	}

	// Thread affinity.
	threadAffinitySchemeName = GfParmGetStr(paramHandle, RM_SECT_RACE_ENGINE, RM_ATTR_THREAD_AFFINITY, ThreadAffinitySchemeList[0]);
	for (i = 0; i < NbThreadAffinitySchemes; i++) {
		if (strcmp(threadAffinitySchemeName, ThreadAffinitySchemeList[i]) == 0) {
			CurThreadAffinityScheme = i;
			break;
		}
	}

	GfParmReleaseHandle(paramHandle);

	GfuiLabelSetText(ScrHandle, SimuVersionId, SimuVersionDispNameList[CurSimuVersion]);
	GfuiLabelSetText(ScrHandle, MultiThreadSchemeId, MultiThreadSchemeList[CurMultiThreadScheme]);
	GfuiLabelSetText(ScrHandle, ThreadAffinitySchemeId, ThreadAffinitySchemeList[CurThreadAffinityScheme]);
}
Пример #8
0
void
RmResScreenSetTitles(const char *pszTitle, const char *pszSubTitle)
{
    if (!rmResScreenHdle)
		return;
	
	GfuiLabelSetText(rmResScreenHdle, rmResTitleId, pszTitle);
	GfuiLabelSetText(rmResScreenHdle, rmResSubTitleId, pszSubTitle);
	
	// The menu changed.
	rmbResMenuChanged = true;
}
Пример #9
0
void
ReSetRaceBigMsg(const char *msg)
{
	static char *curMsg = 0;
	
	if (curMsg) free(curMsg);

	if (msg) {
		curMsg = strdup(msg);
		GfuiLabelSetText(reScreenHandle, reBigMsgId, curMsg);
	} else {
		curMsg = 0;
		GfuiLabelSetText(reScreenHandle, reBigMsgId, "");
	}
}
Пример #10
0
static void
onActivate(void * /* dummy */)
{
    int i;
    int index;
    
    // Create and test joysticks ; only keep the up and running ones.
    for (index = 0; index < GFCTRL_JOY_NUMBER; index++) {
	Joystick[index] = new jsJoystick(index);
	if (Joystick[index]->notWorking()) {
	    /* don't configure the joystick */
	    delete Joystick[index];
	    Joystick[index] = 0;
	}
    }

    CalState = 0;
    AtobAxis = GFCTRL_JOY_NUMBER * GFCTRL_JOY_MAX_AXES;;

    /* Find commands which are ATOB */
    for (i = 0; i <= CMD_END_OF_LIST; i++) {
	if (Cmd[i].ref.type == GFCTRL_TYPE_JOY_ATOB) {
	    if (AtobAxis > Cmd[i].ref.index) AtobAxis = Cmd[i].ref.index;
	}
    }
    for (AtobCount = 0; AtobCount <= CMD_END_OF_LIST; AtobCount++) {
	if (Cmd[AtobCount].ref.index == AtobAxis) break;
    }

    /* Set label titles */
    GfuiLabelSetText(ScrHandle, AtobAxisID, GfctrlGetNameByRef(GFCTRL_TYPE_JOY_ATOB, AtobAxis));
    GfuiLabelSetText(ScrHandle, AtobCommandID, "---");

    GfuiLabelSetText(ScrHandle, InstId, Instructions[CalState]);
    GfuiApp().eventLoop().setRecomputeCB(Idle2);
    GfuiApp().eventLoop().postRedisplay();
    for (index = 0; index < GFCTRL_JOY_NUMBER; index++) {
	if (Joystick[index]) {
	    Joystick[index]->read(&JoyButtons[index], &JoyAxis[index * GFCTRL_JOY_MAX_AXES]); /* initial value */
	}
    }

    GfuiEnable(ScrHandle, CancelBut, GFUI_ENABLE);
    if (DoneBut)
	GfuiEnable(ScrHandle, DoneBut, GFUI_DISABLE);
    else
	GfuiEnable(ScrHandle, NextBut, GFUI_DISABLE);
}
Пример #11
0
static void
onActivate(void * /* dummy */)
{
    int i;
    int index;
    int step;
    
    // Create and test joysticks ; only keep the up and running ones.
    for (index = 0; index < GFCTRL_JOY_NUMBER; index++) {
	Joystick[index] = new jsJoystick(index);
	if (Joystick[index]->notWorking()) {
	    /* don't configure the joystick */
	    delete Joystick[index];
	    Joystick[index] = 0;
	}
    }

    CalState = 0;
    GfuiLabelSetText(ScrHandle, InstId, Instructions[CalState]);
    GfuiApp().eventLoop().setRecomputeCB(Idle2);
    GfuiApp().eventLoop().postRedisplay();
    for (index = 0; index < GFCTRL_JOY_NUMBER; index++) {
	if (Joystick[index]) {
	    Joystick[index]->read(&JoyButtons[index], &JoyAxis[index * GFCTRL_JOY_MAX_AXES]); /* initial value */
	}
    }

    for (i = 0; i < NbMaxCalAxis; i++) {
	if (i > 0) {
	    step = i + 2;
	} else {
	    step = i + 1;
	}
	if (Cmd[step + CmdOffset].ref.type == GFCTRL_TYPE_JOY_AXIS) {
	    GfuiLabelSetText(ScrHandle, LabAxisId[i], GfctrlGetNameByRef(GFCTRL_TYPE_JOY_AXIS, Cmd[step + CmdOffset].ref.index));
	} else {
	    GfuiLabelSetText(ScrHandle, LabAxisId[i], "---");
	}
	GfuiLabelSetText(ScrHandle, LabMinId[i], "");
 	GfuiLabelSetText(ScrHandle, LabMaxId[i], "");
    }

    GfuiEnable(ScrHandle, CancelBut, GFUI_ENABLE);
    if (DoneBut)
	GfuiEnable(ScrHandle, DoneBut, GFUI_DISABLE);
    else
	GfuiEnable(ScrHandle, NextBut, GFUI_DISABLE);
}
Пример #12
0
void
ReResScreenSetTitle(char *title)
{
	if (reResScreenHdle) {
		GfuiLabelSetText(reResScreenHdle, reResTitleId, title);
	}
}
Пример #13
0
static void rmCatPrevNext(void *vsel)
{
	const int BUFSIZE = 1024;
	char buf[BUFSIZE];

	if (vsel == 0) {
		CategoryList = CategoryList->prev;
	} else {
		CategoryList = CategoryList->next;
	}

	GfuiLabelSetText(scrHandle, CatLabelId, CategoryList->dispName);
	GfuiLabelSetText(scrHandle, TrackLabelId, ((tFList*)CategoryList->userData)->dispName);
	GfuiStaticImageSet(scrHandle, MapId, rmGetMapName(buf, BUFSIZE));
	rmUpdateTrackInfo();
}
Пример #14
0
/** 
    @ingroup	racemantools
    @param	text	Text to display.
    @return	None.
*/
void
RmLoadingScreenSetText(const char *text)
{
    GfLogTrace("%s\n", text);
    
    if (!HScreen)
	{
		//GfLogWarning("Can't display loading message : loading screen not created.\n");
		return;
	}
	
	if (TextLines[CurTextLineIdx])
		freez(TextLines[CurTextLineIdx]);
	if (text)
	{
		TextLines[CurTextLineIdx] = strdup(text);
		CurTextLineIdx = (CurTextLineIdx + 1) % NTextLines;
	}
	
	int i = CurTextLineIdx;
	int j = 0;
	do
	{
		if (TextLines[i])
			GfuiLabelSetText(HScreen, TextLineIds[j], TextLines[i]);
		j++;
		i = (i + 1) % NTextLines;
	}
	while (i != CurTextLineIdx);
	
	GfuiDisplay();
}
Пример #15
0
/** 
    @ingroup	racemantools
    @param	text	Text to display.
    @return	None.
*/
void
RmLoadingScreenSetText(char *text)
{
    int		i, j;
    
    GfOut("%s\n", text);
    
    if (menuHandle) {
	if (rmTextLines[rmCurText]) {
	    free(rmTextLines[rmCurText]);
	}
	if (text) {
	    rmTextLines[rmCurText] = strdup(text);
	    rmCurText = (rmCurText + 1) % TEXTLINES;
	}
	
	i = rmCurText;
	j = 0;
	do {
	    if (rmTextLines[i]) {
		GfuiLabelSetText(menuHandle, rmTextId[j], rmTextLines[i]);
	    }
	    j++;
	    i = (i + 1) % TEXTLINES;
	} while (i != rmCurText);
	
	GfuiDisplay();
    }
}
Пример #16
0
// Read sound configuration.
static void readSoundCfg(void)
{
	const char *optionName;
	int	i;
	char buf[1024];

	sprintf(buf, "%s%s", GetLocalDir(), GR_SOUND_PARM_CFG);
	void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
	optionName = GfParmGetStr(paramHandle, GR_SCT_SOUND, GR_ATT_SOUND_STATE, soundOptionList[0]);

	for (i = 0; i < nbOptions; i++) {
		if (strcmp(optionName, soundOptionList[i]) == 0) {
			curOption = i;
			break;
		}
	}

    VolumeValue = GfParmGetNum(paramHandle, GR_SCT_SOUND, GR_ATT_SOUND_VOLUME, "%", 100.0f);
	if (VolumeValue>100.0f) {
		VolumeValue = 100.0f;
	} 
	if (VolumeValue < 0.0f) {
		VolumeValue = 0.0f;
	}

	GfParmReleaseHandle(paramHandle);

	GfuiLabelSetText(scrHandle, SoundOptionId, soundOptionList[curOption]);
}
Пример #17
0
static void
JoyCalAutomaton(void)
{
	static int axis;
	const int BUFSIZE = 1024;
	char buf[BUFSIZE];
	
    switch (CalState) {
		case 0:
			memcpy(axCenter, ax, sizeof(axCenter));
			advanceStep();
			break;
		case 1:
			axis = Cmd[CalState + OFFSET_CMD].ref.index;
			Cmd[CalState + OFFSET_CMD].min = ax[axis];
			Cmd[CalState + OFFSET_CMD].max = axCenter[axis];
			Cmd[CalState + OFFSET_CMD].pow = 1.0;
			snprintf(buf, BUFSIZE, "%.2g", ax[axis]);
			GfuiLabelSetText(scrHandle2, LabMinId[0], buf);
			advanceStep();
			break;
		case 2:
			axis = Cmd[CalState + OFFSET_CMD].ref.index;
			Cmd[CalState + OFFSET_CMD].min = axCenter[axis];
			Cmd[CalState + OFFSET_CMD].max = ax[axis];
			Cmd[CalState + OFFSET_CMD].pow = 1.0;
			snprintf(buf, BUFSIZE, "%.2g", ax[axis]);
			GfuiLabelSetText(scrHandle2, LabMaxId[0], buf);
			advanceStep();
			break;
		case 3:
		case 4:
		case 5:
			axis = Cmd[CalState + OFFSET_CMD].ref.index;
			Cmd[CalState + OFFSET_CMD].min = axCenter[axis];
			Cmd[CalState + OFFSET_CMD].max = ax[axis]*1.1;
			Cmd[CalState + OFFSET_CMD].pow = 1.2;
			snprintf(buf, BUFSIZE, "%.2g", axCenter[axis]);
			GfuiLabelSetText(scrHandle2, LabMinId[CalState - 2], buf);
			snprintf(buf, BUFSIZE, "%.2g", ax[axis]*1.1);
			GfuiLabelSetText(scrHandle2, LabMaxId[CalState - 2], buf);
			advanceStep();
			break;
    }
    GfuiLabelSetText(scrHandle2, InstId, Instructions[CalState]);
}
Пример #18
0
// Read sound configuration.
static void readSoundCfg(void)
{
	const char *optionName;
	int	i;
	const int BUFSIZE = 1024;
	char buf[BUFSIZE];

	snprintf(buf, BUFSIZE, "%s%s", GetLocalDir(), GR_SOUND_PARM_CFG);
	
	void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
	optionName = GfParmGetStr(paramHandle, GR_SCT_SOUND, GR_ATT_SOUND_STATE, soundOptionList[0]);

	for (i = 0; i < nbOptions; i++) {
		if (strcmp(optionName, soundOptionList[i]) == 0) {
			curOption = i;
			break;
		}
	}

    VolumeValue = GfParmGetNum(paramHandle, GR_SCT_SOUND, GR_ATT_SOUND_VOLUME, "%", 100.0f);
	if (VolumeValue>100.0f) {
		VolumeValue = 100.0f;
	} 
	if (VolumeValue < 0.0f) {
		VolumeValue = 0.0f;
	}

	GfParmReleaseHandle(paramHandle);

	GfuiLabelSetText(scrHandle, SoundOptionId, soundOptionList[curOption]);
	
	// Read Menu music optons
	snprintf(buf, BUFSIZE, "%s%s", GetLocalDir(), MM_SOUND_PARM_CFG);
	paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
	optionName = GfParmGetStr(paramHandle, MM_SCT_SOUND, MM_ATT_SOUND_ENABLE, MM_VAL_SOUND_DISABLED);
	
	if (strcmp(optionName, MM_VAL_SOUND_ENABLED) == 0) {
		GfuiLabelSetText(scrHandle, MenuMusicOptionId, MM_VAL_SOUND_ENABLED);
		curOptionMenuMusic = 1;
	} else {
		GfuiLabelSetText(scrHandle, MenuMusicOptionId, MM_VAL_SOUND_DISABLED);
		curOptionMenuMusic = 0;
	}
	
	GfParmReleaseHandle(paramHandle);
}
Пример #19
0
/* Change the multi-threading scheme */
static void
onChangeMultiThreadScheme(void *vp)
{
	CurMultiThreadScheme =
		(CurMultiThreadScheme + NbMultiThreadSchemes + (int)(long)vp) % NbMultiThreadSchemes;
	
	GfuiLabelSetText(ScrHandle, MultiThreadSchemeId, MultiThreadSchemeList[CurMultiThreadScheme]);
}
Пример #20
0
/* Change the thread affinity scheme */
static void
onChangeThreadAffinityScheme(void *vp)
{
	CurThreadAffinityScheme =
		(CurThreadAffinityScheme + NbThreadAffinitySchemes + (int)(long)vp) % NbThreadAffinitySchemes;
	
	GfuiLabelSetText(ScrHandle, ThreadAffinitySchemeId, ThreadAffinitySchemeList[CurThreadAffinityScheme]);
}
Пример #21
0
void
ReResScreenAddText(char *text)
{
    int		i;

    if (reCurLine == LINES) {
	free(reResMsg[0]);
	for (i = 1; i < LINES; i++) {
	    reResMsg[i - 1] = reResMsg[i];
	    GfuiLabelSetText(reResScreenHdle, reResMsgId[i - 1], reResMsg[i]);
	}
	reCurLine--;
    }
    reResMsg[reCurLine] = strdup(text);
    GfuiLabelSetText(reResScreenHdle, reResMsgId[reCurLine], reResMsg[reCurLine]);
    reCurLine++;
}
Пример #22
0
void
ReResScreenRemoveText(int line)
{
    if (line < LINES) {
	FREEZ(reResMsg[line]);
	GfuiLabelSetText(reResScreenHdle, reResMsgId[line], "");
    }
}
Пример #23
0
// Toggle menu music state between enabled and disabled.
static void changeMenuMusicState(void *vp)
{
	if (curOptionMenuMusic == 0) {
		curOptionMenuMusic = 1;
	} else {
		curOptionMenuMusic = 0;
	}

	GfuiLabelSetText(scrHandle, MenuMusicOptionId, menuMusicList[curOptionMenuMusic]);
}
Пример #24
0
void
RmResScreenSetHeader(const char *pszHeader)
{
    if (!rmResScreenHdle)
		return;
	
	GfuiLabelSetText(rmResScreenHdle, rmResHeaderId, pszHeader);
	
	// The menu changed.
	rmbResMenuChanged = true;
}
Пример #25
0
static void
rmdsSetFocus(void * /* dummy */)
{
    char	*name;
    tDrvElt	*curDrv;

    name = GfuiScrollListGetSelectedElement(scrHandle, selectedScrollList, (void**)&curDrv);
    if (name) {
	GfParmSetStr(ds->param, RM_SECT_DRIVERS, RM_ATTR_FOCUSED, curDrv->dname);
	GfParmSetNum(ds->param, RM_SECT_DRIVERS, RM_ATTR_FOCUSEDIDX, (char*)NULL, curDrv->index);
	GfuiLabelSetText(scrHandle, FocDrvLabelId, curDrv->name);
    }
}
Пример #26
0
static void
onActivate2(void * /* dummy */)
{
	int dummy;

	GfScrGetSize(&scrw, &scrh, &dummy, &dummy);
	CalState = 0;
	GetNextAxis();
	GfuiLabelSetText(scrHandle2, InstId, Instructions[CalState]);
	if (CalState < 4) {
		glutIdleFunc(IdleMouseInit);
		GfctrlMouseCenter();
	}
}
Пример #27
0
static void
MouseCalAutomaton(void)
{
    float axv;

    switch (CalState) {
    case 0:
    case 1:
	GfctrlMouseGetCurrentState(&MouseInfo);
	axv = MouseInfo.ax[Cmd[CmdOffset + CalState].ref.index];
	if (fabs(axv) < 0.01) {
	    return;		/* ignore no move input */
	}
	Cmd[CmdOffset + CalState].max = axv;
	Cmd[CmdOffset + CalState].pow = 1.0 / axv;
	break;

    case 2:
    case 3:
	GfctrlMouseGetCurrentState(&MouseInfo);
	axv = MouseInfo.ax[Cmd[CmdOffset + CalState].ref.index];
	if (fabs(axv) < 0.01) {
	    return;		/* ignore no move input */
	}
	Cmd[CmdOffset + CalState].max = axv;
	Cmd[CmdOffset + CalState].pow = 1.0 / axv;
	break;
	
    }

    CalState++;
    CalState = GetNextAxis();
    GfuiLabelSetText(ScrHandle, InstId, Instructions[CalState]);
    if (CalState < 4) {
	GfuiApp().eventLoop().setRecomputeCB(Idle2);
    } else {
	GfuiApp().eventLoop().setRecomputeCB(0);
	GfuiApp().eventLoop().postRedisplay();
    }

    /* Change button appearance when done */
    if (CalState == 4) {
	GfuiEnable(ScrHandle, CancelBut, GFUI_DISABLE);
	if (DoneBut)
	   GfuiEnable(ScrHandle, DoneBut, GFUI_ENABLE);
	else
	   GfuiEnable(ScrHandle, NextBut, GFUI_ENABLE);
    }
}
Пример #28
0
void
RmResScreenRemoveText(int row)
{
	if (!rmResScreenHdle)
		return;
	
	if (row < rmNMaxResRows)
	{
		freez(rmResRowText[row]);
		GfuiLabelSetText(rmResScreenHdle, rmResRowLabelId[row], "");
		
		// The menu changed.
		rmbResMenuChanged = true;
    }
}
Пример #29
0
void
ReResScreenSetText(const char *text, int line, int clr)
{
	if (line < LINES) {
		FREEZ(reResMsg[line]);
		reResMsg[line] = strdup(text);
		if ((clr >= 0) && (clr < 2)) {
			reResMsgClr[line] = clr;
		} else {
			reResMsgClr[line] = 0;
		}
		GfuiLabelSetText(reResScreenHdle, reResMsgId[line], reResMsg[line]);
		GfuiLabelSetColor(reResScreenHdle, reResMsgId[line], reColor[reResMsgClr[line]]);
	}
}
Пример #30
0
// Toggle sound state openal/plib/disabled.
static void changeSoundState(void *vp)
{
	if (vp == 0) {
		curOption--;
		if (curOption < 0) {
	    	curOption = nbOptions - 1;
		}
	} else {
		curOption++;
		if (curOption == nbOptions) {
	    curOption = 0;
	}
    }
    GfuiLabelSetText(scrHandle, SoundOptionId, soundOptionList[curOption]);
}