示例#1
0
bool __fastcall writeYesNo(
	unsigned char *title,
	unsigned char *message[],
	unsigned char lineCount)
{
	enum results result =
		drawDialog(message, lineCount, title, YES | NO);

	return result == YES_RESULT;
}
示例#2
0
文件: about.cpp 项目: klusark/twin
void AboutDialog::handleTickle() {
	const uint32 t = g_system->getMillis();
	int scrollOffset = ((int)t - (int)_scrollTime) / kScrollMillisPerPixel;
	if (scrollOffset > 0) {
		int modifiers = g_system->getEventManager()->getModifierState();

		// Scroll faster when shift is pressed
		if (modifiers & Common::KBD_SHIFT)
			scrollOffset *= 4;
		// Reverse scrolling when alt is pressed
		if (modifiers & Common::KBD_ALT)
			scrollOffset *= -1;
		_scrollPos += scrollOffset;
		_scrollTime = t;

		if (_scrollPos < 0) {
			_scrollPos = 0;
		} else if ((uint32)_scrollPos > _lines.size() * _lineHeight) {
			_scrollPos = 0;
			_scrollTime += kScrollStartDelay;
		}
		drawDialog();
	}
}
示例#3
0
void MassAddDialog::handleTickle() {
	if (_scanStack.empty())
		return;	// We have finished scanning

	uint32 t = g_system->getMillis();

	// Perform a breadth-first scan of the filesystem.
	while (!_scanStack.empty() && (g_system->getMillis() - t) < kMaxScanTime) {
		Common::FSNode dir = _scanStack.pop();

		Common::FSList files;
		if (!dir.getChildren(files, Common::FSNode::kListAll)) {
			continue;
		}

		// Run the detector on the dir
		GameList candidates(EngineMan.detectGames(files));

		// Just add all detected games / game variants. If we get more than one,
		// that either means the directory contains multiple games, or the detector
		// could not fully determine which game variant it was seeing. In either
		// case, let the user choose which entries he wants to keep.
		//
		// However, we only add games which are not already in the config file.
		for (GameList::const_iterator cand = candidates.begin(); cand != candidates.end(); ++cand) {
			GameDescriptor result = *cand;
			Common::String path = dir.getPath();

			// Remove trailing slashes
			while (path != "/" && path.lastChar() == '/')
				path.deleteLastChar();

			// Check for existing config entries for this path/gameid/lang/platform combination
			if (_pathToTargets.contains(path)) {
				bool duplicate = false;
				const StringArray &targets = _pathToTargets[path];
				for (StringArray::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) {
					// If the gameid, platform and language match -> skip it
					Common::ConfigManager::Domain *dom = ConfMan.getDomain(*iter);
					assert(dom);

					if ((*dom)["gameid"] == result["gameid"] &&
					    (*dom)["platform"] == result["platform"] &&
					    (*dom)["language"] == result["language"]) {
						duplicate = true;
						break;
					}
				}
				if (duplicate) {
					_oldGamesCount++;
					break;	// Skip duplicates
				}
			}
			result["path"] = path;
			_games.push_back(result);

			_list->append(result.description());
		}


		// Recurse into all subdirs
		for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) {
			if (file->isDirectory()) {
				_scanStack.push(*file);
			}
		}

		_dirsScanned++;
	}


	// Update the dialog
	Common::String buf;

	if (_scanStack.empty()) {
		// Enable the OK button
		_okButton->setEnabled(true);

		buf = _("Scan complete!");
		_dirProgressText->setLabel(buf);

		buf = Common::String::format(_("Discovered %d new games, ignored %d previously added games."), _games.size(), _oldGamesCount);
		_gameProgressText->setLabel(buf);

	} else {
		buf = Common::String::format(_("Scanned %d directories ..."), _dirsScanned);
		_dirProgressText->setLabel(buf);

		buf = Common::String::format(_("Discovered %d new games, ignored %d previously added games ..."), _games.size(), _oldGamesCount);
		_gameProgressText->setLabel(buf);
	}

	if (_games.size() > 0) {
		_list->scrollToEnd();
	}

	drawDialog();
}
void OverlayView::draw(OverlayDrawer* drawer)
{
   bool highlightEnabled = m_stackSet.automaticHighlightEnabled();
   
   if (m_mapManipulator.getAnimatedManipulator().isWorking()) {
      m_stackSet.enableAutomaticHighlight(false);
   }
   
   m_stackSet.update();      

   StackedSet::StackVec& stackedItems = m_stackSet.getStackedItems();

   const OverlayItemInternal* highlighted = NULL;

   WFAPI::wf_uint32 pixScale =
      static_cast<WFAPI::wf_uint32>(m_projection.getPixelScale());

   for( StackedSet::StackVec::const_iterator itr = stackedItems.begin();
        itr != stackedItems.end(); itr++ )
   {
      const OverlayItemInternal* curItem = *itr;

      if(curItem == m_dialogItem) {
         continue;
      }      

      if (!curItem->m_isHighlighted){

         MC2Point topLeft(curItem->getPixelBox().getTopLeft());
         
         // Get our visual spec
         const WFAPI::OverlayItemVisualSpec* visualSpec =
            OverlayItemUtil::getCurrentVisualSpec(curItem, pixScale);

         const WFAPI::WFString& nbrItems(getNbrItems(curItem));
      
         const WFAPI::WFString& itemName(getName(curItem));
         
         OverlayDrawing::drawOverlayItem(curItem,
                                         visualSpec,
                                         itemName,
                                         nbrItems,
                                         topLeft,
                                         drawer);
         // OverlayDrawing::drawPixelBox(curItem->getPixelBox(),
         //                              drawer);
      } else {
         highlighted = curItem;
      }
   }
         
      
   if (highlighted){
      // OverlayDrawing::drawPixelBox(closest->getPixelBox(),
      //                              drawer);
      const WFAPI::OverlayItemVisualSpec* visualSpec =
         OverlayItemUtil::getCurrentVisualSpec(highlighted, pixScale);

      const WFAPI::WFString& nbrItems(getNbrItems(highlighted));
      
      const WFAPI::WFString& itemName(getName(highlighted));

      MC2Point topLeft(highlighted->getPixelBox().getTopLeft());
      
      OverlayDrawing::drawOverlayItem(highlighted, visualSpec,
                                      itemName,
                                      nbrItems,
                                      topLeft,
                                      drawer);
   }

   if( getOverlayState() == DIALOG_INTERACTION ) {
      drawDialog(drawer);      
   }

   m_stackSet.enableAutomaticHighlight(highlightEnabled);
}