MCPcopy Create free account
hub / github.com/electronstudio/raylib-python-cffi / update_mouse

Method update_mouse

examples/extra/extra_camera.py:69–83  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

67 self.position = self.position - self.world_up * velocity
68
69 def update_mouse(self):
70 pos = rl.GetMousePosition()
71 width = rl.GetScreenWidth()
72 height = rl.GetScreenHeight()
73
74 mouse_coordinates = ffi.new("struct Vector2 *", [
75 pos.x - self.last_mouse.x,
76 pos.y - self.last_mouse.y
77 ])
78
79 self.yaw += mouse_coordinates.x * self.mouse_sensitivity
80 self.pitch += (mouse_coordinates.y * self.mouse_sensitivity)
81 self.pitch = min(self.pitch, 1.5)
82 self.pitch = max(self.pitch, -1.5)
83 self.last_mouse = rl.GetMousePosition()
84
85 def update(self):
86 # NOTE(pebaz): Comment out these lines to control them in a game loop

Callers 1

updateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected