static int genmon2_constructor(plugin_instance *p) { genmon2_priv *gm; ENTER; gm = (genmon2_priv *) p; gm->command = "date +%R"; gm->time = 1; gm->max_text_len = 99; XCG(p->xc, "Command", &gm->command, str); XCG(p->xc, "TextSize", &gm->textsize, str); XCG(p->xc, "TextColor", &gm->textcolor, str); XCG(p->xc, "PollingTime", &gm->time, int); XCG(p->xc, "MaxTextLength", &gm->max_text_len, int); gm->main = gtk_label_new(NULL); gtk_label_set_max_width_chars(GTK_LABEL(gm->main), gm->max_text_len); text_update(gm); gtk_container_set_border_width (GTK_CONTAINER (p->pwid), 1); gtk_container_add(GTK_CONTAINER(p->pwid), gm->main); gtk_widget_show_all(p->pwid); gm->timer = g_timeout_add((guint) gm->time * 1000, (GSourceFunc) text_update, (gpointer) gm); RET(1); }
/** * @brief Add a string to the console text */ void text_draw(int x, int y, const char *string) { struct text_line *line = malloc(sizeof(struct text_line)); line->str = strdup(string); line->x = x; line->y = y; list_add_head(&text_list, &line->node); text_update(); }
UINT32 laser3k_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { switch (m_gfxmode) { case TEXT: text_update(screen, bitmap, cliprect, 0, 191); break; case HIRES: if (m_mix) { hgr_update(screen, bitmap, cliprect, 0, 159); text_update(screen, bitmap, cliprect, 160, 191); } else { hgr_update(screen, bitmap, cliprect, 0, 191); } break; case RGB: break; case DHIRES: if (m_mix) { dhgr_update(screen, bitmap, cliprect, 0, 159); text_update(screen, bitmap, cliprect, 160, 191); } else { dhgr_update(screen, bitmap, cliprect, 0, 191); } break; } return 0; }
void DebugRenderer::render(sf::RenderTarget& window) { fps_counter++; if (fps_counter > 30) { fps = fps_counter / fps_timer.restart().asSeconds(); fps_counter = 0; } string text = ""; if (show_fps) text = text + "FPS: " + string(fps) + "\n"; if (show_datarate && game_server) { text = text + string(game_server->getSendDataRate() / 1000, 1) + " kb per second\n"; text = text + string(game_server->getSendDataRatePerClient() / 1000, 1) + " kb per client\n"; } if (show_timing_graph) { if (timing_graph_points.size() > window.getView().getSize().x) timing_graph_points.clear(); timing_graph_points.push_back(engine->getEngineTiming()); sf::VertexArray update_points(sf::LinesStrip, timing_graph_points.size()); sf::VertexArray collision_points(sf::LinesStrip, timing_graph_points.size()); sf::VertexArray render_points(sf::LinesStrip, timing_graph_points.size()); for(unsigned int n=0; n<timing_graph_points.size(); n++) { update_points[n].position.x = float(n); update_points[n].position.y = window.getView().getSize().y - timing_graph_points[n].update * 10000; collision_points[n].position.x = float(n); collision_points[n].position.y = window.getView().getSize().y - (timing_graph_points[n].update + timing_graph_points[n].collision) * 10000; render_points[n].position.x = float(n); render_points[n].position.y = window.getView().getSize().y - (timing_graph_points[n].render + timing_graph_points[n].update + timing_graph_points[n].collision) * 10000; update_points[n].color = sf::Color::Red; collision_points[n].color = sf::Color::Cyan; render_points[n].color = sf::Color::Green; } window.draw(update_points); window.draw(collision_points); window.draw(render_points); sf::Text text_update("Update: " + string(timing_graph_points.back().update * 1000) + "ms", *mainFont, 18); sf::Text text_collision("Collision: " + string(timing_graph_points.back().collision * 1000) + "ms", *mainFont, 18); sf::Text text_render("Render: " + string(timing_graph_points.back().render * 1000) + "ms", *mainFont, 18); sf::VertexArray fps60_line(sf::LinesStrip, 2); fps60_line[0].position = sf::Vector2f(0, window.getView().getSize().y - 166); fps60_line[1].position = sf::Vector2f(window.getView().getSize().x, window.getView().getSize().y - 166); fps60_line[0].color = sf::Color(255, 255, 255, 128); fps60_line[1].color = sf::Color(255, 255, 255, 128); window.draw(fps60_line); text_update.setPosition(0, window.getView().getSize().y - 18 * 3 - 170); text_collision.setPosition(0, window.getView().getSize().y - 18 * 2 - 170); text_render.setPosition(0, window.getView().getSize().y - 18 - 170); text_update.setColor(sf::Color::Red); text_collision.setColor(sf::Color::Cyan); text_render.setColor(sf::Color::Green); window.draw(text_update); window.draw(text_collision); window.draw(text_render); } sf::Text textElement(text, *mainFont, 18); textElement.setPosition(0, 0); window.draw(textElement); }