You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi here, thank you for creating the binding so that building raylib application in zig has becoming very easy.
However, I have faced an issue about using touch screen:
My zenbook supports multitouch, so I have written a multitouch demo in zig based on this example from the official raylib website which it works with my laptop , but no matter how, none of the fingers are responded on the screen. After I have traced the code, I just found that getTouchPointCount() never counts the number of fingers on the screen.
Here is my code:
const std = @import("std");
const rl = @import("raylib");
const gui = @import("raygui");
pub fn main() !void {
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
const screenHeight = 450;
const MAX_TOUCH_POINTS = 10;
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
defer rl.closeWindow(); // Close window and OpenGL context
var touch_points: [MAX_TOUCH_POINTS]rl.Vector2 = std.mem.zeroes([10]rl.Vector2);
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!rl.windowShouldClose()) { // Detect window close button or ESC key
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
var t_count = rl.getTouchPointCount();
std.debug.print("Number of Touch Points: {d}\n", .{t_count});
if (t_count > MAX_TOUCH_POINTS) t_count = MAX_TOUCH_POINTS;
var i: i32 = 0;
while (i < t_count) : (i += 1) {
touch_points[@as(usize, @intCast(i))] = rl.getTouchPosition(i);
}
// Draw
//----------------------------------------------------------------------------------
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(rl.Color.white);
for (0..@as(usize, @intCast(t_count))) |j| {
if ((touch_points[j].x > 0) and (touch_points[j].y > 0)) {
rl.drawCircleV(touch_points[j], 34, rl.Color.orange);
rl.drawText("Touch", @as(i32, @intFromFloat(touch_points[j].x)) - 10, @as(i32, @intFromFloat(touch_points[j].y)) - 10, 40, rl.Color.black);
}
}
//----------------------------------------------------------------------------------
}
}
Is there any difference for this binding, compared to the original C version? Anything I have done wrong in the example?
The text was updated successfully, but these errors were encountered:
Not entirely sure if GLFW supports multitouch. Also Zenbooks might not bes supported. Can you try out the original raylib example?
Yep! In fact, I did tried the original example on the website to confirm that raylib works without any issue before I decided to submit the issue; as you can see, I have included this link from the previous post.
I have captured my screen from the example above, showing that in theory, multitouch should works with zenbook; however, with our current binding, it seems to stuck at zero. Perhaps once I have some time, I will try if the original c library behave the same or differently.
Hi here, thank you for creating the binding so that building raylib application in zig has becoming very easy.
However, I have faced an issue about using touch screen:
My zenbook supports multitouch, so I have written a multitouch demo in zig based on this example from the official raylib website which it works with my laptop , but no matter how, none of the fingers are responded on the screen. After I have traced the code, I just found that getTouchPointCount() never counts the number of fingers on the screen.
Here is my code:
Is there any difference for this binding, compared to the original C version? Anything I have done wrong in the example?
The text was updated successfully, but these errors were encountered: