This function creates a new point light.
| Parameter | Description |
|---|---|
| world | world to create the entity in |
| range | light range |
Returns a new light.
-- Get the displays
local displays = GetDisplays()
-- Create a window
local window = CreateWindow("Leadwerks", 0, 0, 1280, 720, displays[1], WINDOW_CENTER | WINDOW_TITLEBAR)
-- Create a framebuffer
local framebuffer = CreateFramebuffer(window)
-- Create a world
local world = CreateWorld()
-- Create a camera
local camera = CreateCamera(world)
camera:SetClearColor(0.125)
camera:SetFov(70)
camera:Move(0, 2, -8)
-- Create light
local light = CreatePointLight(world)
light:SetPosition(0, 3, 0)
light:SetColor(2)
-- Create ground
local ground = CreateBox(world, 20, 1, 20)
ground:SetPosition(0, -0.5, 0)
ground:SetColor(0, 1, 0)
-- Main loop
while window:Closed() == false and window:KeyHit(KEY_ESCAPE) == false do
world:Update()
world:Render(framebuffer)
end