Jump to content
Leadwerks Community

Recommended Posts

Posted

Hi. Im wandering is there any 2d functions built in the engine. I want to create a hud, cant find any 2d drawing functions, or maybe there are other ways to display huds (GUI's)?

Posted

function Script:Start()
self.camera = Camera:Create()
self.camera:SetRotation(self.entity:GetRotation(true))
self.camera:SetPosition(self.entity:GetPosition(true)+Vec3(0,1.8,0))
end

function Script:UpdateWorld()
local context=Context:GetCurrent()
context:SetColor(0,0,0)
context:Clear()
context:SetColor(0,1,0)
context:DrawRect(0,0,100,100)
context:Sync()
end

 

When i use this 3d view is gone. How to combine 2d and 3d?

Posted

...figured out. Need to use 2d code in function Script:PostRender:

function Script:PostRender()
local context=Context:GetCurrent()
context:SetColor(0,1,0)
context:DrawRect(0,0,100,100)
end

Thanks for help

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...