mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-19 15:44:07 +00:00
menu kinda works
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@108 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
10
src/menu.c
10
src/menu.c
@@ -82,9 +82,19 @@ static void draw(MwWidget handle) {
|
||||
MwDrawRect(handle, &r, base);
|
||||
for(i = 0; i < arrlen(m->sub); i++) {
|
||||
int tw = MwTextWidth(handle, m->sub[i]->name);
|
||||
int th = MwTextHeight(handle, m->sub[i]->name);
|
||||
|
||||
p.x += tw / 2;
|
||||
|
||||
r.x = p.x - tw / 2 - 5;
|
||||
r.y = p.y - th / 2 - 5;
|
||||
r.width = tw + 10;
|
||||
r.height = th + 10;
|
||||
|
||||
if(handle->pressed && r.x <= handle->pressed_point.x && r.y <= handle->pressed_point.y && handle->pressed_point.x <= (int)(r.x + r.width) && handle->pressed_point.y <= (int)(r.y + r.height)) {
|
||||
MwDrawFrame(handle, &r, base, 0);
|
||||
}
|
||||
|
||||
MwDrawText(handle, &p, m->sub[i]->name, 1, text);
|
||||
|
||||
p.x += tw / 2 + 20;
|
||||
|
||||
Reference in New Issue
Block a user