Add a display server and graphical user interface #38

Merged
apio merged 103 commits from display-server into main 2023-09-20 18:49:21 +00:00
2 changed files with 8 additions and 2 deletions
Showing only changes of commit 25ad2b17aa - Show all commits

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

View File

@ -1,17 +1,23 @@
#include "Mouse.h"
#include <os/File.h>
#include <ui/Image.h>
static SharedPtr<ui::Image> 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)