diff --git a/base/usr/share/cursors/default.tga b/base/usr/share/cursors/default.tga new file mode 100644 index 00000000..ef3bb7a0 Binary files /dev/null and b/base/usr/share/cursors/default.tga differ diff --git a/wind/Mouse.cpp b/wind/Mouse.cpp index d0518ff2..2d1bb076 100644 --- a/wind/Mouse.cpp +++ b/wind/Mouse.cpp @@ -1,17 +1,23 @@ #include "Mouse.h" #include +#include + +static SharedPtr g_mouse_cursor; Mouse::Mouse(ui::Canvas& screen) { m_position.x = screen.width / 2; m_position.y = screen.height / 2; m_screen_rect = screen.rect(); + + g_mouse_cursor = ui::Image::load("/usr/share/cursors/default.tga").value_or({}); } void Mouse::draw(ui::Canvas& screen) { - auto canvas = screen.subcanvas(ui::Rect { m_position, 10, 10 }); - canvas.fill(ui::WHITE); + if (!g_mouse_cursor) return; + auto canvas = screen.subcanvas(ui::Rect { m_position, g_mouse_cursor->width(), g_mouse_cursor->height() }); + canvas.fill(g_mouse_cursor->pixels(), g_mouse_cursor->width()); } void Mouse::update(const moon::MousePacket& packet)