Пример #1
0
QuickKeysMenu::QuickKeysMenu()
{
  // add controls
  std::vector<HUDuiControl*>& controls = getControls();

  controls.push_back(createLabel("Define Quick Keys"));
  controls.push_back(createLabel("Notice: depending on platform not all keys might work"));

  controls.push_back(createLabel("Send to All"));
  controls.push_back(createLabel("Send to Team"));

  firstKeyControl = controls.size();

  int i;
  for (i=1; i < 11; i++) {
    std::string keyLabel = string_util::format("Alt-F%d", i);
    controls.push_back(createInput(keyLabel));
  }

  for (i=1; i < 11; i++) {
    std::string keyLabel = string_util::format("Ctrl-F%d", i);
    controls.push_back(createInput(keyLabel));
  }

  initNavigation(controls, firstKeyControl, controls.size()-1);
}
Пример #2
0
int addNavigationLocations() {
	initNavigation();

	// locations
	addNavigationLocation(&locationA, "A", 0, 0);
	addNavigationLocation(&locationB, "B", 0, 0);
	addNavigationLocation(&locationC, "C", 0, 0);
	addNavigationLocation(&locationD, "D", 0, 0);
	addNavigationLocation(&locationE, "E", 0, 0);
	addNavigationLocation(&locationF, "F", 0, 0);
	addNavigationLocation(&locationG, "G", 0, 0);
	addNavigationLocation(&locationH, "H", 0, 0);
	addNavigationLocation(&locationI, "I", 0, 0);
	addNavigationLocation(&locationJ, "J", 0, 0);

	// paths
	void pathABFunction() { fillPathData(&locationA, &locationB, 85, 0, 0, 0, 0, 0, 0); }
Пример #3
0
void initStrategy2012(int strategyIndex) {

    initLocationList(&locationList, (Location(*)[]) &locationListArray, STRATEGY_2012_BIT_LIST_NAVIGATION_TEST_ARRAY_LENGTH);
    initPathList(&pathList, (PathData(*)[]) &pathListArray, STRATEGY_2012_NAVIGATION_PATH_LIST_TEST_ARRAY_LENGTH);
    initBitList(&outgoingPathBitList, (unsigned int(*)[]) &outgoingPathBitArray, STRATEGY_2012_BIT_LIST_NAVIGATION_TEST_ARRAY_LENGTH);
    initBitList(&availablePathBitList, (unsigned int(*)[]) &availablePathBitArray, STRATEGY_2012_BIT_LIST_NAVIGATION_TEST_ARRAY_LENGTH);

    initNavigation(&locationList, &pathList, &outgoingPathBitList, &availablePathBitList);

    initLocations2012();
    initPaths2012(strategyIndex);

    initTargets2012();
    initTargetActions2012();
    initTargetActionsItems2012();

    initStrategies2012();
    initStrategiesItems2012(strategyIndex);

    GameStrategy* strategy = getGameStrategy(0);
    GameStrategyContext* strategyContext = getStrategyContext();
    strategyContext->gameStrategy = strategy;
    if (strategyIndex == STRATEGY_HOMOLOGATION) {
        strategyContext->maxTargetToHandle = 1;
    }
    else {
        strategyContext->maxTargetToHandle = getGameTargetList()->size;
    }
    //OutputStream* debugOutputStream = getInfoOutputStreamLogger();
    //printStrategyAllDatas(debugOutputStream);

    // opponent
    Point* p = &(getStrategyContext()->opponentRobotPosition);
    p->x = 0;
    p->y = 0;
    
    // obstacle
    p = &(getStrategyContext()->lastObstaclePosition);
    p->x = 0;
    p->y = 0;
    
    strategyContext->hasMoreNextSteps = true;

    // reinitialize the game board to change elements / targets ...
}
Пример #4
0
InputMenu::InputMenu() : keyboardMapMenu(NULL)
{
  std::string currentJoystickDevice = BZDB.get("joystickname");
  // cache font face ID
  int fontFace = MainMenu::getFontFace();
  // add controls
  std::vector<HUDuiControl*>& list = getControls();

  HUDuiLabel* label = new HUDuiLabel;
  label->setFontFace(fontFace);
  label->setString("Input Settings");
  list.push_back(label);

  keyMapping = new HUDuiLabel;
  keyMapping->setFontFace(fontFace);
  keyMapping->setLabel("Change Key Mapping");
  list.push_back(keyMapping);

  HUDuiList* option = new HUDuiList;

  option = new HUDuiList;
  std::vector<std::string>* options = &option->getList();
  // set joystick Device
  option->setFontFace(fontFace);
  option->setLabel("Joystick device:");
  option->setCallback(callback, (void*)"J");
  options = &option->getList();
  options->push_back(std::string("off"));
  std::vector<std::string> joystickDevices;
  getMainWindow()->getJoyDevices(joystickDevices);
  int i;
  for (i = 0; i < (int)joystickDevices.size(); i++) {
    options->push_back(joystickDevices[i]);
  }
  joystickDevices.erase(joystickDevices.begin(), joystickDevices.end());
  for (i = 0; i < (int)options->size(); i++) {
    if ((*options)[i].compare(currentJoystickDevice) == 0) {
      option->setIndex(i);
      break;
    }
  }
  option->update();
  list.push_back(option);

  forceInput = new HUDuiList;
  forceInput->setFontFace(fontFace);
  forceInput->setLabel("Force input device:");
  forceInput->setCallback(callback, (void*)"F");
  options = &forceInput->getList();
  options->push_back("Do not force");
  options->push_back(LocalPlayer::getInputMethodName(LocalPlayer::Keyboard));
  options->push_back(LocalPlayer::getInputMethodName(LocalPlayer::Mouse));
  options->push_back(LocalPlayer::getInputMethodName(LocalPlayer::Joystick));
  forceInput->update();
  list.push_back(forceInput);

  option = new HUDuiList;
  // set joystick Device
  option->setFontFace(fontFace);
  option->setLabel("Confine mouse:");
  option->setCallback(callback, (void*)"G");
  options = &option->getList();
  options->push_back(std::string("yes"));
  options->push_back(std::string("no"));
  if (getMainWindow()->isGrabEnabled())
    option->setIndex(0);
  else
    option->setIndex(1);
  option->update();
  list.push_back(option);

  initNavigation(list, 1,list.size()-1);
}