Skip to content

Commit 82bd0a5

Browse files
committed
freecam: Little optimization
Call guiGetScreenSize just once instead of every frame.
1 parent 08ef1d0 commit 82bd0a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

[editor]/freecam/freecam.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ local speed = 0
33
local strafespeed = 0
44
local rotX, rotY = 0,0
55
local velocityX, velocityY, velocityZ
6+
local width, height = guiGetScreenSize()
67

78
-- configurable parameters
89
local options = {
@@ -229,7 +230,6 @@ local function freecamMouse (cX,cY,aX,aY)
229230
end
230231

231232
-- how far have we moved the mouse from the screen center?
232-
local width, height = guiGetScreenSize()
233233
aX = aX - width / 2
234234
aY = aY - height / 2
235235

0 commit comments

Comments
 (0)