kodi
GUIGameControl.h
1 /*
2  * Copyright (C) 2017-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "guilib/GUIControl.h"
13 
14 #include <memory>
15 
16 namespace KODI
17 {
18 namespace RETRO
19 {
20 class CGUIRenderSettings;
21 class CGUIRenderHandle;
22 class IGUIRenderSettings;
23 
24 // Label to use when disabling rendering via the <pixels> property. A path
25 // to pixel data is expected, but instead this constant can be provided to
26 // skip a file existence check in the renderer.
27 constexpr const char* NO_PIXEL_DATA = "-";
28 
30 {
31 public:
32  CGUIGameControl(int parentID, int controlID, float posX, float posY, float width, float height);
33  CGUIGameControl(const CGUIGameControl& other);
34  ~CGUIGameControl() override;
35 
36  // GUI functions
37  void SetVideoFilter(const KODI::GUILIB::GUIINFO::CGUIInfoLabel& videoFilter);
38  void SetStretchMode(const KODI::GUILIB::GUIINFO::CGUIInfoLabel& stretchMode);
39  void SetRotation(const KODI::GUILIB::GUIINFO::CGUIInfoLabel& rotation);
40  void SetPixels(const KODI::GUILIB::GUIINFO::CGUIInfoLabel& pixels);
41 
42  // Rendering functions
43  bool HasVideoFilter() const { return m_bHasVideoFilter; }
44  bool HasStretchMode() const { return m_bHasStretchMode; }
45  bool HasRotation() const { return m_bHasRotation; }
46  bool HasPixels() const { return m_bHasPixels; }
47  IGUIRenderSettings* GetRenderSettings() const;
48 
49  // implementation of CGUIControl
50  CGUIGameControl* Clone() const override { return new CGUIGameControl(*this); }
51  void Process(unsigned int currentTime, CDirtyRegionList& dirtyregions) override;
52  void Render() override;
53  void RenderEx() override;
54  bool CanFocus() const override;
55  void SetPosition(float posX, float posY) override;
56  void SetWidth(float width) override;
57  void SetHeight(float height) override;
58  void UpdateInfo(const CGUIListItem* item = nullptr) override;
59 
60 private:
61  void Reset();
62 
63  void RegisterControl();
64  void UnregisterControl();
65 
66  // GUI properties
67  KODI::GUILIB::GUIINFO::CGUIInfoLabel m_videoFilterInfo;
68  KODI::GUILIB::GUIINFO::CGUIInfoLabel m_stretchModeInfo;
71 
72  // Rendering properties
73  bool m_bHasVideoFilter = false;
74  bool m_bHasStretchMode = false;
75  bool m_bHasRotation = false;
76  bool m_bHasPixels = false;
77  std::unique_ptr<CGUIRenderSettings> m_renderSettings;
78  std::shared_ptr<CGUIRenderHandle> m_renderHandle;
79 };
80 
81 } // namespace RETRO
82 } // namespace KODI
Interface to pass render settings from the GUI to the renderer.
Definition: IGUIRenderSettings.h:21
Definition: GUIListItem.h:29
Definition: GUIInfoLabel.h:31
Definition: GUIGameControl.h:29
Base class for controls.
Definition: GUIControl.h:83
Definition: AudioDecoder.h:18
void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override
Definition: GUIGameControl.cpp:87