11#include "../AddonBase.h"
12#include "../c-api/addon-instance/screensaver.h"
13#include "../gui/renderHelper.h"
199 if (CPrivateBase::m_interface->globalSingleInstance !=
nullptr)
200 throw std::logic_error(
"kodi::addon::CInstanceScreensaver: Creation of more as one in single "
201 "instance way is not allowed!");
203 SetAddonStruct(CPrivateBase::m_interface->firstKodiInstance);
204 CPrivateBase::m_interface->globalSingleInstance =
this;
251 if (CPrivateBase::m_interface->globalSingleInstance !=
nullptr)
252 throw std::logic_error(
"kodi::addon::CInstanceScreensaver: Creation of multiple together "
253 "with single instance way is not allowed!");
255 SetAddonStruct(instance);
272 virtual bool Start() {
return true; }
321 inline kodi::HardwareContext
Device() {
return m_props.device; }
330 inline int X() {
return m_props.x; }
339 inline int Y() {
return m_props.y; }
348 inline int Width() {
return m_props.width; }
357 inline int Height() {
return m_props.height; }
375 instance->hdl =
this;
376 instance->screensaver->toAddon->start = ADDON_start;
377 instance->screensaver->toAddon->stop = ADDON_stop;
378 instance->screensaver->toAddon->render = ADDON_render;
380 instance->screensaver->toKodi->get_properties(instance->info->kodi, &m_props);
383 inline static bool ADDON_start(
const KODI_ADDON_SCREENSAVER_HDL hdl)
385 CInstanceScreensaver* thisClass =
static_cast<CInstanceScreensaver*
>(hdl);
386 thisClass->m_renderHelper = kodi::gui::GetRenderHelper();
387 return thisClass->Start();
390 inline static void ADDON_stop(
const KODI_ADDON_SCREENSAVER_HDL hdl)
392 CInstanceScreensaver* thisClass =
static_cast<CInstanceScreensaver*
>(hdl);
394 thisClass->m_renderHelper =
nullptr;
397 inline static void ADDON_render(
const KODI_ADDON_SCREENSAVER_HDL hdl)
399 CInstanceScreensaver* thisClass =
static_cast<CInstanceScreensaver*
>(hdl);
401 if (!thisClass->m_renderHelper)
403 thisClass->m_renderHelper->Begin();
405 thisClass->m_renderHelper->End();
417 std::shared_ptr<kodi::gui::IRenderHelper> m_renderHelper;
Definition Screensaver.h:188
Definition AddonBase.h:565
Definition AddonBase.h:498
int Height()
Returns the height of the rendering window.
Definition Screensaver.h:357
kodi::HardwareContext Device()
Device that represents the display adapter.
Definition Screensaver.h:321
int X()
Returns the X position of the rendering window.
Definition Screensaver.h:330
int Width()
Returns the width of the rendering window.
Definition Screensaver.h:348
int Y()
Returns the Y position of the rendering window.
Definition Screensaver.h:339
float PixelRatio()
Pixel aspect ratio (often abbreviated PAR) is a ratio that describes how the width of a pixel compare...
Definition Screensaver.h:367
virtual void Render()
Used to indicate when the add-on should render.
Definition Screensaver.h:287
CInstanceScreensaver()
Screensaver class constructor.
Definition Screensaver.h:196
virtual bool Start()
Used to notify the screensaver that it has been started.
Definition Screensaver.h:272
~CInstanceScreensaver() override=default
Destructor.
CInstanceScreensaver(const IInstanceInfo &instance)
Screensaver class constructor used to support multiple instance types.
Definition Screensaver.h:249
virtual void Stop()
Used to inform the screensaver that the rendering control was stopped.
Definition Screensaver.h:280
Definition addon_base.h:268
Definition screensaver.h:22
Internal used structure to have stored C API data above and available for everything below.
Definition AddonBase.h:73