Jump to content

post render rotate


havenphillip
 Share

Recommended Posts

Nope. I got the square moving all over the screen but it won't turn. Here's my script:

Script.pos = Vec2(242,234) -- Vec2 "Position"
Script.offset = Vec2(4,3) -- Vec2 "Offset"
Script.csize = Vec2(200,200) -- Vec2  "Size"
Script.square = Texture:Load("Materials/Developer/bluegrid.tex")

function Script:PostRender(context)
    Time:Update()
        
    local a = Time:GetCurrent()*0.1
   
    local x = self.pos.x
    local y = self.pos.y
    local w = self.csize.x
    local h = self.csize.y
        
    local scale = 1
    
    --context:SetRotation(a)
    context:SetScale(scale,scale)   
        
    context:SetBlendMode(Blend.Alpha)
    context:SetColor(1,1,1)
    context:DrawText(text,x,y)
    context:DrawImage(self.square, x-(Math:Cos(a)*(w) - Math:Sin(a)*(h)), y+(-Math:Sin(a)*(w) - Math:Cos(a)*(h)) , self.csize.x, self.csize.y)
    context:SetBlendMode(Blend.Solid)
end

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...