From a8a80d326de9550b2a25b1255a2093ab43219ede Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 27 Jan 2024 23:14:29 -0500 Subject: keyboard input --- applications/init/main.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'applications/init/main.cpp') diff --git a/applications/init/main.cpp b/applications/init/main.cpp index 06a8203..57ebd02 100644 --- a/applications/init/main.cpp +++ b/applications/init/main.cpp @@ -15,7 +15,7 @@ int main(int, char **) { daguerre::image img; - std::FILE *file = std::fopen("/assets/burdon.ppm", "r"); + std::FILE *file = std::fopen("/init/burdon.ppm", "r"); assert(file != 0); assert(daguerre::try_load_ppm(file, img)); std::fclose(file); @@ -30,6 +30,21 @@ int main(int, char **) { daguerre::copy_image(img, fb, 0, 0, x_off, y_off, width, height); + while (true) { + + uint32_t kp = _syscall_read_key_packet(); + if ((kp & 0x0400ff) == 0x04005a) { + for (unsigned y = 0; y < img.get_height(); ++y) + for (unsigned x = 0; x < img.get_width(); ++x) { + img.get(x, y).r = ~img.get(x, y).r; + img.get(x, y).g = ~img.get(x, y).g; + img.get(x, y).b = ~img.get(x, y).b; + } + daguerre::copy_image(img, fb, 0, 0, x_off, y_off, width, height); + } + + } + return 0; } -- cgit v1.2.3