Luna/wind/Mouse.cpp
apio 1fd61f26be
wind: Add a simple display server skeleton using libui
No client functionality yet, but it's a start.
2023-08-17 20:16:14 +02:00

22 lines
494 B
C++

#include "Mouse.h"
Mouse::Mouse(ui::Canvas& screen)
{
m_position.x = screen.width / 2;
m_position.y = screen.height / 2;
m_screen_rect = screen.rect();
}
void Mouse::draw(ui::Canvas& screen)
{
auto canvas = screen.subcanvas(m_position, 10, 10, true).release_value();
canvas.fill(ui::WHITE);
}
void Mouse::move(const moon::MousePacket& packet)
{
m_position.x += packet.xdelta;
m_position.y -= packet.ydelta;
m_position = m_screen_rect.normalize(m_position);
}