SetCurrent

This function makes a context the current context for drawing operations.

Syntax

Parameters

Example

local window = Window:Create()

--Create a rendering context
local context = Context:Create(window)

--Set the current context (not needed, but here it is)
Context:SetCurrent(context)

while true do
local context = Context:GetCurrent()
local window = context:GetWindow()

if (window:Closed() or window:KeyDown(Key.Escape)) then return false end

context:SetColor(0,0,1)
context:Clear()

--Draw a rectangle on the screen
context:SetColor(1,0,0)
context:DrawRect(100,100,window:GetWidth()-200,window:GetHeight()-200)

context:Sync()
return true
end