You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fix cursor blinking in integrated GPUs
Optimization for Input::set_custom_mouse_cursor when used inside _process function. (Avoids cursor blinking in low end devices)
This commit is contained in:
@@ -448,6 +448,18 @@ void OS_JavaScript::set_cursor_shape(CursorShape p_shape) {
|
||||
void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
||||
|
||||
if (p_cursor.is_valid()) {
|
||||
|
||||
Map<CursorShape, Vector<Variant> >::Element *cursor_c = cursors_cache.find(p_shape);
|
||||
|
||||
if (cursor_c) {
|
||||
if (cursor_c->get()[0] == p_cursor && cursor_c->get()[1] == p_hotspot) {
|
||||
set_cursor_shape(p_shape);
|
||||
return;
|
||||
}
|
||||
|
||||
cursors_cache.erase(p_shape);
|
||||
}
|
||||
|
||||
Ref<Texture> texture = p_cursor;
|
||||
Ref<AtlasTexture> atlas_texture = p_cursor;
|
||||
Ref<Image> image;
|
||||
@@ -551,6 +563,11 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s
|
||||
|
||||
cursors[p_shape] = url;
|
||||
|
||||
Vector<Variant> params;
|
||||
params.push_back(p_cursor);
|
||||
params.push_back(p_hotspot);
|
||||
cursors_cache.insert(p_shape, params);
|
||||
|
||||
} else if (cursors[p_shape] != "") {
|
||||
/* clang-format off */
|
||||
EM_ASM({
|
||||
|
||||
Reference in New Issue
Block a user