+6
-6
src/Vaxis.zig
+6
-6
src/Vaxis.zig
···
851
851
const ypos = mouse.row;
852
852
const xextra = self.screen.width_pix % self.screen.width;
853
853
const yextra = self.screen.height_pix % self.screen.height;
854
-
const xcell = (self.screen.width_pix - xextra) / self.screen.width;
855
-
const ycell = (self.screen.height_pix - yextra) / self.screen.height;
854
+
const xcell: i16 = @intCast((self.screen.width_pix - xextra) / self.screen.width);
855
+
const ycell: i16 = @intCast((self.screen.height_pix - yextra) / self.screen.height);
856
856
if (xcell == 0 or ycell == 0) return mouse;
857
-
result.col = xpos / xcell;
858
-
result.row = ypos / ycell;
859
-
result.xoffset = xpos % xcell;
860
-
result.yoffset = ypos % ycell;
857
+
result.col = @divFloor(xpos, xcell);
858
+
result.row = @divFloor(ypos, ycell);
859
+
result.xoffset = @intCast(@mod(xpos, xcell));
860
+
result.yoffset = @intCast(@mod(ypos, ycell));
861
861
}
862
862
return result;
863
863
}