コード例 #1
0
void idChoiceWindow::Draw(int time, float x, float y) {
	idVec4 color = foreColor;

	UpdateChoicesAndVals();
	UpdateChoice();

	// FIXME: It'd be really cool if textAlign worked, but a lot of the guis have it set wrong because it used to not work
	textAlign = 0;

	if ( textShadow ) {
		idStr shadowText = choices[currentChoice];
		idRectangle shadowRect = textRect;

		shadowText.RemoveColors();
		shadowRect.x += textShadow;
		shadowRect.y += textShadow;

		dc->DrawText( shadowText, textScale, textAlign, colorBlack, shadowRect, false, -1 );
	}

	if ( hover && !noEvents && Contains(gui->CursorX(), gui->CursorY()) ) {
		color = hoverColor;
	} else {
		hover = false;
	}
	if ( flags & WIN_FOCUS ) {
		color = hoverColor;
	}

	dc->DrawText( choices[currentChoice], textScale, textAlign, color, textRect, false, -1 );
}
コード例 #2
0
void idChoiceWindow::PostParse() {
	idWindow::PostParse();
	UpdateChoicesAndVals();
	InitVars();
	UpdateChoice();
	UpdateVars( false );
	flags |= WIN_CANFOCUS;
}
コード例 #3
0
void idChoiceWindow::Draw( int time, float x, float y ) {
	idVec4 color = foreColor;
	UpdateChoicesAndVals();
	UpdateChoice();
	if( textShadow ) {
		idStr shadowText = choices[currentChoice];
		idRectangle shadowRect = textRect;
		shadowText.RemoveColors();
		shadowRect.x += textShadow;
		shadowRect.y += textShadow;
		dc->DrawText( shadowText, textScale, textAlign, colorBlack, shadowRect, false, -1 );
	}
	if( hover && !noEvents && Contains( gui->CursorX(), gui->CursorY() ) ) {
		color = hoverColor;
	} else {
		hover = false;
	}
	if( flags & WIN_FOCUS ) {
		color = hoverColor;
	}
	dc->DrawText( choices[currentChoice], textScale, textAlign, color, textRect, false, -1 );
}