From 83f2298e36bed744ff1f729d5fdce16d5e201c73 Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 14 Oct 2024 23:09:55 +0200 Subject: [PATCH] Mon 14 Oct 23:09:15 CEST 2024 --- user/test/printer.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 user/test/printer.c diff --git a/user/test/printer.c b/user/test/printer.c new file mode 100644 index 0000000..3817270 --- /dev/null +++ b/user/test/printer.c @@ -0,0 +1,35 @@ +/* +Copyright (C) 2016-2019 The University of Notre Dame +This software is distributed under the GNU General Public License. +See the file LICENSE for details. +*/ + +/* +A fun graphics demo that features a line segment bouncing around the screen. +*/ + +#include "library/syscalls.h" +#include "library/string.h" +#include "library/user-io.h" + +#define WIDTH (200) +#define HEIGHT (200) + +int main(int argc, char *argv[]) +{ + draw_window(KNO_STDWIN); + draw_color(0, 0, 255); + draw_clear(0, 0, WIDTH, HEIGHT); + draw_flush(); + + int cd = syscall_open_console(KNO_STDWIN); + if(cd < 0) { + printf("Console open failed!\n"); + return 2; + } + syscall_object_dup(cd, KNO_STDOUT); + + printf("hello world!\n"); + + return 0; +}