ExperimentalGear/scripts/titlescreen/fields/service/inputbuttonfield.lua

33 lines
749 B
Lua
Raw Normal View History

require("common.class")
2022-04-05 17:31:02 +02:00
local Dim = require("common.dimensions")
local ServiceField = require("titlescreen.fields.service.servicefield")
---@class InputButtonField: ServiceField
---@field button integer
local InputButtonField = {}
function InputButtonField:new(o)
o = Inherit(self, ServiceField, o)
o.button = o.button or nil
return o
end
function InputButtonField:activate() end
function InputButtonField:focus() end
function InputButtonField:deactivate() end
function InputButtonField:drawValue(deltaTime)
local buttonState = game.GetButton(self.button)
2022-04-05 17:31:02 +02:00
local posX = Dim.design.width / 2
self.value = buttonState and "ON" or "OFF"
gfx.BeginPath()
gfx.Text(self.value, posX, 0)
end
return InputButtonField