MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / printf

Method printf

src/app/console.cpp:112–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void Console::printf(const char* format, ...)
113{
114 char buf[4096]; // TODO warning buffer overflow
115 va_list ap;
116
117 va_start(ap, format);
118 vsnprintf(buf, sizeof(buf), format, ap);
119 va_end(ap);
120
121 if (!m_withUI || !wid_console) {
122 fputs(buf, stdout);
123 fflush(stdout);
124 return;
125 }
126
127 // Open the window
128 if (!wid_console->isVisible()) {
129 wid_console->openWindow();
130 ui::Manager::getDefault()->invalidate();
131 }
132
133 /* update the textbox */
134 if (!console_locked) {
135 console_locked = true;
136
137 wid_view->setVisible(true);
138
139 wid_console->remapWindow();
140 wid_console->setBounds(gfx::Rect(0, 0, ui::display_w()*9/10, ui::display_h()*6/10));
141 wid_console->centerWindow();
142 wid_console->invalidate();
143 }
144
145 wid_textbox->setText(wid_textbox->text() + buf);
146}
147
148// static
149void Console::showException(const std::exception& e)

Callers 15

exportSheetMethod · 0.80
executeCommandMethod · 0.80
catchFunction · 0.80
initializeMethod · 0.80
showExceptionMethod · 0.80
loadDocumentMethod · 0.80
loadObjectMethod · 0.80
readDocumentMethod · 0.80
readSpriteMethod · 0.80
readLayerMethod · 0.80
onConsolePrintMethod · 0.80
onExecuteMethod · 0.80

Calls 10

display_wFunction · 0.85
display_hFunction · 0.85
openWindowMethod · 0.80
remapWindowMethod · 0.80
setBoundsMethod · 0.80
centerWindowMethod · 0.80
isVisibleMethod · 0.45
invalidateMethod · 0.45
setVisibleMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected