|
18 | 18 | #if ARCH == x86 |
19 | 19 | #include <x86/boot.h> |
20 | 20 | #include <x86/io.h> |
| 21 | + #include <drivers/x86/pc/ps2_devices.h> |
21 | 22 | #endif |
22 | 23 |
|
23 | 24 | typedef struct GraphicsInfo { |
@@ -80,11 +81,17 @@ static void arch_waitForNextVerticalRetrace() |
80 | 81 |
|
81 | 82 | static void draw_cursor (const KGraphicsArea* g) |
82 | 83 | { |
83 | | - UINT mouse_x = 600; // Some random location at this point |
84 | | - UINT mouse_y = 400; |
85 | | - kgraphics_rect (g, mouse_x, mouse_y, 10, 10, MOUSE_BG_COLOR); |
86 | | - kgraphics_hline (g, mouse_x, mouse_y, 10, 2, MOUSE_FG_COLOR); |
87 | | - kgraphics_vline (g, mouse_x, mouse_y, 10, 2, MOUSE_FG_COLOR); |
| 84 | + MousePositionData mdata = mouse_get_packet(); |
| 85 | + |
| 86 | + INT mouse_y = (INT)g->height_px / 2 - mdata.y; |
| 87 | + INT mouse_x = (INT)g->width_px / 2 + mdata.x; |
| 88 | + |
| 89 | + mouse_x = CLAMP (mouse_x, 0, (INT)g->width_px - 10); |
| 90 | + mouse_y = CLAMP (mouse_y, 0, (INT)g->height_px - 10); |
| 91 | + |
| 92 | + kgraphics_rect (g, (UINT)mouse_x, (UINT)mouse_y, 10, 10, MOUSE_BG_COLOR); |
| 93 | + kgraphics_hline (g, (UINT)mouse_x, (UINT)mouse_y, 10, 2, MOUSE_FG_COLOR); |
| 94 | + kgraphics_vline (g, (UINT)mouse_x, (UINT)mouse_y, 10, 2, MOUSE_FG_COLOR); |
88 | 95 | } |
89 | 96 |
|
90 | 97 | void kgraphics_drawstring (const KGraphicsArea* g, UINT x, UINT y, const char* text, Color fg, |
|
0 commit comments