mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[ion/simulator] Headless simulator maps Ion::Console to stdio
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
class KDIonContext : public KDContext {
|
||||
public:
|
||||
static KDIonContext * sharedContext();
|
||||
static void putchar(char c);
|
||||
private:
|
||||
KDIonContext();
|
||||
void pushRect(KDRect rect, const KDColor * pixels) override;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <kandinsky/ion_context.h>
|
||||
#include <ion.h>
|
||||
#include <ion/display.h>
|
||||
|
||||
KDIonContext * KDIonContext::sharedContext() {
|
||||
static KDIonContext context;
|
||||
@@ -23,3 +23,12 @@ void KDIonContext::pushRectUniform(KDRect rect, KDColor color) {
|
||||
void KDIonContext::pullRect(KDRect rect, KDColor * pixels) {
|
||||
Ion::Display::pullRect(rect, pixels);
|
||||
}
|
||||
|
||||
void KDIonContext::putchar(char c) {
|
||||
static KDPoint cursor = KDPointZero;
|
||||
char text[2] = {c, 0};
|
||||
cursor = sharedContext()->drawString(text, cursor);
|
||||
if (cursor.y() > Ion::Display::Height) {
|
||||
cursor = KDPoint(cursor.x(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user