kOS/ui/rocket.ks

50 lines
1.2 KiB
Plaintext

function launchButtonPressed {
run "launch"(
targetApo:TEXT:ToNumber(),
gravTurnStart:TEXT:ToNumber(),
gravPitch:TEXT:ToNumber(),
initialPitch:TEXT:ToNumber(),
minimumPitch:TEXT:ToNumber()
).
}
function nodeButtonPressed {
run "execnode".
}
// Main UI.
local interface is gui(200).
set interface:X to 200.
set interface:Y to 800.
// Launch button
local hBox is interface:AddHBox().
hBox:AddLabel("Initial Pitch").
local initialPitch is hBox:AddTextField("85").
local hBox is interface:AddHBox().
hBox:AddLabel("Minimum Pitch").
local minimumPitch is hBox:AddTextField("5").
local hBox is interface:AddHBox().
hBox:AddLabel("Gravity Turn @").
local gravTurnStart is hBox:AddTextField("8000").
local hBox is interface:AddHBox().
hBox:AddLabel("Gravity Pitch").
local gravPitch is hBox:AddTextField("75").
local hBox is interface:AddHBox().
hBox:AddLabel("Target Apoapsis").
local targetApo is hBox:AddTextField("80000").
local launchButton is interface:AddButton("Launch").
set launchButton:onClick to launchButtonPressed@.
local nodeButton is interface:AddButton("Execute Node").
set nodeButton:onClick to nodeButtonPressed@.
interface:show().
wait until false.