本文整理汇总了C++中iV_SetTextColour函数的典型用法代码示例。如果您正苦于以下问题:C++ iV_SetTextColour函数的具体用法?C++ iV_SetTextColour怎么用?C++ iV_SetTextColour使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iV_SetTextColour函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispAdditionalInfo
// -----------------------------------------------------------------------------------
void dispAdditionalInfo( void )
{
/* We now need to display the mission time, game time,
average unit experience level an number of artefacts found */
/* Firstly, top of the screen, number of artefacts found */
sprintf( text, _("ARTIFACTS RECOVERED: %d"), missionData.artefactsFound );
iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 300 + D_H );
/* Get the mission result time in a string - and write it out */
getAsciiTime( (char*)&text2, gameTime - missionData.missionStarted );
sprintf( text, _("Mission Time - %s"), text2 );
iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 320 + D_H);
/* Write out total game time so far */
getAsciiTime( (char*)&text2, gameTime );
sprintf( text, _("Total Game Time - %s"), text2 );
iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 340 + D_H );
if (Cheated)
{
// A quick way to flash the text
((gameTime2 / 250) % 2) ? iV_SetTextColour(WZCOL_RED) : iV_SetTextColour(WZCOL_YELLOW);
sprintf( text, _("You cheated!"));
iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 360 + D_H );
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
}
}
示例2: setConsoleTextColor
/** Sets console text color depending on message type */
static void setConsoleTextColor(SDWORD player)
{
// System messages
if(player == SYSTEM_MESSAGE)
{
iV_SetTextColour(WZCOL_CONS_TEXT_SYSTEM);
}
else if (player == NOTIFY_MESSAGE)
{
iV_SetTextColour(WZCOL_YELLOW);
}
else
{
// Don't use friend-foe colors in the lobby
if(bEnemyAllyRadarColor && (GetGameMode() == GS_NORMAL))
{
if(aiCheckAlliances(player,selectedPlayer))
{
iV_SetTextColour(WZCOL_CONS_TEXT_USER_ALLY);
}
else
{
iV_SetTextColour(WZCOL_CONS_TEXT_USER_ENEMY);
}
}
else
{
// Friend-foe is off
iV_SetTextColour(WZCOL_CONS_TEXT_USER);
}
}
}
示例3: seq_StartFullScreenVideo
//full screenvideo functions
static bool seq_StartFullScreenVideo(const char* videoName, const char* audioName, VIDEO_RESOLUTION resolution)
{
const char* aAudioName = NULL;
int chars_printed;
bHoldSeqForAudio = false;
chars_printed = ssprintf(aVideoName, "%s%s", aHardPath, videoName);
ASSERT(chars_printed < sizeof(aVideoName), "sequence path + name greater than max string");
//set audio path
if (audioName != NULL)
{
sasprintf((char**)&aAudioName, "sequenceaudio/%s", audioName);
}
cdAudio_Pause();
iV_SetFont(font_regular);
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
/* We do not want to enter loop_SetVideoPlaybackMode() when we are
* doing intelligence videos.
*/
if (resolution == VIDEO_USER_CHOSEN_RESOLUTION)
{
//start video mode
if (loop_GetVideoMode() == 0)
{
// check to see if we need to pause, and set font each time
cdAudio_Pause();
loop_SetVideoPlaybackMode();
iV_SetFont(font_regular);
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
}
// set the dimensions to show full screen or native or ...
seq_SetUserResolution();
}
if (!seq_Play(aVideoName))
{
seq_Shutdown();
return false;
}
if (audioName == NULL)
{
bAudioPlaying = false;
}
else
{
// NOT controlled by sliders for now?
static const float maxVolume = 1.f;
bAudioPlaying = audio_PlayStream(aAudioName, maxVolume, NULL, NULL) ? true : false;
ASSERT(bAudioPlaying == true, "unable to initialise sound %s", aAudioName);
}
return true;
}
示例4: seq_StartFullScreenVideo
//full screenvideo functions
static bool seq_StartFullScreenVideo(QString videoName, QString audioName, VIDEO_RESOLUTION resolution)
{
QString aAudioName("sequenceaudio/" + audioName);
bHoldSeqForAudio = false;
aVideoName = QString("sequences/" + videoName);
cdAudio_Pause();
iV_SetFont(font_scaled);
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
/* We do not want to enter loop_SetVideoPlaybackMode() when we are
* doing intelligence videos.
*/
if (resolution == VIDEO_USER_CHOSEN_RESOLUTION)
{
//start video mode
if (loop_GetVideoMode() == 0)
{
// check to see if we need to pause, and set font each time
cdAudio_Pause();
loop_SetVideoPlaybackMode();
iV_SetFont(font_scaled);
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
}
// set the dimensions to show full screen or native or ...
seq_SetUserResolution();
}
if (!seq_Play(aVideoName.toUtf8().constData()))
{
seq_Shutdown();
return false;
}
if (audioName.isEmpty())
{
bAudioPlaying = false;
}
else
{
// NOT controlled by sliders for now?
static const float maxVolume = 1.f;
bAudioPlaying = audio_PlayStream(aAudioName.toUtf8().constData(), maxVolume, NULL, NULL) ? true : false;
ASSERT(bAudioPlaying == true, "unable to initialise sound %s", aAudioName.toUtf8().constData());
}
return true;
}
示例5: displayCamTypeBut
static void displayCamTypeBut(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours)
{
UDWORD x = xOffset+psWidget->x;
UDWORD y = yOffset+psWidget->y;
char buffer[8];
drawBlueBox(x,y,psWidget->width,psWidget->height); //draw box
sprintf(buffer, "T%i", (int)(psWidget->UserData));
if ((unsigned int)(psWidget->UserData) == current_tech) {
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
} else {
iV_SetTextColour(WZCOL_TEXT_MEDIUM);
}
iV_DrawText(buffer, x+2, y+12);
}
示例6: iV_SetTextColour
void W_LABEL::display(int xOffset, int yOffset)
{
iV_SetTextColour(fontColour);
QByteArray text = aText.toUtf8();
int fx;
if (style & WLAB_ALIGNCENTRE)
{
int fw = iV_GetTextWidth(text.constData(), FontID);
fx = xOffset + x() + (width() - fw) / 2;
}
else if (style & WLAB_ALIGNRIGHT)
{
int fw = iV_GetTextWidth(text.constData(), FontID);
fx = xOffset + x() + width() - fw;
}
else
{
fx = xOffset + x();
}
int fy;
if ((style & WLAB_ALIGNTOPLEFT) != 0) // Align top
{
fy = yOffset + y() - iV_GetTextAboveBase(FontID);
}
else if ((style & WLAB_ALIGNBOTTOMLEFT) != 0) // Align bottom
{
fy = yOffset + y() - iV_GetTextAboveBase(FontID) + (height() - iV_GetTextLineSize(FontID));
}
else
{
fy = yOffset + y() - iV_GetTextAboveBase(FontID) + (height() - iV_GetTextLineSize(FontID)) / 2;
}
iV_DrawText(text.constData(), fx, fy, FontID);
}
示例7: labelDisplay
/* label display function */
void labelDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
{
SDWORD fx,fy, fw;
W_LABEL *psLabel;
// PROP_FONT *psFont;
int FontID;
psLabel = (W_LABEL *)psWidget;
// psFont = psLabel->psFont;
FontID = psLabel->FontID;
iV_SetFont(FontID);
// fontSetCacheColour(*(pColours + WCOL_TEXT));
iV_SetTextColour((UWORD)*(pColours + WCOL_TEXT));
if (psLabel->style & WLAB_ALIGNCENTRE)
{
fw = iV_GetTextWidth(psLabel->aText);
fx = xOffset + psLabel->x + (psLabel->width - fw) / 2;
}
else if (psLabel->style & WLAB_ALIGNRIGHT)
{
fw = iV_GetTextWidth(psLabel->aText);
fx = xOffset + psLabel->x + psLabel->width - fw;
}
else
{
fx = xOffset + psLabel->x;
}
fy = yOffset + psLabel->y + (psLabel->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase();
// fy = yOffset + psLabel->y + (psLabel->height -
// psFont->height + psFont->baseLine) / 2;
iV_DrawText(psLabel->aText,fx,fy);
// fontPrint(fx,fy, psLabel->aText);
}
示例8: labelDisplay
/* label display function */
void labelDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours)
{
SDWORD fx,fy, fw;
W_LABEL *psLabel;
enum iV_fonts FontID;
psLabel = (W_LABEL *)psWidget;
FontID = psLabel->FontID;
iV_SetFont(FontID);
iV_SetTextColour(pColours[WCOL_TEXT]);
if (psLabel->style & WLAB_ALIGNCENTRE)
{
fw = iV_GetTextWidth(psLabel->aText);
fx = xOffset + psLabel->x + (psLabel->width - fw) / 2;
}
else if (psLabel->style & WLAB_ALIGNRIGHT)
{
fw = iV_GetTextWidth(psLabel->aText);
fx = xOffset + psLabel->x + psLabel->width - fw;
}
else
{
fx = xOffset + psLabel->x;
}
fy = yOffset + psLabel->y + (psLabel->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase();
iV_DrawText(psLabel->aText,fx,fy);
}
示例9: displayRequestOption
// ////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////
void displayRequestOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours)
{
UDWORD x = xOffset+psWidget->x;
UDWORD y = yOffset+psWidget->y;
UDWORD count;
char butString[255];
strcpy(butString,((W_BUTTON *)psWidget)->pTip);
drawBlueBox(x,y,psWidget->width,psWidget->height); //draw box
iV_SetFont(font_regular); // font
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
while(iV_GetTextWidth(butString) > psWidget->width -10 )
{
butString[strlen(butString)-1]='\0';
}
iV_DrawText(butString, x + 6, y + 12); //draw text
// if map, then draw no. of players.
for(count=0;count<psWidget->UserData;count++)
{
iV_DrawImage(FrontImages,IMAGE_WEE_GUY,(x+(6*count)+6),y+16);
}
}
示例10: displayLoadSlot
// ////////////////////////////////////////////////////////////////////////////
static void displayLoadSlot(struct _widget *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
{
UDWORD x = xOffset+psWidget->x;
UDWORD y = yOffset+psWidget->y;
UWORD im = (UWORD)UNPACKDWORD_TRI_B((UDWORD)psWidget->pUserData);
UWORD im2= (UWORD)(UNPACKDWORD_TRI_C((UDWORD)psWidget->pUserData));
STRING butString[64];
UNUSEDPARAMETER(pColours);
drawBlueBox(x,y,psWidget->width,psWidget->height); //draw box
if(((W_BUTTON *)psWidget)->pTip )
{
strcpy(butString,((W_BUTTON *)psWidget)->pTip);
iV_SetFont(WFont); // font
iV_SetTextColour(-1); //colour
while(iV_GetTextWidth(butString) > psWidget->width)
{
butString[strlen(butString)-1]='\0';
}
//draw text
iV_DrawText( butString, x+4, y+17);
}
}
示例11: displayText
// ////////////////////////////////////////////////////////////////////////////
// show text.
static void displayText(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
{
SDWORD fx,fy, fw;
W_LABEL *psLab;
psLab = (W_LABEL *)psWidget;
iV_SetFont(psLab->FontID);
fw = iV_GetTextWidth(psLab->aText);
fy = yOffset + psWidget->y;
if (psWidget->style & WLAB_ALIGNCENTRE) //check for centering, calculate offset.
{
fx = xOffset + psWidget->x + ((psWidget->width - fw) / 2);
}
else
{
fx = xOffset + psWidget->x;
}
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
iV_DrawText( psLab->aText, fx, fy);
return;
}
示例12: displayTextOption
// ////////////////////////////////////////////////////////////////////////////
// show a text option.
void displayTextOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
{
SDWORD fx,fy, fw;
W_BUTTON *psBut;
bool hilight = false;
bool greyOut = psWidget->UserData; // if option is unavailable.
psBut = (W_BUTTON *)psWidget;
iV_SetFont(psBut->FontID);
if(widgGetMouseOver(psWScreen) == psBut->id) // if mouse is over text then hilight.
{
hilight = true;
}
fw = iV_GetTextWidth(psBut->pText);
fy = yOffset + psWidget->y + (psWidget->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase();
if (psWidget->style & WBUT_TXTCENTRE) //check for centering, calculate offset.
{
fx = xOffset + psWidget->x + ((psWidget->width - fw) / 2);
}
else
{
fx = xOffset + psWidget->x;
}
if(greyOut) // unavailable
{
iV_SetTextColour(WZCOL_TEXT_DARK);
}
else // available
{
if(hilight) // hilight
{
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
}
else // dont highlight
{
iV_SetTextColour(WZCOL_TEXT_MEDIUM);
}
}
iV_DrawText( psBut->pText, fx, fy);
return;
}
示例13: displayTextAt270
// ////////////////////////////////////////////////////////////////////////////
// show text written on its side.
static void displayTextAt270(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
{
SDWORD fx,fy;
W_LABEL *psLab;
psLab = (W_LABEL *)psWidget;
iV_SetFont(font_large);
fx = xOffset + psWidget->x;
fy = yOffset + psWidget->y + iV_GetTextWidth(psLab->aText) ;
iV_SetTextColour(WZCOL_GREY);
iV_DrawTextRotated(psLab->aText, fx+2, fy+2, 270.f);
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
iV_DrawTextRotated(psLab->aText, fx, fy, 270.f);
}
示例14: barGraphDisplayText
static void barGraphDisplayText(W_BARGRAPH *barGraph, int x0, int x1, int y1)
{
if (!barGraph->text.isEmpty())
{
QByteArray utf = barGraph->text.toUtf8();
iV_SetFont(font_small);
int textWidth = iV_GetTextWidth(utf.constData());
Vector2i pos((x0 + x1 - textWidth) / 2, y1);
iV_SetTextColour(WZCOL_BLACK); // Add a shadow, to make it visible against any background.
for (int dx = -1; dx <= 1; ++dx)
for (int dy = -1; dy <= 1; ++dy)
{
iV_DrawText(utf.constData(), pos.x + dx * 1.25f, pos.y + dy * 1.25f);
}
iV_SetTextColour(barGraph->textCol);
iV_DrawText(utf.constData(), pos.x, pos.y - 0.25f);
iV_DrawText(utf.constData(), pos.x, pos.y + 0.25f); // Draw twice, to make it more visible.
}
}
示例15: seq_RenderVideoToBuffer
/* Renders a video sequence specified by filename to a buffer*/
bool seq_RenderVideoToBuffer(const char* sequenceName, int seqCommand)
{
static enum
{
VIDEO_NOT_PLAYING,
VIDEO_PLAYING,
VIDEO_FINISHED,
} videoPlaying = VIDEO_NOT_PLAYING;
static enum
{
VIDEO_LOOP,
VIDEO_HOLD_LAST_FRAME,
} frameHold = VIDEO_LOOP;
if (seqCommand == SEQUENCE_KILL)
{
//stop the movie
seq_Shutdown();
bSeqPlaying = false;
frameHold = VIDEO_LOOP;
videoPlaying = VIDEO_NOT_PLAYING;
return true;
}
if (!bSeqPlaying
&& frameHold == VIDEO_LOOP)
{
//start the ball rolling
iV_SetFont(font_regular);
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
/* We do *NOT* want to use the user-choosen resolution when we
* are doing intelligence videos.
*/
videoPlaying = seq_StartFullScreenVideo(sequenceName, NULL, VIDEO_PRESELECTED_RESOLUTION) ? VIDEO_PLAYING : VIDEO_FINISHED;
bSeqPlaying = true;
}
if (videoPlaying != VIDEO_FINISHED)
{
videoPlaying = seq_Update() ? VIDEO_PLAYING : VIDEO_FINISHED;
}
if (videoPlaying == VIDEO_FINISHED)
{
seq_Shutdown();
bSeqPlaying = false;
frameHold = VIDEO_HOLD_LAST_FRAME;
videoPlaying = VIDEO_NOT_PLAYING;
return false;
}
return true;
}