49 lines
1.3 KiB
Lua
49 lines
1.3 KiB
Lua
--[[ Constants
|
|
* (all lua builtins that don't allow io/executing code)
|
|
color (interface)
|
|
gui (interface)
|
|
multi (interface bound to a processor) no thread module
|
|
|
|
callback true/false correct/wrong
|
|
]]
|
|
local label
|
|
local video
|
|
|
|
local function index(window, q, callback)
|
|
if not q.video or q.video == "" then
|
|
error("Missing 'video' field for question!")
|
|
callback()
|
|
return
|
|
end
|
|
frame = window:newFrame(0,0,0,-200,0,.2,1,.8)
|
|
frame.visibility = 0
|
|
label = window:newTextLabel(" " ..q.title.. " ",0,0,0,0,0,0,1,.2)
|
|
label.align = ALIGN_CENTER
|
|
label.textColor = color.white
|
|
label.color = color.new("#363ac8")
|
|
label:centerFont()
|
|
label:scaleFont(.4)
|
|
label.drawBorder = false
|
|
local holder = frame:newFrame(-300, -200, 600, 400, .5, .5)
|
|
holder:centerX(true)
|
|
holder:centerY(true)
|
|
holder.visibility = 0
|
|
video = holder:newVideoPlayer(q.video, 0, 0, 600, 400, false)
|
|
video:setAspectSize(video.imageWidth,video.imageHeight)
|
|
video:OnReleased(function()
|
|
video:play()
|
|
end)
|
|
video.XButton.visible = false
|
|
|
|
useDefaultHandler(callback)
|
|
end
|
|
|
|
local function update(dt) -- time in seconds that has passed since
|
|
|
|
end
|
|
|
|
return {
|
|
index = index,
|
|
update = update
|
|
}
|