====== PC_UnlockOverlay import ====== Plugin can use this function together with [[plugin_sdk:imports:pc_lockoverlay|PC_LockOverlay]] to draw overlay in [[plugin_sdk:exports:pluginupdateoverlay|PluginUpdateOverlay]] callback. Function unlocks previously locked system buffer and, if required, gives command to update overlay texture (asynchronously in game renderer). ==== Syntax ==== <code> PLUGIN_IMPORT void PC_UnlockOverlay( [in] DWORD dwPluginID, [in] BOOL bMarkUpdated ); </code> ==== Parameters ==== dwPluginID [in]\\ Unique plugin ID, see more here: [[plugin_sdk:exports:plugininit|PluginInit]]. bMarkUpdated [in]\\ Passing TRUE tells PlayClaw to update overlay image with unlocked buffer. If you don't want to update overlay, then set this parameter to FALSE. ==== Sample code ==== <code> // global variable to store plugin id DWORD m_dwPluginID = -1; PLUGIN_EXPORT void PluginUpdateOverlay() { // lock overlay image OverlayLockStruct pLock; if (!PC_LockOverlay(m_dwPluginID, &pLock)) // lock overlay buffer and get its size return; // copy rgb24 to rgba32, pImageFrame - pointer to rgb24 buffer for (DWORD y = 0; y < pLock.dwHeight; y++) { BYTE *pSrc = pImageFrame + y * pLock.dwWidth * 3; BYTE *pDst = pLock.pBuffer + y * pLock.dwPitch; for (DWORD x = 0; x < pLock.dwWidth; x++) { *pDst++ = *pSrc++; *pDst++ = *pSrc++; *pDst++ = *pSrc++; *pDst++ = 0xff; // alpha } } // fill overlay image PC_UnlockOverlay(m_dwPluginID, true); } </code> ==== See also ==== [[plugin_sdk:imports:pc_lockoverlay|PC_LockOverlay]]\\ [[plugin_sdk:imports:start|PlayClaw plugin imports]]\\