scrolling events
This commit is contained in:
@@ -187,7 +187,7 @@ end
|
||||
|
||||
function computer.pullSignal(timeout)
|
||||
timeout = timeout or math.huge
|
||||
timeout = math.max(timeout, 0.05)
|
||||
timeout = math.max(timeout, 0.001)
|
||||
local deadline = computer.uptime() + timeout
|
||||
while true do
|
||||
if computer.uptime() >= deadline then return end
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "neonucleus.h"
|
||||
#include "ncomplib.h"
|
||||
#include "glyphcache.h"
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -494,6 +495,7 @@ int main(int argc, char **argv) {
|
||||
nn_mountComponent(c, testDrive, 4, false);
|
||||
nn_mountComponent(c, testFlash, 5, false);
|
||||
int ltx = 0, lty = 0;
|
||||
double scrollBuf = 0;
|
||||
while(true) {
|
||||
if(WindowShouldClose()) break;
|
||||
|
||||
@@ -555,9 +557,14 @@ int main(int argc, char **argv) {
|
||||
if(ltx != tx || lty != ty) {
|
||||
ltx = tx;
|
||||
lty = ty;
|
||||
//scrollBuf = 0;
|
||||
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();
|
||||
|
||||
scrollBuf += GetMouseWheelMove();
|
||||
|
||||
// keyboard input
|
||||
|
||||
// 1: clipboard
|
||||
|
||||
Reference in New Issue
Block a user