ErhanK Posted April 10, 2018 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
SpiderPig Posted April 10, 2018 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
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.