From 1e9aeb50e62df3c584edc606adc3722f2f0e9e2a Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Mon, 29 Sep 2025 04:48:59 +0000 Subject: [PATCH] hmm git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@48 b9cfdab3-6d41-4d17-bbe4-086880011989 --- GNUmakefile | 2 +- example.c | 12 ++++++++---- src/draw.c | 48 ++++++++++++++++++++++++------------------------ src/gdi.c | 2 ++ 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 0f8e023..c3b914f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ TARGET = $(shell uname -s) CC = gcc -CFLAGS = -Wall -Wextra -fPIC -Iinclude -D_MILSKO +CFLAGS = -Wall -Wextra -fPIC -Iinclude -D_MILSKO -g LDFLAGS = LIBS = diff --git a/example.c b/example.c index 6c48f80..2c8967c 100644 --- a/example.c +++ b/example.c @@ -7,14 +7,18 @@ void handler(MwWidget handle, void* user_data, void* call_data){ } int main(){ + int i; MwWidget window = MwVaCreateWidget(MwWindowClass, "main", NULL, 0, 0, 400, 400, MwNtitle, "hello world", NULL); - MwWidget button = MwVaCreateWidget(MwButtonClass, "button", window, 50, 50, 300, 300, - MwNtext, "lorem ipsum", - NULL); - MwAddUserHandler(button, MwNactivateHandler, handler, NULL); + for(i = 0; i < 6; i++){ + MwWidget button = MwVaCreateWidget(MwButtonClass, "button", window, 5, 5 + 55 * i, 390, 50, + MwNtext, "lorem ipsum", + NULL); + + MwAddUserHandler(button, MwNactivateHandler, handler, NULL); + } MwLoop(window); } diff --git a/src/draw.c b/src/draw.c index b8cb1fc..840e77b 100644 --- a/src/draw.c +++ b/src/draw.c @@ -67,43 +67,43 @@ void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) { MwLLColor darker = MwLLAllocColor(handle->lowlevel, color->red - diff, color->green - diff, color->blue - diff); MwLLColor lighter = MwLLAllocColor(handle->lowlevel, color->red + diff, color->green + diff, color->blue + diff); - p[0].x = rect->x; - p[0].y = rect->y; + p[0].x = 0; + p[0].y = 0; - p[1].x = rect->x + rect->width; - p[1].y = rect->y; + p[1].x = 0 + rect->width; + p[1].y = 0; - p[2].x = rect->x + rect->width - border; - p[2].y = rect->y + border; + p[2].x = 0 + rect->width - border; + p[2].y = 0 + border; - p[3].x = rect->x + border; - p[3].y = rect->y + border; + p[3].x = 0 + border; + p[3].y = 0 + border; - p[4].x = rect->x + border; - p[4].y = rect->y + rect->height - border; + p[4].x = 0 + border; + p[4].y = 0 + rect->height - border; - p[5].x = rect->x; - p[5].y = rect->y + rect->height; + p[5].x = 0; + p[5].y = 0 + rect->height; MwLLPolygon(handle->lowlevel, p, 6, invert ? darker : lighter); - p[0].x = rect->x + rect->width; - p[0].y = rect->y; + p[0].x = 0 + rect->width; + p[0].y = 0; - p[1].x = rect->x + rect->width - border; - p[1].y = rect->y + border; + p[1].x = 0 + rect->width - border; + p[1].y = 0 + border; - p[2].x = rect->x + rect->width - border; - p[2].y = rect->y + rect->height - border; + p[2].x = 0 + rect->width - border; + p[2].y = 0 + rect->height - border; - p[3].x = rect->x + border; - p[3].y = rect->y + rect->height - border; + p[3].x = 0 + border; + p[3].y = 0 + rect->height - border; - p[4].x = rect->x; - p[4].y = rect->y + rect->height; + p[4].x = 0; + p[4].y = 0 + rect->height; - p[5].x = rect->x + rect->height; - p[5].y = rect->y + rect->height; + p[5].x = 0 + rect->width; + p[5].y = 0 + rect->height; MwLLPolygon(handle->lowlevel, p, 6, invert ? lighter : darker); diff --git a/src/gdi.c b/src/gdi.c index 83f7331..d991d32 100644 --- a/src/gdi.c +++ b/src/gdi.c @@ -81,6 +81,8 @@ MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) { } void MwLLDestroy(MwLL handle) { + MwLLDestroyCommon(handle); + DestroyWindow(handle->hWnd); free(handle);