surface.DrawTexturedRectRotated

  surface.DrawTexturedRectRotated( number x, number y, number width, number height, number rotation )

Açıklama

Mevcut aktif dokuyu kullanarak, ekranda verilen konum, boyutlar ve açı ile dokulu, döndürülmüş bir dikdörtgen çizer.

Ayrıca bakınız: surface.DrawTexturedRectUV ve surface.DrawTexturedRect.

Bu, 2 boyutlu bir çizim bağlamı gerektiren bir çizim fonksiyonudur.

Bu, yalnızca 2 Boyutlu Çizim Kancaları (2d Rendering Hooks) içinde çalışacağı anlamına gelir.

Argümanlar

1 number x
Dikdörtgenin merkezini temsil eden X tam sayı koordinatı.
2 number y
Dikdörtgenin merkezini temsil eden Y tam sayı koordinatı.
3 number width
Dikdörtgenin tam sayı genişliği.
4 number height
Dikdörtgenin tam sayı yüksekliği.
5 number rotation
Dikdörtgenin derece cinsinden dönüşü.

Örnek

Dönüş başlangıç noktasını geçersiz kılmanıza olanak tanıyan bir fonksiyon.

x0 ve y0, dikdörtgenin merkezine görelidir.

function surface.DrawTexturedRectRotatedPoint( x, y, w, h, rot, x0, y0 ) local c = math.cos( math.rad( rot ) ) local s = math.sin( math.rad( rot ) ) local newx = y0 * s - x0 * c local newy = y0 * c + x0 * s surface.DrawTexturedRectRotated( x + newx, y + newy, w, h, rot ) end

Örnek

Sürekli dönen basit bir kırmızı kutu çizer.

function draw.RotatedBox( x, y, w, h, ang, color ) draw.NoTexture() surface.SetDrawColor( color or color_white ) surface.DrawTexturedRectRotated( x, y, w, h, ang ) end hook.Add( "HUDPaint", "my_rotated_box", function() draw.RotatedBox( 100, 100, 100, 100, CurTime() % 360, Color( 255, 0, 0) ) end )

Tüm sunucular · GmodTR Launcher · Rehber · GMod Wiki · GmodTR nedir? · Sunucu ekle · Discord