# surface.DrawLine

- **Ortam:** İstemci, Menü
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/surface.DrawLine
- **Çeviri tarihi:** 2025-09-08

```lua
surface.DrawLine( number startX, number startY, number endX, number endY )
```

## Açıklama

Bir noktadan diğerine bir çizgi çizer.

> **NOT:** Bu, 2D çizim bağlamı gerektiren bir çizim fonksiyonudur.
>
> Bu, fonksiyonun yalnızca [2D Çizim Hookları](https://gmod.tr/wiki/2D_Rendering_Hooks) içinde çalışacağı anlamına gelir.

## Argümanlar

1. [number](https://gmod.tr/wiki/number) **startX**: Başlangıç x float koordinatı.
2. [number](https://gmod.tr/wiki/number) **startY**: Başlangıç y float koordinatı.
3. [number](https://gmod.tr/wiki/number) **endX**: Bitiş x float koordinatı.
4. [number](https://gmod.tr/wiki/number) **endY**: Bitiş y float koordinatı.

### Örnek

Bu örnek, ekranınızın ortasına piksel bazında mükemmel bir daire çizecektir.

```lua
hook.Add( "HUDPaint", "Circle", function()
	local center = Vector( ScrW() / 2, ScrH() / 2, 0 )
	local scale = Vector( 100, 100, 0 )
	local segmentdist = 360 / ( 2 * math.pi * math.max( scale.x, scale.y ) / 2 )
	surface.SetDrawColor( 255, 0, 0, 255 )

	for a = 0, 360 - segmentdist, segmentdist do
		surface.DrawLine( center.x + math.cos( math.rad( a ) ) * scale.x, center.y - math.sin( math.rad( a ) ) * scale.y, center.x + math.cos( math.rad( a + segmentdist ) ) * scale.x, center.y - math.sin( math.rad( a + segmentdist ) ) * scale.y )
	end
end )
```

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/surface.DrawLine
