GetWidth

This function returns the width of a context in pixels. Use this for precise placement of 2D elements on the screen.

Syntax

Returns

Returns the width of the context

Example

window = Window:Create()
context = Context:Create(window)

while true do
if window:Closed() or window:KeyHit(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,context:GetWidth()-200,context:GetHeight()-200)

context:Sync()
end