better api for mouse

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@269 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-11 13:01:41 +00:00
parent a5dae3ffd9
commit d03ccea517
12 changed files with 133 additions and 87 deletions

View File

@@ -95,12 +95,14 @@ static void mouse_move(MwWidget handle) {
}
}
static void mouse_up(MwWidget handle) {
static void mouse_up(MwWidget handle, void* ptr) {
MwEntry e = handle->internal;
int w = MwGetInteger(handle, MwNwidth);
int h = MwGetInteger(handle, MwNheight);
const char* str = MwGetText(handle, MwNtext);
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
if(e->mouse.x >= (w - e->right)) {
char s[512];
if(e->mouse.y >= (h / 2)) {
@@ -114,9 +116,11 @@ static void mouse_up(MwWidget handle) {
MwForceRender(handle);
}
static void mouse_down(MwWidget handle) {
static void mouse_down(MwWidget handle, void* ptr) {
MwEntry e = handle->internal;
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
e->mouse = handle->mouse_point;
MwForceRender(handle);