render.SetScissorRect
Örnek
Bu fonksiyonun nasıl kullanılacağını gösterir. Bu, beyaz dörtgeni tam ekrandan sol üst köşede 512x512 boyutunda bir kutuya kırpacaktır.
render.SetScissorRect( 0, 0, 512, 512, true ) -- Dörtgeni etkinleştir
draw.RoundedBox( 4, 0, 0, ScrW(), ScrH(), color_white ) -- Tüm ekran üzerine beyaz bir dörtgen çiz
render.SetScissorRect( 0, 0, 0, 0, false ) -- İşiniz bittikten sonra devre dışı bırakın
Örnek
Sahte bir daire çizer ve bir ilerleme çubuğu gibi görünmesi için onu keser.
local function draw_circle( x, y, radius, color, percent )
percent = percent or 1
render.SetScissorRect( x - radius, y - radius + radius * 2 * ( 1 - percent ), x + radius, y + radius * 2, true )
draw.RoundedBox( radius, x - radius, y - radius, radius * 2, radius * 2, color or color_white )
render.SetScissorRect( 0, 0, 0, 0, false )
end
hook.Add( "HUDPaint", "GMod:Wiki", function()
local w, h = ScrW(), ScrH()
local radius = h * 0.1
-- Doldurulmuş daire
draw_circle( w / 2, h * 0.25, radius, Color( 255, 0, 0 ), 1 )
-- Doldurulmuş daire + çeyrek daire
draw_circle( w / 2, h / 2, radius, Color( 255, 0, 0 ), 1 )
draw_circle( w / 2, h / 2, radius, Color( 0, 255, 0 ), 0.25 )
-- Yarım daire
draw_circle( w / 2, h * 0.75, radius, Color( 0, 0, 255 ), 0.5 )
end )
Tüm sunucular · GmodTR Launcher · Rehber · GMod Wiki · GmodTR nedir? · Sunucu ekle · Discord