DayZ 1.24
Loading...
Searching...
No Matches
Canvas Class Reference
Collaboration diagram for Canvas:
[legend]

Private Member Functions

void Canvas (int size_x, int size_y)
 
void DrawPixel (int x, int y)
 
void PrintOut ()
 
void SaveToFile (string filename)
 

Private Attributes

int m_SizeX
 
int m_SizeY
 
ref array< ref array< PIXEL > > m_Pixels = new array<ref array<PIXEL>>
 

Detailed Description

Definition at line 15 of file Canvas.c.

Constructor & Destructor Documentation

◆ Canvas()

void Canvas::Canvas ( int size_x,
int size_y )
inlineprivate

Definition at line 21 of file Canvas.c.

22 {
25 for (int i = 0; i < size_y; i++)
26 {
28 for (int z = 0; z < size_x; z++)
29 x_line.Insert(false);
30 m_Pixels.Insert(x_line);
31
32 }
33 }
ref array< ref array< PIXEL > > m_Pixels
Definition Canvas.c:19
int m_SizeY
Definition Canvas.c:17
int m_SizeX
Definition Canvas.c:17

References m_Pixels, m_SizeX, and m_SizeY.

Member Function Documentation

◆ DrawPixel()

void Canvas::DrawPixel ( int x,
int y )
inlineprivate

Definition at line 35 of file Canvas.c.

36 {
37 if ((x > m_SizeX - 1) || (y > m_SizeY - 1))
38 return;
39 //Print("x:" +x+",y:"+y);
40 m_Pixels.Get(y).InsertAt(true, x);
41 }
Icon x
Icon y

References m_Pixels, m_SizeX, m_SizeY, x, and y.

◆ PrintOut()

void Canvas::PrintOut ( )
inlineprivate

Definition at line 43 of file Canvas.c.

44 {
45 string line = "";
46 int y_lines = m_SizeY - 1;
47 for (int i = y_lines; i >= 0; i--)
48 {
49 line = "";
50 for (int z = 0; z < m_SizeX; z++)
51 {
52 if (m_Pixels.Get(i).Get(z))
53 line += "X";
54 else
55 line += " ";
56 }
57 Print(line);
58 }
59 }
proto void Print(void var)
Prints content of variable to console/log.

References m_Pixels, m_SizeX, m_SizeY, and Print().

◆ SaveToFile()

void Canvas::SaveToFile ( string filename)
inlineprivate

Definition at line 61 of file Canvas.c.

62 {
63 FileHandle file = OpenFile("$profile:" + filename, FileMode.WRITE);
64
65 string line = "";
66 int y_lines = m_SizeY - 1;
67 for (int i = y_lines; i >= 0; i--)
68 {
69 line = "";
70 for (int z = 0; z < m_SizeX; z++)
71 {
72 if (m_Pixels.Get(i).Get(z))
73 line += "X";
74 else
75 line += " ";
76 }
78 }
79 }
FileMode
Definition EnSystem.c:383
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.

References FPrintln(), m_Pixels, m_SizeX, m_SizeY, and OpenFile().

Member Data Documentation

◆ m_Pixels

ref array<ref array<PIXEL> > Canvas::m_Pixels = new array<ref array<PIXEL>>
private

Definition at line 19 of file Canvas.c.

Referenced by Canvas(), DrawPixel(), PrintOut(), and SaveToFile().

◆ m_SizeX

int Canvas::m_SizeX
private

Definition at line 17 of file Canvas.c.

Referenced by Canvas(), DrawPixel(), PrintOut(), and SaveToFile().

◆ m_SizeY

int Canvas::m_SizeY
private

Definition at line 17 of file Canvas.c.

Referenced by Canvas(), DrawPixel(), PrintOut(), and SaveToFile().


The documentation for this class was generated from the following file: