Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CursorCustom.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
4 {
5  const int REAL_CURSOR_HIDE = 12; // "empty" visual ID of real cursor used to "hide" it
6  const string layoutPath = "{80F7ED5410342195}UI/layouts/Map/CursorCustom.layout";
7 
8  protected bool m_bIsVisible;
9  protected Widget m_wRoot;
10  protected Widget m_wCursor;
11  protected ImageWidget m_wCursorImage;
12 
13  //------------------------------------------------------------------------------------------------
16  void SetCursorVisual(SCR_CursorVisualState stateCfg)
17  {
18  if (!stateCfg)
19  {
20  WidgetManager.SetCursor(0);
21  m_bIsVisible = false;
22  m_wRoot.SetVisible(false);
23  return;
24  }
25  else if (!m_bIsVisible)
26  {
27  WidgetManager.SetCursor(REAL_CURSOR_HIDE);
28  m_bIsVisible = true;
29  m_wRoot.SetVisible(true);
30  }
31 
32  if (SCR_MapCursorInfo.isGamepad && !stateCfg.m_sImageQuadController.IsEmpty())
33  m_wCursorImage.LoadImageFromSet(0, stateCfg.m_sCursorIconsImageset, stateCfg.m_sImageQuadController);
34  else
35  m_wCursorImage.LoadImageFromSet(0, stateCfg.m_sCursorIconsImageset, stateCfg.m_sImageQuad);
36 
37  AlignableSlot.SetPadding(m_wCursorImage, stateCfg.m_fPaddingLeft, stateCfg.m_fPaddingTop, 0, 0);
38 
39  m_wCursorImage.SetColor(stateCfg.m_Color);
40  }
41 
42  //------------------------------------------------------------------------------------------------
44  void SetOpacity(float opacity)
45  {
46  m_wCursorImage.SetOpacity(opacity);
47  }
48 
49  //------------------------------------------------------------------------------------------------
51  void Update(float x, float y)
52  {
53  FrameSlot.SetPos(m_wCursor, x, y);
54  }
55 
56  //------------------------------------------------------------------------------------------------
57  void SCR_CursorCustom()
58  {
59  m_wRoot = GetGame().GetWorkspace().CreateWidgets(layoutPath);
60  m_wCursor = m_wRoot.FindAnyWidget("CursorWidget");
61  m_wCursorImage = ImageWidget.Cast(m_wRoot.FindAnyWidget("CursorImage"));
62  }
63 
64  //------------------------------------------------------------------------------------------------
65  void ~SCR_CursorCustom()
66  {
67  m_wCursorImage.RemoveFromHierarchy();
68  m_wRoot.RemoveFromHierarchy();
69  }
70 
71 };
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_CursorVisualState
Cursor visual state config.
Definition: SCR_MapCursorModule.c:1308
SCR_CursorCustom
Scripted map cursor visualization for cases where the gamecode provided one is not sufficient.
Definition: SCR_CursorCustom.c:3
m_bIsVisible
protected bool m_bIsVisible
Definition: SCR_MapRTWBaseUI.c:29
SCR_MapCursorInfo
Cursor data.
Definition: SCR_MapCursorModule.c:3