Skip to content

mouse_x / mouse_y not clamped to window bounds #142

@SableRaf

Description

@SableRaf

In Processing, mouseX and mouseY are always clamped to the sketch window.

In mewnala, they can take values outside the window, all relative to the top-left of the window within the display.

Steps to reproduce

Processing

void setup(){
  size(200,200);
}

void draw(){
  println("mouseX:" + mouseX + " mouseY: " + mouseY);
}

Values stay within [0, width] and [0, height]

mewnala

from mewnala import *

def setup():
    size(200, 200)

def draw():
    print("mouse_x: " + str(mouse_x) + " mouse_y: " + str(mouse_y))

run()

Example output:

mouse_x: -764.0 mouse_y: -279.0
mouse_x: 963.98 mouse_y: 837.98

Expected behavior

mouse_x and mouse_y should be clamped to [0, width] and [0, height] to match Processing.

Screenshots

Image
Image
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions