2022-04-03 19:43:50 +02:00
|
|
|
require("common.class")
|
2022-04-03 04:59:43 +02:00
|
|
|
local dim = require("common.dimensions")
|
|
|
|
local ServiceField = require("titlescreen.service.servicefield")
|
|
|
|
|
|
|
|
---@class InputButtonField: ServiceField
|
|
|
|
---@field button integer
|
|
|
|
local InputButtonField = {}
|
|
|
|
|
|
|
|
function InputButtonField:new(o)
|
2022-04-03 19:43:50 +02:00
|
|
|
o = Inherit(self, ServiceField, o)
|
2022-04-03 04:59:43 +02:00
|
|
|
|
|
|
|
o.button = o.button or nil
|
|
|
|
|
|
|
|
return o
|
|
|
|
end
|
|
|
|
|
|
|
|
function InputButtonField:drawValue(deltaTime)
|
|
|
|
local buttonState = game.GetButton(self.button)
|
|
|
|
local posX = dim.design.width / 2
|
|
|
|
|
|
|
|
self.value = buttonState and "ON" or "OFF"
|
|
|
|
|
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.Text(self.value, posX, 0)
|
|
|
|
end
|
|
|
|
|
|
|
|
return InputButtonField
|