Skip to content

Commit

Permalink
misc: add DestroyVirtualDMD method
Browse files Browse the repository at this point in the history
  • Loading branch information
jsm174 committed Feb 3, 2024
1 parent 63b9236 commit 66c4c5a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void test()
if (pRGB24Data) {
// Render pRGB24Data
}
pDmd->DestroyVirtualDMD(pVirtualDMD);
}
```

Expand Down
1 change: 1 addition & 0 deletions include/DMDUtil/DMD.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class DMDUTILAPI DMD
int GetHeight() const { return m_height; }
int GetLength() const { return m_length; }
VirtualDMD* CreateVirtualDMD();
bool DestroyVirtualDMD(VirtualDMD* pVirtualDMD);
void UpdateData(const uint8_t* pData, int depth, uint8_t r, uint8_t g, uint8_t b);
void UpdateRGB24Data(const uint8_t* pData, int depth, uint8_t r, uint8_t g, uint8_t b);
void UpdateAlphaNumericData(AlphaNumericLayout layout, const uint16_t* pData1, const uint16_t* pData2, uint8_t r,
Expand Down
13 changes: 13 additions & 0 deletions src/DMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ VirtualDMD* DMD::CreateVirtualDMD()
return pVirtualDMD;
}

bool DMD::DestroyVirtualDMD(VirtualDMD* pVirtualDMD)
{
auto it = std::find(m_virtualDMDs.begin(), m_virtualDMDs.end(), pVirtualDMD);
if (it != m_virtualDMDs.end())
{
m_virtualDMDs.erase(it);
delete pVirtualDMD;

return true;
}
return false;
}

void DMD::UpdateData(const uint8_t* pData, int depth, uint8_t r, uint8_t g, uint8_t b)
{
DMDUpdate* const pUpdate = new DMDUpdate();
Expand Down

0 comments on commit 66c4c5a

Please sign in to comment.