-
Notifications
You must be signed in to change notification settings - Fork 4
/
textdraw.go
104 lines (82 loc) · 2.52 KB
/
textdraw.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package sampgo
import "fmt"
const (
FontSanAndreas = iota
FontClear
FontCapitalClear
FontGTA
FontSprite
)
type PlayerTextDraw struct {
player *Player
textDraw int
align int
}
func (p *Player) NewPlayerTextDraw(x, y float32, text string) (PlayerTextDraw, error) {
td := PlayerTextDraw{player: p, textDraw: CreatePlayerTextDraw(p.ID, x, y, text)}
if td.textDraw == InvalidTextDraw {
return td, fmt.Errorf("invalid playertextdraw")
}
return td, nil
}
func (p *PlayerTextDraw) Destroy() {
PlayerTextDrawDestroy(p.player.ID, p.textDraw)
}
func (p *PlayerTextDraw) SetString(text string) {
PlayerTextDrawSetString(p.player.ID, p.textDraw, text)
}
func (p *PlayerTextDraw) Show() {
PlayerTextDrawShow(p.player.ID, p.textDraw)
}
func (p *PlayerTextDraw) Hide() {
PlayerTextDrawHide(p.player.ID, p.textDraw)
}
func (p *PlayerTextDraw) Font(font int) {
PlayerTextDrawFont(p.player.ID, p.textDraw, font)
}
func (p *PlayerTextDraw) UseBox(use bool) {
PlayerTextDrawUseBox(p.player.ID, p.textDraw, use)
}
func (p *PlayerTextDraw) SetAlignment(align int) {
p.align = align
PlayerTextDrawAlignment(p.player.ID, p.textDraw, p.align)
}
func (p *PlayerTextDraw) SetTextSize(x, y float32) {
if p.align == 2 {
x, y = y, x
}
PlayerTextDrawTextSize(p.player.ID, p.textDraw, x, y)
}
func (p *PlayerTextDraw) SetColor(color int) {
PlayerTextDrawColor(p.player.ID, p.textDraw, color)
}
var SetColour = (*PlayerTextDraw).SetColor
func (p *PlayerTextDraw) SetBoxColor(color int) {
PlayerTextDrawBoxColor(p.player.ID, p.textDraw, color)
}
var SetBoxColour = (*PlayerTextDraw).SetBoxColor
func (p *PlayerTextDraw) SetBackgroundColor(color int) {
PlayerTextDrawBackgroundColor(p.player.ID, p.textDraw, color)
}
var SetBackgroundColour = (*PlayerTextDraw).SetBackgroundColor
func (p *PlayerTextDraw) SetSelectable(selectable bool) {
PlayerTextDrawSetSelectable(p.player.ID, p.textDraw, selectable)
}
func (p *PlayerTextDraw) SetPreviewModel(modelindex int) error {
if !PlayerTextDrawSetPreviewModel(p.player.ID, p.textDraw, modelindex) {
return fmt.Errorf("invalid player or textdraw")
}
return nil
}
func (p *PlayerTextDraw) SetPreviewRot(rotX, rotY, rotZ, zoom float32) error {
if !PlayerTextDrawSetPreviewRot(p.player.ID, p.textDraw, rotX, rotY, rotZ, zoom) {
return fmt.Errorf("invalid player or textdraw")
}
return nil
}
func (p *PlayerTextDraw) SetPreviewVehCol(color1, color2 int) error {
if !PlayerTextDrawSetPreviewVehCol(p.player.ID, p.textDraw, color1, color2) {
return fmt.Errorf("invalid player or textdraw")
}
return nil
}