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