score(const sf::Vector2f& position) : m_text_size(m_mult*(position.x + position.y)), m_font(), m_text() { assert(m_score_name != ""); assert(m_score == 0); set_font(); set_text_font(); set_text_size(); set_color(); textify_score(); set_origin(); set_position(position); }
int main(int argc, char **argv) { struct GModule *module; struct Option *opt1, *opt2; struct Flag *mapcoords; int R, G, B, color = 0; /* Initialize the GIS calls */ G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("display")); G_add_keyword(_("cartography")); module->description = _("Program for generating and displaying simple graphics on the " "display monitor."); opt1 = G_define_option(); opt1->key = "input"; opt1->type = TYPE_STRING; opt1->required = NO; opt1->description = _("Name of file containing graphics commands, " "if not given reads from standard input"); opt1->gisprompt = "old_file,file,input"; opt2 = G_define_option(); opt2->key = "color"; opt2->type = TYPE_STRING; opt2->required = NO; opt2->description = _("Color to draw with, either a standard GRASS color " "or R:G:B triplet"); opt2->answer = DEFAULT_FG_COLOR; opt2->gisprompt = "old_color,color,color"; mapcoords = G_define_flag(); mapcoords->key = 'm'; mapcoords->description = _("Coordinates are given in map units"); /* Check command line */ if (G_parser(argc, argv)) exit(EXIT_FAILURE); /* default font scaling: 5% of active frame */ hsize = vsize = 5.; if (opt1->answer != NULL) { if ((infile = fopen(opt1->answer, "r")) == NULL) G_fatal_error(_("Graph file <%s> not found"), opt1->answer); } else infile = stdin; /* open graphics window */ if (D_open_driver() != 0) G_fatal_error(_("No graphics device selected. " "Use d.mon to select graphics device.")); /* Parse and select color */ if (opt2->answer != NULL) { color = G_str_to_color(opt2->answer, &R, &G, &B); if (color == 0) G_fatal_error(_("[%s]: No such color"), opt2->answer); if (color == 1) { D_RGB_color(R, G, B); set_last_color(R, G, B, RGBA_COLOR_OPAQUE); } else /* (color==2) is "none" */ set_last_color(0, 0, 0, RGBA_COLOR_NONE); } if (mapcoords->answer) { mapunits = TRUE; D_setup(0); } else { D_setup2(0, 0, 100, 0, 0, 100); mapunits = FALSE; } /* Do the graphics */ set_graph_stuff(); set_text_size(); graphics(infile); D_save_command(G_recreate_command()); D_close_driver(); exit(EXIT_SUCCESS); }