ExperimentalGear/scripts/titlescreen/pages/service/inputcheckpage.lua

50 lines
1.8 KiB
Lua

require("common.class")
local ServicePage = require("titlescreen.pages.service.servicepage")
local InputButtonField = require("titlescreen.fields.service.inputbuttonfield")
local InputKnobField = require("titlescreen.fields.service.inputknobfield")
---@class InputCheckPage: ServicePage
local InputCheckPage = {}
---Create a new InputCheckPage instance
---
---Inherits from ServicePage
---@param o ServicePage
---@return InputCheckPage
function InputCheckPage:new(o)
o = Inherit(self, ServicePage, o)
o.title = o.title or "INPUT CHECK"
o.footer = o.footer or "BACK = RETURN TO LAST PAGE"
o:addField(InputButtonField:new{label="START BUTTON", button=game.BUTTON_STA})
o:addField(InputButtonField:new{label="A BUTTON", button=game.BUTTON_BTA})
o:addField(InputButtonField:new{label="B BUTTON", button=game.BUTTON_BTB})
o:addField(InputButtonField:new{label="C BUTTON", button=game.BUTTON_BTC})
o:addField(InputButtonField:new{label="D BUTTON", button=game.BUTTON_BTD})
o:addField(InputButtonField:new{label="FX L BUTTON", button=game.BUTTON_FXL})
o:addField(InputButtonField:new{label="FX R BUTTON", button=game.BUTTON_FXR})
o:addField(InputKnobField:new{label="ANALOG VOLUME L", knob=0})
o:addField(InputKnobField:new{label="ANALOG VOLUME R", knob=1})
return o
end
function InputCheckPage:handleButtonInput(button)
local stop_processing = false
local field = self.content[self.selectedIndex]
if field and field.handleButtonInput then
stop_processing = field:handleButtonInput(button)
end
if not stop_processing then
if button == game.BUTTON_BCK then
if self.viewHandler then
self.viewHandler:back()
end
return
end
end
end
return InputCheckPage