Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Raylib Gesture.TAP behaves as Gesture.NONE

Open samstorment opened this issue 3 years ago • 0 comments

Context

Odin: dev-2022-08:edba99d6 OS: Windows 10 Home Basic (version: 21H2), build 19044.1826 CPU: Intel(R) Core(TM) i5-7600K CPU @ 3.80GHz RAM: 8154 MiB

Expected Behavior

Raylib's IsGestureDetected(Gesture.TAP) should only return true during a TAP Gesture.

Current Behavior

Raylib's IsGestureDetected(Gesture.TAP) returns true at all times unless a Gesture is happening.

Extra Information

It seems that the Gesture enum is missing the NONE value like the one that exists in the raylib repo. The Odin implementation sets the TAP value to 0 in the Gesture enum, the same as raylib's NONE value.

When I update my own vendor raylib file to include NONE in the Gesture enum, this problem seems to be resolved, but I lack the skill to verify the correctness of this.

Steps to Reproduce

package main

import rl "vendor:raylib"

WIDTH :: 800
HEIGHT :: 450

main :: proc() {

    rl.InitWindow(WIDTH, HEIGHT, "Gesture.TAP Bug")
    defer rl.CloseWindow()

    rl.SetTargetFPS(60)

    for !rl.WindowShouldClose() {

        rl.BeginDrawing()

        rl.ClearBackground(rl.RAYWHITE)

        // these are inverted from my expectation
        if (rl.IsGestureDetected(rl.Gesture.TAP)) {
            rl.DrawText("TAP DETECTED", 100, 100, 32, rl.BLACK)
        } else {
            rl.DrawText("NO TAP DETECTED", 100, 100, 32, rl.BLACK)
        }

        rl.EndDrawing()
    }
}

samstorment avatar Aug 06 '22 23:08 samstorment