DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
RenderTarget.c
См. документацию.
1#ifdef GAME_TEMPLATE
2
3[EditorAttribute("box", "GameLib/Scripted", "Render target", "-0.25 -0.25 -0.25", "0.25 0.25 0.25", "255 0 0 255")]
4class RenderTargetClass
5{
6
7}
8
9RenderTargetClass RenderTargetSource;
10
11class RenderTarget: GenericEntity
12{
13 [Attribute("0", "slider", "Camera index", "0 31 1")]
14 int CameraIndex;
15 [Attribute("0", "editbox", "Position X <0, 1>")]
16 float X;
17 [Attribute("0", "editbox", "Position Y <0, 1>")]
18 float Y;
19 [Attribute("1", "editbox", "Render target width <0, 1>")]
20 float Width;
21 [Attribute("1", "editbox", "Render target height <0, 1>")]
22 float Height;
23 [Attribute("-1", "editbox", "Sort index (the lesser the more important)")]
24 int Sort;
25 [Attribute("0", "combobox", "Autoinit", "", { ParamEnum("No", "0"), ParamEnum("Yes", "1") } )]
26 int AutoInit;
27 [Attribute("0", "combobox", "Forcing creation of render target for camera #0 in Workbench", "", { ParamEnum("No", "0"), ParamEnum("Yes", "1") } )]
28 bool ForceCreation;
29 bool m_Show = true; // when autoinit, wait with showing the render target after all entities are created (EOnInit)
30 ref RenderTargetWidget m_RenderWidget;
31
32 void RenderTarget(IEntitySource src, IEntity parent)
33 {
34 SetFlags(EntityFlags.ACTIVE, false);
35
36 if (AutoInit)
37 {
38 m_Show = false;
39 SetEventMask(EntityEvent.INIT);
40 Init();
41 }
42 }
43
44 void ~RenderTarget()
45 {
46 delete m_RenderWidget;
47 }
48
49 void Init()
50 {
51 #ifdef WORKBENCH // Workbench is using its own renderer for main camera, it is not using render target widget.
52 if (!ForceCreation && CameraIndex == 0)
53 return;
54 #endif
55
56 int screenW, screenH;
57 GetScreenSize(screenW, screenH);
58
59 int posX = (float)(screenW * X);
60 int posY = (float)(screenH * Y);
61 int widthPix = (float)(screenW * Width);
62 int heightPix = (float)(screenH * Height);
63 if (Class.CastTo(m_RenderWidget, GetGame().GetWorkspace().CreateWidget(RenderTargetWidgetTypeID, posX, posY, widthPix, heightPix, WidgetFlags.VISIBLE | WidgetFlags.HEXACTSIZE | WidgetFlags.VEXACTSIZE | WidgetFlags.HEXACTPOS | WidgetFlags.VEXACTPOS, 0xffffffff, Sort)))
64 {
65 m_RenderWidget.Show(m_Show);
66 SetWidgetWorld(m_RenderWidget, GetGame().GetWorldEntity(), CameraIndex);
67 }
68 }
69 override void EOnInit(IEntity other, int extra)
70 {
71 if (m_RenderWidget)
72 {
73 m_Show = true;
74 m_RenderWidget.Show(m_Show);
75 }
76 }
77}
78
79#endif
override Widget Init()
Определения DayZGame.c:127
int[] IEntitySource
Определения EnEntity.c:2
override void EOnInit(IEntity other, int extra)
Определения TestFramework.c:235
proto native CGame GetGame()
proto native void SetFlags(ShapeFlags flags)
proto void Sort(void param_array[], int num)
Sorts static array of integers(ascendically) / floats(ascendically) / strings(alphabetically)
void ParamEnum(string key, string value, string desc="")
Определения EnEntity.c:809
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
EntityFlags
Entity flags.
Определения EnEntity.c:115
void EditorAttribute(string style, string category, string description, vector sizeMin, vector sizeMax, string color, string color2="0 0 0 0", bool visible=true, bool insertable=true, bool dynamicBox=false)
Определения EnEntity.c:854
@ Y
Определения EnSystem.c:316
@ X
Определения EnSystem.c:315
proto void GetScreenSize(out int x, out int y)
proto native void SetWidgetWorld(RenderTargetWidget w, IEntity wrldEntity, int camera)
WidgetFlags
Определения EnWidgets.c:58