Tomas Posted January 22, 2017 Posted January 22, 2017 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)? Quote
mdgunn Posted January 22, 2017 Posted January 22, 2017 You want to use the methods of the Context object. See here. http://www.leadwerks.com/werkspace/page/api-reference/_/context/ E.g. http://www.leadwerks.com/werkspace/page/api-reference/_/context/contextdrawrect-r724 http://www.leadwerks.com/werkspace/page/api-reference/_/context/contextdrawimage-r721 http://www.leadwerks.com/werkspace/page/api-reference/_/context/contextdrawtext-r731 Quote
Tomas Posted January 22, 2017 Author Posted January 22, 2017 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? Quote
Tomas Posted January 22, 2017 Author Posted January 22, 2017 ...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 Quote
Recommended Posts
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.