void SlimItem::ScanPathSync() { DWORD dwAttributes; CAtlArray<CString> itemPaths; GetPaths(itemPaths); for (size_t i = 0; i < itemPaths.GetCount(); i++) { dwAttributes = ::GetFileAttributes(itemPaths[i]); if (INVALID_FILE_ATTRIBUTES == dwAttributes) continue; if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (!slimhelper::ScanDirectory(itemPaths[i], this)) break; } else { slimhelper::ScanFile(itemPaths[i], 0, INVALID_FILE_ATTRIBUTES, this); } } CheckEnable(); ::PostMessage(m_hNotifyWnd, SLIM_WM_ITEM_SCAN_END, 0, 0); }
void Window_Item::DrawItem(int index) { Rect rect = GetItemRect(index); contents->ClearRect(rect); int item_id = data[index]; if (item_id > 0) { int number = Main_Data::game_party->GetItemCount(item_id); bool enabled = CheckEnable(item_id); DrawItemName(&Data::items[item_id - 1], rect.x, rect.y, enabled); std::stringstream ss; ss << number; Font::SystemColor color = enabled ? Font::ColorDefault : Font::ColorDisabled; contents->TextDraw(rect.x + rect.width - 28, rect.y, color, "x"); contents->TextDraw(rect.x + rect.width - 6, rect.y, color, ss.str(), Text::AlignRight); } }
void Window_Skill::DrawItem(int index) { Rect rect = GetItemRect(index); contents->ClearRect(rect); int skill_id = data[index]; if (skill_id > 0) { int costs = Data::skills[skill_id - 1].sp_cost; bool enabled = CheckEnable(skill_id); int color = !enabled ? Font::ColorDisabled : Font::ColorDefault; std::stringstream ss; ss << costs; contents->TextDraw(rect.x + rect.width - 28, rect.y, color, "-"); contents->TextDraw(rect.x + rect.width - 6, rect.y, color, ss.str(), Text::AlignRight); DrawSkillName(&Data::skills[skill_id - 1], rect.x, rect.y, enabled); } }
int main () { char bar = '-'; ReloadXML = 1; int ActionId; pthread_t LightThread; pthread_t MusicThread; pthread_t CheckXMLModificationThread; GetXMLModificationDate(&LastXMLModificationDate); pthread_create (&CheckXMLModificationThread, NULL, CheckXMLModification, &bar); while(1) { sleep(1); if( ReloadXML ) { ReloadXML = 0; pthread_cancel (MusicThread); pthread_join (MusicThread, NULL); pthread_cancel (LightThread); pthread_join (LightThread, NULL); memset(TimedActions, 0, sizeof(TimedActions)); NoOfActions = ReadXML(); InvertedPWM = 0; PWMFrequency = 200; // Default 200 Hz for(ActionId=0; ActionId<NoOfActions; ActionId++) { if( !strcmp(TimedActions[ActionId].PWM_Inverted, "true") ) InvertedPWM = 1; if( atoi(TimedActions[ActionId].PWM_Frequency) != 0 ) PWMFrequency = atoi(TimedActions[ActionId].PWM_Frequency); } Init_PWM(); SetPWMValue(0); Audio_SetVolume(0); Audio_Stop(); /* PrintTimedAction(&TimedActions[0]); PrintTimedAction(&TimedActions[1]); PrintTimedAction(&TimedActions[2]); PrintTimedAction(&TimedActions[3]);*/ } CheckForcedAction(); ActionId = CheckEnable(); if( ActionId >= 0 ) { if( !strcmp(TimedActions[ActionId].Type, "TimedAction_PWM") ) pthread_create (&LightThread, NULL, DimmUp, &TimedActions[ActionId]); if( !strcmp(TimedActions[ActionId].Type, "TimedAction_Music") ) pthread_create (&MusicThread, NULL, Music, &TimedActions[ActionId]); } } return 0; }