std::wstring render(bool propper, std::wstring syntax, std::wstring date_format = DATE_FORMAT, DWORD langId = 0) const { if (propper) { // To obtain the appropriate message string from the message file, load the message file with the LoadLibrary function and use the FormatMessage function strEx::replace(syntax, _T("%message%"), render_message(langId)); } else { strEx::replace(syntax, _T("%message%"), _T("%message% needs the descriptions flag set!")); } strEx::replace(syntax, _T("%source%"), get_source()); strEx::replace(syntax, _T("%computer%"), get_computer()); strEx::replace(syntax, _T("%generated%"), strEx::format_date(get_time_generated(), date_format)); strEx::replace(syntax, _T("%written%"), strEx::format_date(get_time_written(), date_format)); strEx::replace(syntax, _T("%generated-raw%"), strEx::itos(pevlr_->TimeGenerated)); strEx::replace(syntax, _T("%written-raw%"), strEx::itos(pevlr_->TimeWritten)); strEx::replace(syntax, _T("%type%"), translateType(eventType())); strEx::replace(syntax, _T("%category%"), strEx::itos(pevlr_->EventCategory)); strEx::replace(syntax, _T("%facility%"), strEx::itos(facility())); strEx::replace(syntax, _T("%qualifier%"), strEx::itos(facility())); strEx::replace(syntax, _T("%customer%"), strEx::itos(customer())); strEx::replace(syntax, _T("%rawid%"), strEx::itos(raw_id())); strEx::replace(syntax, _T("%severity%"), translateSeverity(severity())); strEx::replace(syntax, _T("%strings%"), enumStrings()); strEx::replace(syntax, _T("%log%"), file_); strEx::replace(syntax, _T("%file%"), file_); strEx::replace(syntax, _T("%id%"), strEx::itos(eventID())); strEx::replace(syntax, _T("%user%"), userSID()); return syntax; }
void GUI::OnRender() { if(current_screen == MENU_SCREEN) { render_menu(menu); } else if(current_screen == MAP_SCREEN) { std::vector<std::vector<MapTile> > map_canvas = world_map_gui.get_canvas(); for(size_t i = 0; i < map_canvas.size(); i++) { for(size_t j = 0; j < map_canvas[i].size(); j++) { drawChr(j, i, map_canvas[i][j].char_count, ascii, screen, map_canvas[i][j].color); } } drawStr(0, GAME_HEIGHT - 2, std::string("Use the arrow keys to move the cursor.").c_str(), ascii, screen, WHITE); drawStr(0, GAME_HEIGHT - 1, std::string("Press ENTER to spawn on the selected map tile.").c_str(), ascii, screen, WHITE); } else if (current_screen == GAME_SCREEN) { render_canvas(); render_target(); render_characters(); render_main_char(); render_animations(); clear_area(IntPoint(0, UI_START), IntPoint(UI_HEIGHT, UI_WIDTH)); render_interface(); render_message(); } else if(current_screen == DIRECTION_SCREEN) { drawStr(0, 0, std::string("Pick a direction to perform the action.").c_str(), ascii, screen, WHITE); } else if (current_screen == DEATH_SCREEN) { clear_screen(); drawStr(GAME_WIDTH/2 - 12, GAME_HEIGHT/2, std::string("You suck, uninstall bro.").c_str(), ascii, screen, WHITE); } else if (current_screen == DEBUG_CONSOLE) { render_canvas(); render_target(); render_characters(); render_main_char(); render_debug(); } if(game.is_paused()) { drawStr(GAME_WIDTH-20, 0, std::string("Paused").c_str(), ascii, screen, WHITE); } SDL_Flip(screen); }
static uint32_t render_to_cairo(cairo_t *cairo, struct swaynag *swaynag) { uint32_t max_height = 0; cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE); cairo_set_source_u32(cairo, swaynag->type->background); cairo_paint(cairo); uint32_t h = render_message(cairo, swaynag); max_height = h > max_height ? h : max_height; int x = swaynag->width - swaynag->type->button_margin_right; x *= swaynag->scale; for (int i = 0; i < swaynag->buttons->length; i++) { h = render_button(cairo, swaynag, i, &x); max_height = h > max_height ? h : max_height; x -= swaynag->type->button_gap * swaynag->scale; if (i == 0) { x -= swaynag->type->button_gap_close * swaynag->scale; } } if (swaynag->details.visible) { h = render_detailed(cairo, swaynag, max_height); max_height = h > max_height ? h : max_height; } int border = swaynag->type->bar_border_thickness * swaynag->scale; if (max_height > swaynag->height) { max_height += border; } cairo_set_source_u32(cairo, swaynag->type->border_bottom); cairo_rectangle(cairo, 0, swaynag->height * swaynag->scale - border, swaynag->width * swaynag->scale, border); cairo_fill(cairo); return max_height; }
static void gl_render_msg(void *data, const char *msg, const struct font_params *params) { GLfloat x, y, scale, drop_mod; GLfloat color[4], color_dark[4]; int drop_x, drop_y; bool full_screen; gl_raster_t *font = (gl_raster_t*)data; if (!font) return; gl_t *gl = font->gl; if (params) { x = params->x; y = params->y; scale = params->scale; full_screen = params->full_screen; drop_x = params->drop_x; drop_y = params->drop_y; drop_mod = params->drop_mod; color[0] = FONT_COLOR_GET_RED(params->color) / 255.0f; color[1] = FONT_COLOR_GET_GREEN(params->color) / 255.0f; color[2] = FONT_COLOR_GET_BLUE(params->color) / 255.0f; color[3] = FONT_COLOR_GET_ALPHA(params->color) / 255.0f; // If alpha is 0.0f, turn it into default 1.0f if (color[3] <= 0.0f) color[3] = 1.0f; } else { x = g_settings.video.msg_pos_x; y = g_settings.video.msg_pos_y; scale = 1.0f; full_screen = false; color[0] = g_settings.video.msg_color_r; color[1] = g_settings.video.msg_color_g; color[2] = g_settings.video.msg_color_b; color[3] = 1.0f; drop_x = -2; drop_y = -2; drop_mod = 0.3f; } gl_set_viewport(gl, gl->win_width, gl->win_height, full_screen, false); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); if (drop_x || drop_y) { color_dark[0] = color[0] * drop_mod; color_dark[1] = color[1] * drop_mod; color_dark[2] = color[2] * drop_mod; color_dark[3] = color[3]; render_message(font, msg, scale, color_dark, x + scale * drop_x / gl->vp.width, y + scale * drop_y / gl->vp.height); } render_message(font, msg, scale, color, x, y); glDisable(GL_BLEND); gl_set_viewport(gl, gl->win_width, gl->win_height, false, true); }