diff options
| author | manuel <manuel@mausz.at> | 2020-07-02 23:09:26 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-07-02 23:09:26 +0200 |
| commit | 5f8335c1e49ce108ef3481863833c98efa00411b (patch) | |
| tree | f02b5c1c9765bb6a14c8eb42bb4f81b9face0b55 /xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h | |
| parent | e317daf081a1048904fdf0b548946fa3ba6593a7 (diff) | |
| download | kodi-pvr-build-5f8335c1e49ce108ef3481863833c98efa00411b.tar.gz kodi-pvr-build-5f8335c1e49ce108ef3481863833c98efa00411b.tar.bz2 kodi-pvr-build-5f8335c1e49ce108ef3481863833c98efa00411b.zip | |
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h index c4f8005..f8a7380 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #pragma once | 9 | #pragma once |
| 10 | 10 | ||
| 11 | #include "../AddonBase.h" | 11 | #include "../AddonBase.h" |
| 12 | #include "../gui/renderHelper.h" | ||
| 12 | 13 | ||
| 13 | namespace kodi { namespace addon { class CInstanceScreensaver; }} | 14 | namespace kodi { namespace addon { class CInstanceScreensaver; }} |
| 14 | 15 | ||
| @@ -218,7 +219,7 @@ namespace addon | |||
| 218 | /// Kodi's header. Manually deleting the add-on instance is not required. | 219 | /// Kodi's header. Manually deleting the add-on instance is not required. |
| 219 | /// | 220 | /// |
| 220 | //---------------------------------------------------------------------------- | 221 | //---------------------------------------------------------------------------- |
| 221 | class CInstanceScreensaver : public IAddonInstance | 222 | class ATTRIBUTE_HIDDEN CInstanceScreensaver : public IAddonInstance |
| 222 | { | 223 | { |
| 223 | public: | 224 | public: |
| 224 | //========================================================================== | 225 | //========================================================================== |
| @@ -229,7 +230,7 @@ namespace addon | |||
| 229 | /// Used by an add-on that only supports screensavers. | 230 | /// Used by an add-on that only supports screensavers. |
| 230 | /// | 231 | /// |
| 231 | CInstanceScreensaver() | 232 | CInstanceScreensaver() |
| 232 | : IAddonInstance(ADDON_INSTANCE_SCREENSAVER) | 233 | : IAddonInstance(ADDON_INSTANCE_SCREENSAVER, GetKodiTypeVersion(ADDON_INSTANCE_SCREENSAVER)) |
| 233 | { | 234 | { |
| 234 | if (CAddonBase::m_interface->globalSingleInstance != nullptr) | 235 | if (CAddonBase::m_interface->globalSingleInstance != nullptr) |
| 235 | throw std::logic_error("kodi::addon::CInstanceScreensaver: Creation of more as one in single instance way is not allowed!"); | 236 | throw std::logic_error("kodi::addon::CInstanceScreensaver: Creation of more as one in single instance way is not allowed!"); |
| @@ -247,11 +248,16 @@ namespace addon | |||
| 247 | /// | 248 | /// |
| 248 | /// @param[in] instance The instance value given to | 249 | /// @param[in] instance The instance value given to |
| 249 | /// <b>`kodi::addon::CAddonBase::CreateInstance(...)`</b>. | 250 | /// <b>`kodi::addon::CAddonBase::CreateInstance(...)`</b>. |
| 251 | /// @param[in] kodiVersion [opt] Version used in Kodi for this instance, to | ||
| 252 | /// allow compatibility to older Kodi versions. | ||
| 253 | /// @note Recommended to set. | ||
| 250 | /// | 254 | /// |
| 251 | /// @warning Only use `instance` from the CreateInstance call | 255 | /// @warning Only use `instance` from the CreateInstance call |
| 252 | /// | 256 | /// |
| 253 | explicit CInstanceScreensaver(KODI_HANDLE instance) | 257 | explicit CInstanceScreensaver(KODI_HANDLE instance, const std::string& kodiVersion = "") |
| 254 | : IAddonInstance(ADDON_INSTANCE_SCREENSAVER) | 258 | : IAddonInstance(ADDON_INSTANCE_SCREENSAVER, |
| 259 | !kodiVersion.empty() ? kodiVersion | ||
| 260 | : GetKodiTypeVersion(ADDON_INSTANCE_SCREENSAVER)) | ||
| 255 | { | 261 | { |
| 256 | if (CAddonBase::m_interface->globalSingleInstance != nullptr) | 262 | if (CAddonBase::m_interface->globalSingleInstance != nullptr) |
| 257 | throw std::logic_error("kodi::addon::CInstanceScreensaver: Creation of multiple together with single instance way is not allowed!"); | 263 | throw std::logic_error("kodi::addon::CInstanceScreensaver: Creation of multiple together with single instance way is not allowed!"); |
| @@ -418,19 +424,35 @@ namespace addon | |||
| 418 | 424 | ||
| 419 | inline static bool ADDON_Start(AddonInstance_Screensaver* instance) | 425 | inline static bool ADDON_Start(AddonInstance_Screensaver* instance) |
| 420 | { | 426 | { |
| 427 | instance->toAddon.addonInstance->m_renderHelper = kodi::gui::GetRenderHelper(); | ||
| 421 | return instance->toAddon.addonInstance->Start(); | 428 | return instance->toAddon.addonInstance->Start(); |
| 422 | } | 429 | } |
| 423 | 430 | ||
| 424 | inline static void ADDON_Stop(AddonInstance_Screensaver* instance) | 431 | inline static void ADDON_Stop(AddonInstance_Screensaver* instance) |
| 425 | { | 432 | { |
| 426 | instance->toAddon.addonInstance->Stop(); | 433 | instance->toAddon.addonInstance->Stop(); |
| 434 | instance->toAddon.addonInstance->m_renderHelper = nullptr; | ||
| 427 | } | 435 | } |
| 428 | 436 | ||
| 429 | inline static void ADDON_Render(AddonInstance_Screensaver* instance) | 437 | inline static void ADDON_Render(AddonInstance_Screensaver* instance) |
| 430 | { | 438 | { |
| 439 | if (!instance->toAddon.addonInstance->m_renderHelper) | ||
| 440 | return; | ||
| 441 | instance->toAddon.addonInstance->m_renderHelper->Begin(); | ||
| 431 | instance->toAddon.addonInstance->Render(); | 442 | instance->toAddon.addonInstance->Render(); |
| 443 | instance->toAddon.addonInstance->m_renderHelper->End(); | ||
| 432 | } | 444 | } |
| 433 | 445 | ||
| 446 | /* | ||
| 447 | * Background render helper holds here and in addon base. | ||
| 448 | * In addon base also to have for the others, and stored here for the worst | ||
| 449 | * case where this class is independent from base and base becomes closed | ||
| 450 | * before. | ||
| 451 | * | ||
| 452 | * This is on Kodi with GL unused and the calls to there are empty (no work) | ||
| 453 | * On Kodi with Direct X where angle is present becomes this used. | ||
| 454 | */ | ||
| 455 | std::shared_ptr<kodi::gui::IRenderHelper> m_renderHelper; | ||
| 434 | AddonInstance_Screensaver* m_instanceData; | 456 | AddonInstance_Screensaver* m_instanceData; |
| 435 | }; | 457 | }; |
| 436 | 458 | ||
