Skip to content

Commit

Permalink
Remove all input scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhonnyg committed Nov 22, 2023
1 parent 642bb68 commit 2797d1d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
7 changes: 3 additions & 4 deletions main/ac2/ac2.script
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
function init(self)
msg.post(".", "acquire_input_focus")
self.scale = (sys.get_config_int("display.high_dpi") == 1) and 2 or 1
end

function on_input(self, action_id, action)
if not action_id or action_id == hash("touch") then
if action.pressed then
rive.pointer_down("#model", action.x * self.scale, action.y * self.scale)
rive.pointer_down("#model", action.x, action.y)
elseif action.released then
rive.pointer_up("#model", action.x * self.scale, action.y * self.scale)
rive.pointer_up("#model", action.x, action.y)
else
rive.pointer_move("#model", action.x * self.scale, action.y * self.scale)
rive.pointer_move("#model", action.x, action.y)
end
end
end
7 changes: 3 additions & 4 deletions main/circleui/circleui.script
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
function init(self)
msg.post(".", "acquire_input_focus")
self.scale = 1 -- (sys.get_config_int("display.high_dpi") == 1) and 2 or 1
end

function on_input(self, action_id, action)
if not action_id or action_id == hash("touch") then
if action.pressed then
rive.pointer_down("#ui", action.x * self.scale, action.y * self.scale)
rive.pointer_down("#ui", action.x, action.y)
elseif action.released then
rive.pointer_up("#ui", action.x * self.scale, action.y * self.scale)
rive.pointer_up("#ui", action.x, action.y)
else
rive.pointer_move("#ui", action.x * self.scale, action.y * self.scale)
rive.pointer_move("#ui", action.x, action.y)
end
end
end
7 changes: 3 additions & 4 deletions main/ghost/ghost.script
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
function init(self)
msg.post(".", "acquire_input_focus")
self.scale = (sys.get_config_int("display.high_dpi") == 1) and 2 or 1
end

function on_input(self, action_id, action)
if not action_id or action_id == hash("touch") then
if action.pressed then
rive.pointer_down("#ui", action.x * self.scale, action.y * self.scale)
rive.pointer_down("#ui", action.x, action.y)
elseif action.released then
rive.pointer_up("#ui", action.x * self.scale, action.y * self.scale)
rive.pointer_up("#ui", action.x, action.y)
else
rive.pointer_move("#ui", action.x * self.scale, action.y * self.scale)
rive.pointer_move("#ui", action.x, action.y)
end
end
end
7 changes: 3 additions & 4 deletions main/sophiahud/sophiahud.script
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
function init(self)
msg.post(".", "acquire_input_focus")
self.scale = 1 -- (sys.get_config_int("display.high_dpi") == 1) and 2 or 1
end

function on_input(self, action_id, action)
if not action_id or action_id == hash("touch") then
if action.pressed then
rive.pointer_down("#hud", action.x * self.scale, action.y * self.scale)
rive.pointer_down("#hud", action.x, action.y)
elseif action.released then
rive.pointer_up("#hud", action.x * self.scale, action.y * self.scale)
rive.pointer_up("#hud", action.x, action.y)
else
rive.pointer_move("#hud", action.x * self.scale, action.y * self.scale)
rive.pointer_move("#hud", action.x, action.y)
end
end
end

0 comments on commit 2797d1d

Please sign in to comment.