Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
canvas.c
Go to the documentation of this file.
1
13
14
typedef
bool
PIXEL
;
15
class
Canvas
16
{
17
int
m_SizeX
;
int
m_SizeY
;
18
19
ref
array<ref array<PIXEL>
>
m_Pixels
=
new
array<ref array<PIXEL>
>;
20
21
void
Canvas
(
int
size_x,
int
size_y)
22
{
23
m_SizeX
= size_x;
24
m_SizeY
= size_y;
25
for
(
int
i = 0; i < size_y; i++)
26
{
27
array<PIXEL>
x_line =
new
array<PIXEL>
;
28
for
(
int
z = 0; z < size_x;z++)
29
{
30
x_line.Insert(
false
);
31
}
32
m_Pixels
.Insert(x_line);
33
34
}
35
}
36
37
void
DrawPixel
(
int
x
,
int
y
)
38
{
39
if
((
x
>
m_SizeX
- 1) || (
y
>
m_SizeY
- 1))
40
return
;
41
//Print("x:" +x+",y:"+y);
42
m_Pixels
.Get(
y
).InsertAt(
true
,
x
);
43
}
44
45
void
PrintOut
()
46
{
47
string
line =
""
;
48
int
y_lines =
m_SizeY
- 1;
49
for
(
int
i = y_lines; i >= 0; i--)
50
{
51
line =
""
;
52
for
(
int
z = 0; z <
m_SizeX
;z++)
53
{
54
if
(
m_Pixels
.Get(i).Get(z))
55
{
56
line +=
"X"
;
57
}
58
else
59
{
60
line +=
" "
;
61
}
62
}
63
Print
(line);
64
}
65
}
66
67
void
SaveToFile
(
string
filename)
68
{
69
FileHandle
file =
OpenFile
(
"$profile:"
+filename,
FileMode
.WRITE);
70
71
string
line =
""
;
72
int
y_lines =
m_SizeY
- 1;
73
for
(
int
i = y_lines; i >= 0; i--)
74
{
75
line =
""
;
76
for
(
int
z = 0; z <
m_SizeX
;z++)
77
{
78
if
(
m_Pixels
.Get(i).Get(z))
79
{
80
line +=
"X"
;
81
}
82
else
83
{
84
line +=
" "
;
85
}
86
}
87
FPrintln
(file, line);
88
}
89
}
90
}
PIXEL
bool PIXEL
Simple debug painting canvas with 0/1 pixel representation.
Definition
canvas.c:14
Canvas::PrintOut
void PrintOut()
Definition
canvas.c:45
Canvas::m_SizeY
int m_SizeY
Definition
canvas.c:17
Canvas::DrawPixel
void DrawPixel(int x, int y)
Definition
canvas.c:37
Canvas::m_Pixels
ref array< ref array< PIXEL > > m_Pixels
Definition
canvas.c:19
Canvas::Canvas
void Canvas(int size_x, int size_y)
Definition
canvas.c:21
Canvas::SaveToFile
void SaveToFile(string filename)
Definition
canvas.c:67
Canvas::m_SizeX
int m_SizeX
Definition
canvas.c:17
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
Print
proto void Print(void var)
Prints content of variable to console/log.
FileMode
FileMode
Definition
ensystem.c:383
OpenFile
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
FileHandle
int[] FileHandle
Definition
ensystem.c:390
FPrintln
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.
x
Icon x
y
Icon y
Games
Dayz
scripts
3_game
canvas.c
Generated by
1.17.0