MCPcopy Create free account
hub / github.com/crawl/crawl / _print_version

Function _print_version

crawl-ref/source/command.cc:216–269  ·  view source on GitHub ↗

define DEBUG_FILES

Source from the content-addressed store, hash-verified

214
215//#define DEBUG_FILES
216static void _print_version()
217{
218 const string info = _get_version_information(),
219 feats = _get_version_features(),
220 changes = _get_version_changes();
221
222 auto vbox = make_shared<Box>(Widget::VERT);
223
224#ifdef USE_TILE_LOCAL
225 vbox->max_size().width = tiles.get_crt_font()->char_width()*80;
226#endif
227
228 auto title_hbox = make_shared<Box>(Widget::HORZ);
229#ifdef USE_TILE
230 auto icon = make_shared<Image>();
231 icon->set_tile(tile_def(TILEG_STARTUP_STONESOUP));
232 title_hbox->add_child(std::move(icon));
233#endif
234
235 auto title = make_shared<Text>(formatted_string::parse_string(info));
236 title->set_margin_for_sdl(0, 0, 0, 10);
237 title_hbox->add_child(std::move(title));
238
239 title_hbox->set_cross_alignment(Widget::CENTER);
240 title_hbox->set_margin_for_crt(0, 0, 1, 0);
241 title_hbox->set_margin_for_sdl(0, 0, 20, 0);
242 vbox->add_child(std::move(title_hbox));
243
244 auto scroller = make_shared<Scroller>();
245 auto content = formatted_string::parse_string(feats + "\n\n" + changes);
246 auto text = make_shared<Text>(std::move(content));
247 text->set_wrap_text(true);
248 scroller->set_child(std::move(text));
249 vbox->add_child(scroller);
250
251 auto popup = make_shared<ui::Popup>(vbox);
252
253 bool done = false;
254 popup->on_keydown_event([&](const KeyEvent& ev) {
255 done = !scroller->on_event(ev);
256 return true;
257 });
258
259#ifdef USE_TILE_WEB
260 tiles.json_open_object();
261 tiles.json_write_string("information", info);
262 tiles.json_write_string("features", feats);
263 tiles.json_write_string("changes", changes);
264 tiles.push_ui_layout("version", 0);
265 popup->on_layout_pop([](){ tiles.pop_ui_layout(); });
266#endif
267
268 ui::run_layout(std::move(popup), done);
269}
270
271// Output a short list of currently equipped items to the message log.
272static void _list_equipment(equipment_slot first_slot, equipment_slot last_slot)

Callers 1

_show_help_specialFunction · 0.70

Calls 15

_get_version_informationFunction · 0.85
_get_version_featuresFunction · 0.85
_get_version_changesFunction · 0.85
tile_defClass · 0.85
parse_stringFunction · 0.85
run_layoutFunction · 0.85
char_widthMethod · 0.80
get_crt_fontMethod · 0.80
set_tileMethod · 0.80
add_childMethod · 0.80
set_margin_for_sdlMethod · 0.80
set_cross_alignmentMethod · 0.80

Tested by

no test coverage detected