//------------------------------------------------------------------------------ // KeyQueueManager.cpp // (C) 2005 Webzen Sunstudio //------------------------------------------------------------------------------ #include "SunClientPrecompiledHeader.h" #include "KeyQueueManager.h" #include "Input.h" //------------------------------------------------------------------------------ /** */ void KeyQueueManager::Init() { } //------------------------------------------------------------------------------ /** */ void KeyQueueManager::Reset() { m_defulatFunction=NULL; m_MsgArray.Clear(); m_key=0; } //------------------------------------------------------------------------------ /** */ void KeyQueueManager::Release() { Reset(); } //------------------------------------------------------------------------------ /** ƯÁ¤ ۰¡ ´­·ÈÀ»¶§ µî·ÏµÈ ¸Þ½ÃÁöµéÀ» ó¸® ÇÏ°í ¸Þ½ÃÁö°¡ ¾øÀ» °æ¿ì ±âº» ÇൿÀ» ÇÑ´Ù. */ void KeyQueueManager::Update() { if (m_key && (g_Input.GetState(m_key, KS_UP, TRUE) || g_Input.GetState(m_key, IKS_UP, TRUE))) { KeyQueueAction(); } } void KeyQueueManager::KeyQueueAction() { if (m_MsgArray.Empty() == false) { keyMsg& msg = m_MsgArray.Back(); msg.DoSomething(msg.wParam, msg.lParam); } else if (m_defulatFunction != NULL) { m_defulatFunction(0,0); } } //------------------------------------------------------------------------------ /** ¸Þ½ÃÁö¸¦ µî·Ï ÇÑ´Ù. */ BOOL KeyQueueManager::PushBack(keyMsg & msg) { // Àִ Ű¶ó¸é ³ÖÁö ¾Ê´Â´Ù. for( int i = 0; i < m_MsgArray.Size(); i++ ) { if( m_MsgArray[i].dwType == msg.dwType ) { return FALSE; } } m_MsgArray.PushBack(msg); return TRUE; } BOOL KeyQueueManager::PushFront(keyMsg & msg) { // Àִ Ű¶ó¸é ³ÖÁö ¾Ê´Â´Ù. for (int i = 0; i < m_MsgArray.Size(); ++i) { if (m_MsgArray[i].dwType == msg.dwType) { return FALSE; } } m_MsgArray.Insert(0, msg); return TRUE; } //------------------------------------------------------------------------------ /** ÇØ´ç ŸÀÔ°ú ¸ÅÄ¡ ÇÏ´Â ¸Þ½ÃÁö¸¦ Áö¿î´Ù.Ű ÀÔ·Â ¸»°í ƯÁ¤ Á¶°Ç¿¡ ÀÇÇØ ¸Þ½ÃÁö°¡ »èÁ¦ µÉ¶§ */ BOOL KeyQueueManager::DeleteMsg(DWORD dwType) { if( m_MsgArray.Empty() ) return FALSE; for(int i=0;i