This function gets the outer and inner cone angles of a spotlight.
The spotlight outer and inner cone angles in the X and Y components of the returned Vec2, respectively.
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-8)
--Create a model
local model = Model:Box()
model:SetColor(0.0,1.0,0.0)
model:SetScale(10,1,10)
light = SpotLight:Create()
light:SetPosition(0,3,0)
light:Turn(90,0,0)
light:SetConeAngles(10,7.5)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
local delta = ((window:KeyDown(Key.Up)and 1 or 0) - (window:KeyDown(Key.Down) and 1 or 0)) * Time:GetSpeed() * 0.1
local angles = light:GetConeAngles()
angles.x = angles.x + delta
angles.x = Math:Clamp(angles.x,1,45)
angles.y = angles.x * 0.75
light:SetConeAngles(angles.x,angles.y)
Time:Update()
world:Update()
world:Render()
context:SetBlendMode(Blend.Alpha)
context:DrawText("Cone angles: "..angles:ToString(),2,2)
context:Sync()
end