Add the call to bcm_host_init/deinit() on raspberry pi.
This commit is contained in:
parent
0d2f584229
commit
6cf749c82c
2 changed files with 51 additions and 3 deletions
|
@ -28,6 +28,10 @@
|
|||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
#if defined(RASPBERRY_PI)
|
||||
#include <bcm_host.h>
|
||||
#endif
|
||||
|
||||
namespace cloonel {
|
||||
namespace {
|
||||
///----------------------------------------------------------------------
|
||||
|
@ -74,6 +78,9 @@ namespace cloonel {
|
|||
SizeRatio sizeratio;
|
||||
ObserversManager<SizeNotifiableBase*> resChangeNotifList;
|
||||
bool initialized;
|
||||
#if defined(RASPBERRY_PI)
|
||||
bool bcmInitialized;
|
||||
#endif
|
||||
};
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
|
@ -83,12 +90,19 @@ namespace cloonel {
|
|||
m_localData(new LocalData)
|
||||
{
|
||||
m_localData->sizeratio.SetOriginal(static_cast<float2>(parReferenceRes), static_cast<float2>(parRes));
|
||||
m_localData->initialized = false;
|
||||
#if defined(RASPBERRY_PI)
|
||||
m_localData->bcmInitialized = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
///------------------------------------------------------------------------
|
||||
SDLMain::~SDLMain() noexcept {
|
||||
ClearIFN(*m_localData);
|
||||
#if defined(RASPBERRY_PI)
|
||||
assert(not m_localData->bcmInitialized);
|
||||
#endif
|
||||
}
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
|
@ -109,6 +123,12 @@ namespace cloonel {
|
|||
throw std::runtime_error(SDL_GetError());
|
||||
parInitSDL.initialized = true;
|
||||
|
||||
#if defined(RASPBERRY_PI)
|
||||
assert(not parInitSDL.bcmInitialized);
|
||||
bcm_host_init();
|
||||
parInitSDL.bcmInitialized = true;
|
||||
#endif
|
||||
|
||||
#if defined(FORCE_OPENGLES)
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||
#endif
|
||||
|
@ -134,8 +154,16 @@ namespace cloonel {
|
|||
SDL_DestroyRenderer(parInitSDL.renderer);
|
||||
if (parInitSDL.window)
|
||||
SDL_DestroyWindow(parInitSDL.window);
|
||||
if (parInitSDL.initialized)
|
||||
if (parInitSDL.initialized) {
|
||||
parInitSDL.initialized = false;
|
||||
SDL_Quit();
|
||||
}
|
||||
#if defined(RASPBERRY_PI)
|
||||
if (parInitSDL.bcmInitialized) {
|
||||
parInitSDL.bcmInitialized = false;
|
||||
bcm_host_deinit();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue