/** * Display map completion time and par, or "sucks" message if overflow. */ static void drawTime(int x, int y, int t) { patchinfo_t info; if(t < 0) return; if(t <= 61 * 59) { int seconds = t % 60, minutes = t / 60 % 60; char buf[20]; x -= 22; FR_DrawCharXY3(':', x, y, ALIGN_TOPLEFT, DTF_NO_TYPEIN); if(minutes > 0) { dd_snprintf(buf, 20, "%d", minutes); FR_DrawTextXY3(buf, x, y, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); } dd_snprintf(buf, 20, "%02d", seconds); FR_DrawTextXY3(buf, x+FR_CharWidth(':'), y, ALIGN_TOPLEFT, DTF_NO_TYPEIN); return; } // "sucks" if(!R_GetPatchInfo(pSucks, &info)) return; WI_DrawPatchXY3(pSucks, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pSucks), x - info.geometry.size.width, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); }
void IN_DrawDMStats() { #define TRACKING (1) static int sounds; DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3("TOTAL", 265, 30, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2]); FR_DrawTextXY3("VICTIMS", 140, 8, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); for(int i = 0; i < 7; ++i) { FR_DrawCharXY3(killersText[i], 10, 80 + 9 * i, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); } DGL_Disable(DGL_TEXTURE_2D); int ypos = 55, xpos = 90; if(interTime < 20) { DGL_Enable(DGL_TEXTURE_2D); for(int i = 0; i < NUMTEAMS; ++i) { if(teamInfo[i].members) { M_DrawShadowedPatch(dpFaceAlive[i], 40, ((ypos << FRACBITS) + dSlideY[i] * interTime) >> FRACBITS); M_DrawShadowedPatch(dpFaceDead[i], ((xpos << FRACBITS) + dSlideX[i] * interTime) >> FRACBITS, 18); } }
void LineEditWidget::draw() const { fontid_t fontId = mnRendState->textFonts[font()]; Vector2i origin = geometry().topLeft + Vector2i(MNDATA_EDIT_OFFSET_X, MNDATA_EDIT_OFFSET_Y); String useText; float light = 1, textOpacity = mnRendState->pageAlpha; if(!d->text.isEmpty()) { useText = d->text; } else if(!(isActive() && isFocused())) { useText = d->emptyText; light *= .5f; textOpacity = mnRendState->pageAlpha * .75f; } DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(fontId); const float fadeout = scrollingFadeout(); //int const numVisCharacters = de::clamp(0, useText.isNull()? 0 : useText.length(), d->maxVisibleChars); drawEditBackground(origin + Vector2i(MNDATA_EDIT_BACKGROUND_OFFSET_X, MNDATA_EDIT_BACKGROUND_OFFSET_Y), geometry().width(), mnRendState->pageAlpha * fadeout); //if(string) { // float t = 0; Vector4f color = Vector4f(Vector3f(cfg.common.menuTextColors[MNDATA_EDIT_TEXT_COLORIDX]), 1.f); // Flash if focused? if (!isActive()) /* && isFocused() && cfg.common.menuTextFlashSpeed > 0) { float const speed = cfg.common.menuTextFlashSpeed / 2.f; t = (1 + sin(page().timer() / (float)TICSPERSEC * speed * DD_PI)) / 2; }*/ { color = selectionFlashColor(color); } // Vector4f color = de::lerp(Vector3f(cfg.common.menuTextColors[MNDATA_EDIT_TEXT_COLORIDX]), Vector3f(cfg.common.menuTextFlashColor), t); color *= light; color.w = textOpacity; // Draw the text: FR_SetColorAndAlpha(color.x, color.y, color.z, color.w * fadeout); FR_DrawTextXY3(useText.toUtf8().constData(), origin.x, origin.y, ALIGN_TOPLEFT, Hu_MenuMergeEffectWithDrawTextFlags(0)); // Are we drawing a cursor? if(isActive() && isFocused() && (menuTime & 8) && (!d->maxLength || d->text.length() < d->maxLength)) { origin.x += FR_TextWidth(useText.toUtf8().constData()); FR_DrawCharXY3('_', origin.x, origin.y, ALIGN_TOPLEFT, Hu_MenuMergeEffectWithDrawTextFlags(0)); } } DGL_Disable(DGL_TEXTURE_2D); }
void FR_DrawCharXY2(unsigned char ch, int x, int y, int alignFlags) { FR_DrawCharXY3(ch, x, y, alignFlags, DEFAULT_DRAWFLAGS); }