scrolling events

This commit is contained in:
2026-05-01 14:27:29 +03:00
parent 4da296a135
commit 6834318639
2 changed files with 10 additions and 1 deletions

View File

@@ -187,7 +187,7 @@ end
function computer.pullSignal(timeout) function computer.pullSignal(timeout)
timeout = timeout or math.huge timeout = timeout or math.huge
timeout = math.max(timeout, 0.05) timeout = math.max(timeout, 0.001)
local deadline = computer.uptime() + timeout local deadline = computer.uptime() + timeout
while true do while true do
if computer.uptime() >= deadline then return end if computer.uptime() >= deadline then return end

View File

@@ -6,6 +6,7 @@
#include "neonucleus.h" #include "neonucleus.h"
#include "ncomplib.h" #include "ncomplib.h"
#include "glyphcache.h" #include "glyphcache.h"
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -494,6 +495,7 @@ int main(int argc, char **argv) {
nn_mountComponent(c, testDrive, 4, false); nn_mountComponent(c, testDrive, 4, false);
nn_mountComponent(c, testFlash, 5, false); nn_mountComponent(c, testFlash, 5, false);
int ltx = 0, lty = 0; int ltx = 0, lty = 0;
double scrollBuf = 0;
while(true) { while(true) {
if(WindowShouldClose()) break; if(WindowShouldClose()) break;
@@ -555,9 +557,14 @@ int main(int argc, char **argv) {
if(ltx != tx || lty != ty) { if(ltx != tx || lty != ty) {
ltx = tx; ltx = tx;
lty = ty; lty = ty;
//scrollBuf = 0;
nn_pushDrag(c, scraddr, tx, ty, 0, player); nn_pushDrag(c, scraddr, tx, ty, 0, player);
} }
} }
if(fabs(scrollBuf) >= 1) {
nn_pushScroll(c, scraddr, tx, ty, scrollBuf, player);
scrollBuf = 0;
}
} }
} }
@@ -578,6 +585,8 @@ int main(int argc, char **argv) {
EndDrawing(); EndDrawing();
scrollBuf += GetMouseWheelMove();
// keyboard input // keyboard input
// 1: clipboard // 1: clipboard