Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
plugindrawcheckerboard.c
Go to the documentation of this file.
1// quick and dirty way for displaying of checker overlay on screen
2// - userd for camera settings primarily
3class PluginDrawCheckerboard extends PluginBase
4{
5 private ref Widget m_MainWindow;
6 private bool m_IsActive;
7
8
9 void PluginDrawCheckerboard()
10 {
11 CreateWidgetOverlay();
12 }
13
14 void ~PluginDrawCheckerboard() {}
15
16 void CreateWidgetOverlay()
17 {
18#ifndef NO_GUI
19 if (!m_MainWindow)
20 {
21 m_MainWindow = GetGame().GetWorkspace().CreateWidgets("gui/layouts/camera_checkerboard.layout");
22 m_MainWindow.Show(false);
23 int childId = 0;
24 int row = 0;
25 bool evenOrOdd;
26 int tilesPerLine = 8;
27
28 Widget child = m_MainWindow.GetChildren();
29 while(child)
30 {
31 evenOrOdd = IsEven(childId);
32
34 if(childId > (tilesPerLine * row) - 1)
35 {
36 row++;
37 }
38
39 if(IsEven(row))
40 {
41 evenOrOdd = !evenOrOdd;
42 }
43
45 if(evenOrOdd)
46 child.SetAlpha(0.15);
47 else
48 child.SetAlpha(0.05);
49
50 child = child.GetSibling();
51 childId++;
52 }
53 }
54#endif
55 }
56
57 bool IsActive()
58 {
59 return m_IsActive;
60 }
61
63 bool IsEven(int num)
64 {
65 if((num % 2) == 0)
66 return true;
67 else
68 return false;
69 }
70
71 void ShowWidgets(bool show)
72 {
73 if(m_MainWindow)
74 {
75 m_MainWindow.Show(show);
76 }
77 }
78
80 void Show()
81 {
82 ShowWidgets(true);
83 m_IsActive = true;
84 }
85
87 void Hide()
88 {
89 ShowWidgets(false);
90 m_IsActive = false;
91 }
92}
Plugin interface for controlling of agent pool system.
Definition pluginbase.c:2
void Hide()
Definition dayzgame.c:170
void Show()
Definition dayzgame.c:162
proto native CGame GetGame()
bool m_IsActive
bool IsActive()
void ShowWidgets(bool show)