ErhanK Posted April 10, 2018 Share Posted April 10, 2018 Hi, I have a question. How can I use "PostRender" in c++ for drawing a rectangle like this lua script? I did but, screen is flickering. I think this is must be in PostRender --This function will be called after the world is rendered, before the screen is refreshed. --Use this to perform any 2D drawing you want the entity to display. function Script:PostRender(context) local window = context:GetWindow() context:SetBlendMode(Blend.Alpha) --draw selection rectangle if ( self.beginSelectPos ~= nil and self.endSelectPos ~= nil ) then context:SetColor(1,0,0,0.5) context:DrawRect(self.beginSelectPos.x, self.beginSelectPos.y, self.endSelectPos.x-self.beginSelectPos.x, self.endSelectPos.y-self.beginSelectPos.y) context:SetColor(0,0,0,0) end Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted April 10, 2018 Share Posted April 10, 2018 In C++, after you render the world you can just draw to the context. World->Update() World->Render() Context->DrawRect() Context->Sync() Quote Link to comment Share on other sites More sharing options...
ErhanK Posted April 10, 2018 Author Share Posted April 10, 2018 Really? Ok thank you. I'll try Quote Link to comment Share on other sites More sharing options...
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.