37 lines
1.3 KiB
Lua
37 lines
1.3 KiB
Lua
|
|
-- returns true, if slider edit mode (selected state) should be toggled (on controller release)
|
|
function freeEditControllerInputFunction( keyCode, pressed, pressedPrev, param )
|
|
local result = (keyCode == KeyCodes.KEY_PRESS and pressedPrev and not pressed)
|
|
return result
|
|
end
|
|
|
|
-- returns true, if slider should change its value (controller rotate, and active edit mode)
|
|
function freeEditControllerInputChangeValueFunction( keyCode, pressed, pressedPrev, param, editMode )
|
|
|
|
if not editMode then
|
|
return false, false
|
|
end
|
|
|
|
local increase = (keyCode == KeyCodes.KEY_RIGHT)
|
|
local decrease = (keyCode == KeyCodes.KEY_LEFT)
|
|
|
|
return increase, decrease
|
|
|
|
end
|
|
|
|
-- returns the correct color for specific input selections / works as a switch
|
|
function editableTextColorSwitch( editmode, focused, editColor, focusedColor, unfocusedColor)
|
|
|
|
if (editmode and focused) then
|
|
return editColor
|
|
elseif (not editmode and focused) then
|
|
return focusedColor
|
|
else
|
|
return unfocusedColor
|
|
end
|
|
end
|
|
|
|
-- checks by the given index for this element and the maximum that should be available it this element is really visible
|
|
function editableTextVisibility( elementIndex, maxIndex )
|
|
return maxIndex ~= nil and elementIndex < maxIndex
|
|
end |