From 5aeab1c853e487aa0042d5c32200d623efe908d3 Mon Sep 17 00:00:00 2001 From: Miguel Date: Sat, 13 Oct 2018 17:18:49 +0200 Subject: fontstuff et al. --- video/compositor.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 6 deletions(-) (limited to 'video') diff --git a/video/compositor.c b/video/compositor.c index 4debe9a..d6689a7 100644 --- a/video/compositor.c +++ b/video/compositor.c @@ -5,6 +5,7 @@ #include "kmalloc.h" #include "log.h" #include "vmem.h" +#include "timer.h" #include "asm_x86.h" #include "mount.h" @@ -32,6 +33,9 @@ struct window struct window windows[MAX_WINDOWS]; +static uint32_t display_width=1920; +static uint32_t display_height=1080; + static uint16_t next_window=0; static uint16_t next_x=50; static uint16_t next_y=50; @@ -156,15 +160,27 @@ static void put_mouse() { if(mouse_k&1) { - for(int i=-5;i<5;i++) - for(int j=-5;j<5;j++) - backbuffer[(mouse_y+j)*vesa_width+mouse_x+i]=0x00ff00; + for(int i=0;i<1;i++) + for(int j=0;j=0;i--) { @@ -316,8 +334,22 @@ void compositor_mouse_handle(uint16_t x,uint16_t y, uint8_t key) } } +// https://stackoverflow.com/questions/3581528/how-is-the-square-root-function-implemented +double sqroot(double n){ + double lo = 0, hi = n, mid; + for(int i = 0 ; i < 10 ; i++){ + mid = (lo+hi)/2; + if(mid*mid == n) return mid; + if(mid*mid > n) hi = mid; + else lo = mid; + } + return mid; +} + void compositor_set_background(char *ppm_raw_filename) { +// uint64_t t=timer_get_ms()/333; + /* klog("loading bg..."); fd bg=mount_file_open(ppm_raw_filename); @@ -334,4 +366,25 @@ void compositor_set_background(char *ppm_raw_filename) } klog("finished"); + */ + + int center_x=vesa_width/2; + int center_y=vesa_height/2; + + int max_dist = center_x*center_x+center_y*center_y; + + for(int x=0;x