Create
This function creates and returns a new window.
Syntax
- Window Create(string title="Leadwerks", number x=0, number y=0, number width=1024, number height=768, number style=Titlebar)
Parameters
- title: the window text.
- x: the x position of the new window.
- y: the y position of the new window.
- width: the width of the new window.
- height: the height of the new window.
- style: the style of the new window. This can be any combination of the following bitwise flags:
- Window::Titlebar: the window will have a titlebar with text shown.
- Window::Resizable: the window will be resizable and have minimize and maximize buttons.
- Window;:Hidden: the window will be initially hidden on creation.
- Window::FullScreen: the window will take up the entire screen, and the screen resolution will be changed to match the window size.
Returns
Returns a new window. If the window cannot be created with the specified parameters, NULL is returned.
Example
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
local camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)
model = Model:Box()
model:SetColor(0.0,0.0,1.0)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
model:Turn(0,Time:GetSpeed(),0)
Time:Update()
world:Update()
world:Render()
context:Sync(false)
end