Example #1
0
void SDLIntegration::buttonDownNavigate(Uint8 bID) {
    switch (bID) {
    case SDLIntegration::PS3ButtonSelect:
        //exit the program. this button will actually close the program unlike
        //the ESC key
        exit(-1);
        break;
    case SDLIntegration::PS3ButtonPS3Button:
        //kind of a hack, but I'm unsure of how to use ACTION_HOME, but that should be used instead
        _manip->setViewpoint(osgEarth::Viewpoint( osg::Vec3d( -82.968, 35.839, 0 ), 0, -10.0, 150000 ));
        break;
    case SDLIntegration::PS3ButtonDPadUp:
        //zoom in
        _zoomX -= 0.025;
        _zoomY -= 0.025;
        _zoom = true;
        break;
    case SDLIntegration::PS3ButtonDPadDown:
        //zoom out
        _zoomX += 0.025;
        _zoomY += 0.025;
        _zoom = true;
        break;

    case SDLIntegration::PS3ButtonR1:
        //go to the next POI
        SDLIntegration::viewID(true);
        _manip->setViewpoint( VPs[SDLIntegration::_POInum], 4.0 );
        break;
    case SDLIntegration::PS3ButtonL1:
        //go to the previous POI
        SDLIntegration::viewID(false);
        _manip->setViewpoint( VPs[SDLIntegration::_POInum], 4.0 );
        break;


    case SDLIntegration::PS3ButtonTriangle:
        //remove the last tower that was added
        _tower->removeChild(_tower->getNumChildren()-1, 1);
        break;

    case SDLIntegration::PS3ButtonX:
        /*
         * This button changes the mode to object placement.
         * The size of the tower is statically set. When the user clicks
         * on the X button, it places a tower in the middle of the
         * screen at a height close to the correct height.
         */
        _geode = new osg::Geode();
        _geode->addDrawable( new osg::ShapeDrawable(new osg::Cylinder(osg::Vec3d(0,0,0), 2, 85.3)));
        osgEarth::Util::ObjectPlacer placer( _mapNode );
        double hasml;
        double hae;
        _elevation = new osgEarth::Util::ElevationManager(_mapNode->getMap());
        _elevation->getElevation(_manip->getViewpoint().getFocalPoint().x(),_manip->getViewpoint().getFocalPoint().y(), 0.0, _mapNode->getMap()->getSRS(), hasml, hae);
        _tower->addChild( placer.placeNode( _geode, _manip->getViewpoint().getFocalPoint().y(),  _manip->getViewpoint().getFocalPoint().x(), hasml ));
        break;
    }

}
Example #2
0
int main(void) {
  unsigned long n = 0;
  unsigned int nb_sucre;

  /* init de la random seed */
  inital();

  /* init de la grille */
  vider();

  printf("Nombre de tours ( Si 0 : jusqu'a la fin ) : ");
  scanf("%lu", &n);

  printf("Au bout de combien de chargement un emplacement de sucre s'est-il vide ?\n");
  do {
    printf("Veuillez entrer une valeur dans [0,255] :\n");
    scanf("%u", &nb_sucre);
  } while (nb_sucre > 255 || nb_sucre < 0 );

  /* placer les objets de la grille */
  placer(nb_sucre);
  simulation(n);

  return 0;
}
Example #3
0
void CMapGenerator::genZones()
{
	editManager->clearTerrain(&rand);
	editManager->getTerrainSelection().selectRange(MapRect(int3(0, 0, 0), mapGenOptions->getWidth(), mapGenOptions->getHeight()));
	editManager->drawTerrain(ETerrainType::GRASS, &rand);

	auto tmpl = mapGenOptions->getMapTemplate();
	zones = tmpl->getZones(); //copy from template (refactor?)

	CZonePlacer placer(this);
	placer.placeZones(mapGenOptions, &rand);
	placer.assignZones(mapGenOptions);

	logGlobal->infoStream() << "Zones generated successfully";
}
int observateurExpert::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: masque((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: changement((*reinterpret_cast< bool(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 2: placer((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
Example #5
0
void TextSelectDialog::postInit()
{
    Window::postInit();
    setWindowName("TextSelectDialog");
    setResizable(true);
    setCloseButton(mAllowQuit == AllowQuit_true);
    setStickyButtonLock(true);
    setMinWidth(260);
    setMinHeight(220);
    setDefaultSize(260, 230, ImagePosition::CENTER, 0, 0);

    if (setupWindow != nullptr)
        setupWindow->registerWindowForReset(this);

    setActionEventId("OK");
    mModel = new NamesModel;
    mItemList = CREATEWIDGETR(ListBox,
        this,
        mModel,
        "listbox.xml");
    mScrollArea = new ScrollArea(this, mItemList,
        fromBool(getOptionBool("showbackground", false), Opaque),
        "sell_background.xml");
    mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);

    mSelectButton = new Button(this,
        mSelectButtonName,
        "select",
        BUTTON_SKIN,
        this);
    if (mAllowQuit == AllowQuit_true)
    {
        mQuitButton = new Button(this,
            // TRANSLATORS: sell dialog button
            _("Quit"),
            "quit",
            BUTTON_SKIN,
            this);
    }

    mSelectButton->setEnabled(false);

    mItemList->setDistributeMousePressed(false);
    mItemList->addSelectionListener(this);
    mItemList->setActionEventId("item");
    mItemList->addActionListener(this);

    ContainerPlacer placer(nullptr, nullptr);
    placer = getPlacer(0, 0);

    placer(0, 0, mScrollArea, 8, 5).setPadding(3);
    if (mQuitButton != nullptr)
    {
        placer(6, 5, mSelectButton, 1, 1);
        placer(7, 5, mQuitButton, 1, 1);
    }
    else
    {
        placer(7, 5, mSelectButton, 1, 1);
    }

    Layout &layout = getLayout();
    layout.setRowHeight(0, LayoutType::SET);

    center();
    loadWindowState();

    setVisible(Visible_true);
    enableVisibleSound(true);
}
Example #6
0
RegisterDialog::RegisterDialog(LoginData &data) :
    // TRANSLATORS: register dialog name
    Window(_("Register"), Modal_false, nullptr, "register.xml"),
    ActionListener(),
    KeyListener(),
    mLoginData(&data),
    mUserField(new TextField(this, mLoginData->username, LoseFocusOnTab_true,
        nullptr, std::string(), false)),
    mPasswordField(new PasswordField(this, mLoginData->password)),
    mConfirmField(new PasswordField(this, std::string())),
    mEmailField(nullptr),
    // TRANSLATORS: register dialog. button.
    mRegisterButton(new Button(this, _("Register"), "register",
        BUTTON_SKIN, this)),
    // TRANSLATORS: register dialog. button.
    mCancelButton(new Button(this, _("Cancel"), "cancel",
        BUTTON_SKIN, this)),
    mMaleButton(nullptr),
    mFemaleButton(nullptr),
    mWrongDataNoticeListener(new WrongDataNoticeListener)
{
    setCloseButton(true);

    // TRANSLATORS: register dialog. label.
    Label *const userLabel = new Label(this, _("Name:"));
    // TRANSLATORS: register dialog. label.
    Label *const passwordLabel = new Label(this, _("Password:"******"Confirm:"));

    ContainerPlacer placer(nullptr, nullptr);
    placer = getPlacer(0, 0);
    placer(0, 0, userLabel, 1, 1);
    placer(0, 1, passwordLabel, 1, 1);
    placer(0, 2, confirmLabel, 1, 1);

    placer(1, 0, mUserField, 3, 1).setPadding(2);
    placer(1, 1, mPasswordField, 3, 1).setPadding(2);
    placer(1, 2, mConfirmField, 3, 1).setPadding(2);

    int row = 3;

    if (features.getIntValue("forceAccountGender") == -1)
    {
        // TRANSLATORS: register dialog. button.
        mMaleButton = new RadioButton(this, _("Male"), "sex", true);
        // TRANSLATORS: register dialog. button.
        mFemaleButton = new RadioButton(this, _("Female"), "sex", false);
        placer(1, row, mMaleButton, 1, 1);
        placer(2, row, mFemaleButton, 1, 1);

        row++;
    }

    if (serverFeatures->haveEmailOnRegister())
    {
        // TRANSLATORS: register dialog. label.
        Label *const emailLabel = new Label(this, _("Email:"));
        mEmailField = new TextField(this,
            std::string(),
            LoseFocusOnTab_true,
            nullptr,
            std::string(),
            false);
        placer(0, row, emailLabel, 1, 1);
        placer(1, row, mEmailField, 3, 1).setPadding(2);
        mEmailField->addKeyListener(this);
        mEmailField->setActionEventId("register");
        mEmailField->addActionListener(this);
//        row++;
    }

    placer = getPlacer(0, 2);
    placer(1, 0, mRegisterButton, 1, 1);
    placer(2, 0, mCancelButton, 1, 1);
    reflowLayout(250, 0);

    mUserField->addKeyListener(this);
    mPasswordField->addKeyListener(this);
    mConfirmField->addKeyListener(this);

    mUserField->setActionEventId("register");
    mPasswordField->setActionEventId("register");
    mConfirmField->setActionEventId("register");

    mUserField->addActionListener(this);
    mPasswordField->addActionListener(this);
    mConfirmField->addActionListener(this);

    center();
}