| 73 | return count; |
| 74 | } |
| 75 | void RenderTextStatic(tceffect *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 76 | if (!ok_to_render) |
| 77 | return; |
| 78 | ASSERT(tce->type == EFX_TEXT_STATIC); |
| 79 | ASSERT(tce->text_buffer); |
| 80 | // See if we have any events waiting |
| 81 | tTCEvent evt; |
| 82 | while (PopEvent(tce, &evt)) { |
| 83 | switch (evt.id) { |
| 84 | case TEVT_SCROLLDOWN: |
| 85 | if (tce->textinfo.scroll_d) { |
| 86 | // mprintf(0,"Down Baby Down!\n"); |
| 87 | tce->textinfo.line_index++; |
| 88 | } |
| 89 | break; |
| 90 | case TEVT_SCROLLUP: |
| 91 | if (tce->textinfo.line_index > 0) { |
| 92 | // mprintf(0,"Up Baby Up!\n"); |
| 93 | tce->textinfo.line_index--; |
| 94 | } |
| 95 | break; |
| 96 | case TEVT_GAINFOCUS: { |
| 97 | // mprintf(0,"Text %d Gain Focus\n",tce-TCEffects); |
| 98 | } break; |
| 99 | case TEVT_LOSTFOCUS: { |
| 100 | // mprintf(0,"Text %d Lost Focus\n",tce-TCEffects); |
| 101 | } break; |
| 102 | } |
| 103 | } |
| 104 | ddgr_color color_to_use = tce->color; |
| 105 | int tab_count = GetTextEffectWithTabStopsOnScreen(tce->screen); |
| 106 | if (tab_count > 1) { |
| 107 | // we need to see what color to use for the text, cause there is more than |
| 108 | // one text item with a tab stop. |
| 109 | if (!tce->has_focus) { |
| 110 | // use the disable text color |
| 111 | color_to_use = DISABLED_TEXT_COLOR; |
| 112 | } |
| 113 | } |
| 114 | uint8_t old_alpha = grtext_GetAlpha(); |
| 115 | grtext_SetFont(Game_fonts[tce->textinfo.font_index]); |
| 116 | grtext_SetColor(color_to_use); |
| 117 | grtext_SetAlpha(tce->alpha); |
| 118 | int curry = tce->pos_y + yoff; |
| 119 | int height = grfont_GetHeight(Game_fonts[tce->textinfo.font_index]) + 1; |
| 120 | char buff[256]; |
| 121 | const char *nextline; |
| 122 | int count = 0; // get to the first line of text (scrolling) |
| 123 | nextline = textaux_CopyTextLine(tce->text_buffer, buff); |
| 124 | if ((tce->textinfo.line_index) && (nextline)) { |
| 125 | count++; |
| 126 | while (count <= tce->textinfo.line_index) { |
| 127 | nextline = textaux_CopyTextLine(nextline, buff); |
| 128 | count++; |
| 129 | } |
| 130 | } |
| 131 | int lcount = 0; |
| 132 | while ((nextline) && ((curry + height) < tce->pos_y + tce->h)) { |
no test coverage detected