summaryrefslogtreecommitdiff
path: root/applications
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-05-20 17:40:47 -0400
committerBenji Dial <benji@benjidial.net>2024-05-20 17:40:47 -0400
commit9af5588c30c4126a2800aae1afcb0de2c373dc6c (patch)
treed2a48a97b1664f958b5f88a8b0c03ef8366b0f49 /applications
parent5a54df93c4e9368c36e69d1e9c88cd2904e92308 (diff)
downloadhilbert-os-9af5588c30c4126a2800aae1afcb0de2c373dc6c.tar.gz
rewrite application stuff in the kernel to support multitasking
Diffstat (limited to 'applications')
-rw-r--r--applications/goldman/makefile12
-rw-r--r--applications/goldman/source/main.cpp4
-rw-r--r--applications/init/makefile2
-rw-r--r--applications/init/source/main.cpp124
4 files changed, 28 insertions, 114 deletions
diff --git a/applications/goldman/makefile b/applications/goldman/makefile
new file mode 100644
index 0000000..5b93fe4
--- /dev/null
+++ b/applications/goldman/makefile
@@ -0,0 +1,12 @@
+SOURCES = \
+ main.cpp
+
+build/%.cpp.o: source/%.cpp
+ @mkdir -p $(@D)
+ $(HILBERT_CC) -c $^ -o $@
+
+build/goldman.elf: $(SOURCES:%=build/%.o)
+ $(HILBERT_CC) $^ -o $@
+
+clean:
+ rm -rf build
diff --git a/applications/goldman/source/main.cpp b/applications/goldman/source/main.cpp
new file mode 100644
index 0000000..28ed00a
--- /dev/null
+++ b/applications/goldman/source/main.cpp
@@ -0,0 +1,4 @@
+int main(int, char **) {
+ while (1)
+ ;
+}
diff --git a/applications/init/makefile b/applications/init/makefile
index 6799406..91328e7 100644
--- a/applications/init/makefile
+++ b/applications/init/makefile
@@ -6,7 +6,7 @@ build/%.cpp.o: source/%.cpp
$(HILBERT_CC) -c $^ -o $@
build/init.elf: $(SOURCES:%=build/%.o)
- $(HILBERT_CC) $^ -ldaguerre -o $@
+ $(HILBERT_CC) $^ -o $@
clean:
rm -rf build
diff --git a/applications/init/source/main.cpp b/applications/init/source/main.cpp
index cae17a2..5dfa81a 100644
--- a/applications/init/source/main.cpp
+++ b/applications/init/source/main.cpp
@@ -1,121 +1,19 @@
-#include <daguerre.hpp>
-
-static daguerre::hilbert_color transparent_color;
-
-void alpha_overlay(
- daguerre::hilbert_color &dest, const daguerre::hilbert_color &src) {
- if (src != transparent_color)
- dest = src;
-}
+#include <euler/start_process.hpp>
int main(int, char **) {
- daguerre::default_overlay(
- transparent_color, (daguerre::rgb24){.r = 255, .g = 0, .b = 255});
-
- auto raw_framebuffer = daguerre::get_hilbert_framebuffer();
- const unsigned fbw = raw_framebuffer.width;
- const unsigned fbh = raw_framebuffer.height;
-
- daguerre::image<daguerre::rgb24> raw_burden;
- daguerre::try_load_ppm("/assets/burden.ppm", raw_burden);
-
- daguerre::image<daguerre::rgb24> burden_stretch(fbw, fbh);
- daguerre::image<daguerre::rgb24> burden_stretch_inverted(fbw, fbh);
- for (unsigned y = 0; y < fbh; ++y)
- for (unsigned x = 0; x < fbw; ++x) {
- daguerre::rgb24 color = raw_burden.get(
- x * raw_burden.width / fbw, y * raw_burden.height / fbh);
- burden_stretch.set(x, y, color);
- burden_stretch_inverted.set(x, y, {
- .r = (uint8_t)(255 - color.r),
- .g = (uint8_t)(255 - color.g),
- .b = (uint8_t)(255 - color.b)});
- }
-
- daguerre::image<daguerre::rgb24> pointer;
- daguerre::try_load_ppm("/assets/pointer.ppm", pointer);
-
- daguerre::fixed_bitmap_font<bool> terminus;
- daguerre::try_load_psf("/assets/terminus-bold-18x10.psf", terminus);
-
- terminus.overlay_text<>(burden_stretch, 0, 0, "this is a test");
- terminus.overlay_text<>(burden_stretch_inverted, 0, 0, "tset a si siht");
-
- daguerre::image<daguerre::hilbert_color>
- burden_stretch_hilbert(burden_stretch);
-
- daguerre::image<daguerre::hilbert_color>
- burden_stretch_inverted_hilbert(burden_stretch_inverted);
-
- daguerre::image<daguerre::hilbert_color> pointer_hilbert(pointer);
-
- daguerre::image<daguerre::hilbert_color> double_buffer(
- fbw + pointer.width - 1, fbh + pointer.height - 1);
-
- int32_t mouse_x = fbw / 2;
- int32_t mouse_y = fbh / 2;
- bool was_left_mouse_down = false;
-
- bool should_draw = true;
-
- while (1) {
-
- if (should_draw) {
- double_buffer.overlay_from<>(
- burden_stretch_hilbert, 0, 0, 0, 0, fbw, fbh);
- double_buffer.overlay_from<daguerre::hilbert_color, alpha_overlay>(
- pointer_hilbert, mouse_x, mouse_y,
- 0, 0, pointer.width, pointer.height);
- raw_framebuffer.overlay_from<>(double_buffer, 0, 0, 0, 0, fbw, fbh);
- should_draw = false;
- }
-
- __euler_mouse_buttons mouse_buttons;
- int16_t mouse_change_x, mouse_change_y;
- uint32_t key_packet;
- __euler_input_packet_type packet_type = __euler_get_input_packet(
- mouse_buttons, mouse_change_x, mouse_change_y, key_packet);
-
- bool should_invert = false;
-
- if (packet_type == __EULER_IPT_MOUSE) {
-
- if (mouse_change_x != 0 || mouse_change_y != 0) {
-
- mouse_x += mouse_change_x;
- mouse_y += mouse_change_y;
-
- if (mouse_x < 0)
- mouse_x = 0;
- else if ((unsigned)mouse_x >= fbw)
- mouse_x = fbw - 1;
-
- if (mouse_y < 0)
- mouse_y = 0;
- else if ((unsigned)mouse_y >= fbh)
- mouse_y = fbh - 1;
-
- should_draw = true;
-
- }
-
- if (!was_left_mouse_down && (mouse_buttons & __EULER_MB_LEFT))
- should_invert = true;
-
- was_left_mouse_down = mouse_buttons & __EULER_MB_LEFT;
-
- }
+ __euler_process_handle dummy;
- else if (packet_type == __EULER_IPT_KEYBOARD)
- if ((key_packet & 0x0400ff) == 0x00005a)
- should_invert = true;
+ euler::start_process wm_process("/bin/compositor");
+ wm_process.add_env_variable("ARGC", "1");
+ wm_process.add_env_variable("ARGV0", "/bin/compositor");
+ wm_process.start(dummy);
- if (should_invert) {
- daguerre::swap(burden_stretch_hilbert, burden_stretch_inverted_hilbert);
- should_draw = true;
- }
+ euler::start_process hello_process("/bin/hello");
+ hello_process.add_env_variable("ARGC", "1");
+ hello_process.add_env_variable("ARGV0", "/bin/hello");
+ hello_process.start(dummy);
- }
+ return 0;
}