Is it possible to implement this function in GLBasic?.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuFUNCTION RotoZoomPolySprite: Sprite_ID,CenterX,CenterY,Angle,Zoom
LOCAL sx,sy // Dimensiones del Sprite
LOCAL p1x,p1y // Punto 1 rotado
LOCAL p2x,p2y // Punto 2 rotado
LOCAL p3x,p3y // Punto 3 rotado
LOCAL p4x,p4y // Punto 4 rotado
GETSPRITESIZE Sprite_ID,sx,sy
// Trasladamos centro de polígono a coordenadas 0,0 y rotamos
p1x=(-sx/2)*COS(Angle)-(-sy/2)*SIN(Angle)
p1y=(-sx/2)*SIN(Angle)+(-sy/2)*COS(Angle)
p2x=(-sx/2)*COS(Angle)-(sy/2)*SIN(Angle)
p2y=(-sx/2)*SIN(Angle)+(sy/2)*COS(Angle)
p3x=(sx/2)*COS(Angle)-(sy/2)*SIN(Angle)
p3y=(sx/2)*SIN(Angle)+(sy/2)*COS(Angle)
p4x=(sx/2)*COS(Angle)-(-sy/2)*SIN(Angle)
p4y=(sx/2)*SIN(Angle)+(-sy/2)*COS(Angle)
// Aplicamos Zoom
p1x=p1x*Zoom
p1y=p1y*Zoom
p2x=p2x*Zoom
p2y=p2y*Zoom
p3x=p3x*Zoom
p3y=p3y*Zoom
p4x=p4x*Zoom
p4y=p4y*Zoom
// Trasladamos centro de polígono a coordenadas dadas
p1x=p1x+CenterX
p1y=p1y+CenterY
p2x=p2x+CenterX
p2y=p2y+CenterY
p3x=p3x+CenterX
p3y=p3y+CenterY
p4x=p4x+CenterX
p4y=p4y+CenterY
// Dibujamos polígono
STARTPOLY Sprite_ID
POLYVECTOR p1x,p1y,0,0,RGB(255,255,255)
POLYVECTOR p2x,p2y,0,0+sy,RGB(255,255,255)
POLYVECTOR p3x,p3y,0+sx,0+sy,RGB(255,255,255)
POLYVECTOR p4x,p4y,0+sx,0,RGB(255,255,255)
ENDPOLY
ENDFUNCTION