REPENTOGON
REPENTOGON copied to clipboard
[Suggestion] Add an example mod for GenericPrompt class
The usage of the GenericPrompt class might require some small hints :)
Here is a small example on how to use it. Something like this should be added to the docs:
local myPrompt = GenericPrompt()
myPrompt:Initialize()
myPrompt:SetText("Some test text")
local wasPromptDisplayed = false
function mod:myRenderFunction(_)
myPrompt:Render()
end
mod:AddCallback(ModCallbacks.MC_POST_RENDER, mod.myRenderFunction)
function mod:myUpdateFunction(_)
myPrompt:Update(true) -- true = Process user inputs
if wasPromptDisplayed and not myPrompt:IsActive() then -- prompt was closed by user
print("User selected option: "..myPrompt:GetSubmittedSelection())
wasPromptDisplayed = false
end
if Input.IsButtonTriggered(Keyboard.KEY_MINUS, 0) then -- on Pressing minus button will open prompt
myPrompt:Show()
wasPromptDisplayed = true
end
end
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, mod.myUpdateFunction)
Thanks for your example! :)