Luna/apps/mouse.cpp

17 lines
422 B
C++
Raw Normal View History

#include <moon/Mouse.h>
#include <os/File.h>
Result<int> luna_main(int, char**)
{
auto mouse = TRY(os::File::open("/dev/mouse", os::File::ReadOnly));
mouse->set_buffer(os::File::NotBuffered);
while (1)
{
moon::MousePacket packet;
TRY(mouse->read_typed(packet));
os::println("Mouse packet: xdelta=%d, ydelta=%d, buttons=%d", packet.xdelta, packet.ydelta, packet.buttons);
}
}