Пример #1
0
 void LoadingScreen::onResChange(int w, int h)
 {
     setCoord(0,0,w,h);
 }
Пример #2
0
	void ScrollView::setCoord(int _left, int _top, int _width, int _height)
	{
		setCoord(IntCoord(_left, _top, _width, _height));
	}
Пример #3
0
 void HUD::onResChange(int width, int height)
 {
     setCoord(0, 0, width, height);
 }
Пример #4
0
    HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
        : Layout("openmw_hud.layout")
        , mHealth(NULL)
        , mMagicka(NULL)
        , mStamina(NULL)
        , mDrowning(NULL)
        , mDrowningFrame(NULL)
        , mDrowningFlash(NULL)
        , mWeapImage(NULL)
        , mSpellImage(NULL)
        , mWeapStatus(NULL)
        , mSpellStatus(NULL)
        , mEffectBox(NULL)
        , mMinimap(NULL)
        , mCompass(NULL)
        , mCrosshair(NULL)
        , mFpsBox(NULL)
        , mFpsCounter(NULL)
        , mTriangleCounter(NULL)
        , mBatchCounter(NULL)
        , mHealthManaStaminaBaseLeft(0)
        , mWeapBoxBaseLeft(0)
        , mSpellBoxBaseLeft(0)
        , mEffectBoxBaseRight(0)
        , mMinimapBoxBaseRight(0)
        , mDragAndDrop(dragAndDrop)
        , mCellNameTimer(0.0f)
        , mCellNameBox(NULL)
        , mMapVisible(true)
        , mWeaponVisible(true)
        , mSpellVisible(true)
        , mWorldMouseOver(false)
        , mEnemyHealthTimer(-1)
        , mIsDrowning(false)
        , mWeaponSpellTimer(0.f)
        , mDrowningFlashTheta(0.f)
    {
        setCoord(0,0, width, height);

        // Energy bars
        getWidget(mHealthFrame, "HealthFrame");
        getWidget(mHealth, "Health");
        getWidget(mMagicka, "Magicka");
        getWidget(mStamina, "Stamina");
        getWidget(mEnemyHealth, "EnemyHealth");
        mHealthManaStaminaBaseLeft = mHealthFrame->getLeft();

        MyGUI::Widget *healthFrame, *magickaFrame, *fatigueFrame;
        getWidget(healthFrame, "HealthFrame");
        getWidget(magickaFrame, "MagickaFrame");
        getWidget(fatigueFrame, "FatigueFrame");
        healthFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
        magickaFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
        fatigueFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);

        //Drowning bar
        getWidget(mDrowningFrame, "DrowningFrame");
        getWidget(mDrowning, "Drowning");
        getWidget(mDrowningFlash, "Flash");
        mDrowning->setProgressRange(200);

        const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();

        // Item and spell images and status bars
        getWidget(mWeapBox, "WeapBox");
        getWidget(mWeapImage, "WeapImage");
        getWidget(mWeapStatus, "WeapStatus");
        mWeapBoxBaseLeft = mWeapBox->getLeft();
        mWeapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWeaponClicked);

        getWidget(mSpellBox, "SpellBox");
        getWidget(mSpellImage, "SpellImage");
        getWidget(mSpellStatus, "SpellStatus");
        mSpellBoxBaseLeft = mSpellBox->getLeft();
        mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);

        getWidget(mSneakBox, "SneakBox");
        mSneakBoxBaseLeft = mSneakBox->getLeft();

        getWidget(mEffectBox, "EffectBox");
        mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();

        getWidget(mMinimapBox, "MiniMapBox");
        mMinimapBoxBaseRight = viewSize.width - mMinimapBox->getRight();
        getWidget(mMinimap, "MiniMap");
        getWidget(mCompass, "Compass");
        getWidget(mMinimapButton, "MiniMapButton");
        mMinimapButton->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);

        getWidget(mCellNameBox, "CellName");
        getWidget(mWeaponSpellBox, "WeaponSpellName");

        getWidget(mCrosshair, "Crosshair");

        setFpsLevel(fpsLevel);

        getWidget(mTriangleCounter, "TriangleCounter");
        getWidget(mBatchCounter, "BatchCounter");

        LocalMapBase::init(mMinimap, mCompass, this);

        mMainWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWorldClicked);
        mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver);
        mMainWidget->eventMouseLostFocus += MyGUI::newDelegate(this, &HUD::onWorldMouseLostFocus);

        mSpellIcons = new SpellIcons();
    }
Пример #5
0
void VertexBuffer::setCoordBulk( Vec3 *v, int num ) {
    for(int i=0; i<num; i++) {
        setCoord( i, v[i] );
    }
}
Пример #6
0
	void ItemBox::setCoord(int _left, int _top, int _width, int _height)
	{
		setCoord(IntCoord(_left, _top, _width, _height));
	}
Пример #7
0
void RobotAgent::reset() {
	//Initialize general
	_iterations = 0;
	_wm->_isAlive = true;


	/**/
	int x = 0, y = 0;
	std::string s = "";
	s += "agent[";
	std::stringstream out;
	out << _wm->_agentId;
	s += out.str();
	s += "].x";

	bool randomStart = false;
	if (gProperties.hasProperty(s))
		convertFromString<int>(x, gProperties.getProperty(s), std::dec);
	else {
		if (gVerbose) {
			std::cout << "[warning] Initial X coordinate for agent #" << _wm->_agentId << " not found. Random pick ([!] reset may alter environment, check with x-ray mode [!])." << std::endl;
		}
		randomStart = true;
		x = (int) gAgentWidth + (ranf() * (double) (gSpawnWidth - gAgentWidth));
	}

	s = "agent[";
	s += out.str();
	s += "].y";
	if (gProperties.hasProperty(s))
		convertFromString<int>(y, gProperties.getProperty(s), std::dec);
	else {
		if (gVerbose) {
			std::cout << "[warning] Initial Y coordinate for agent #" << _wm->_agentId << " not found. Random pick ([!] reset may alter environment, check with x-ray mode [!])." << std::endl;
		}
		randomStart = true;
		y = (int) gAgentHeight + (ranf() * (double) (gSpawnHeight - gAgentHeight));
	}

	setCoordReal(x, y);
	setCoord(x, y);

	while (randomStart && isCollision()) {
		//std::cout << "Collision detected on " << x << ", " << y << " rerolling" << std::endl;
		x = (int) 20 + (ranf() * (double) (gSpawnWidth));
		y = (int) 20 + (ranf() * (double) (gSpawnHeight));
		setCoordReal(x, y);
		setCoord(x, y);
	}

	// register agent so others don't start on top of it
	registerAgent();

	//_wm->_xReal = x;
	//_wm->_yReal = y;
	/**/

	//Initialize coordinate and displacement
	//_wm->_xReal=gAgentXStart;
	//_wm->_yReal=gAgentYStart;
	_xDelta = 0;
	_yDelta = 0;

	//Initialize internal variables
	_xDeltaReal = 0; //gAgentXStart;
	_yDeltaReal = 0; //gAgentYStart;


	s = "agent[";
	s += out.str();
	s += "].orientation";
	if (gProperties.hasProperty(s))
		convertFromString<double>(_wm->_agentAbsoluteOrientation, gProperties.getProperty(s), std::dec);
	else {
		if (gVerbose) {
			std::cout << "[warning] Initial orientation  for agent #" << _wm->_agentId << " not found. Random pick." << std::endl;
		}
		_wm->_agentAbsoluteOrientation = ranf() * 360. - 180.;
	}

	_wm->_agentAbsoluteLinearSpeed = 0;

	_wm->_desiredRotationalVelocity = 0;
	_wm->_desiredTranslationalValue = 0;

	_wm->_maxRotationalDeltaValue = gMaxRotationalSpeed; // ie. change will be instantenous
	_wm->_maxTranslationalDeltaValue = gMaxTranslationalDeltaValue; //gMaxTranslationalSpeed ; // idem.

	_wm->_actualTranslationalValue = 0;
	_wm->_actualRotationalVelocity = 0;

	for (int i = 0; i != _wm->_sensorCount; i++) // initialize sensor values to max range, no contact
	{
		_wm->_sensors[i][5] = gSensorRange; // range: max
		_wm->_sensors[i][6] = 0; // type:  none
	}
	_wm->_floorSensor = 0; // floor sensor value (taken from gZoneImage)

	// Initialize agent observer and Behavior Control Architecture

	_agentObserver->reset();
	_behavior->reset();

}
Пример #8
0
 void MultiListBox::setCoord(int _left, int _top, int _width, int _height)
 {
     setCoord(IntCoord(_left, _top, _width, _height));
 }
Пример #9
0
int main(int argc, char * * argv)
{
if (argc != 3)
{
  printf("usage: ./proj4 input output\n");
  return EXIT_FAILURE;
}

int index = 0;
double x = 0, y=0; 

// Build binary tree
stack * root = loadFile(argv[1], &index);
node * head = nodeCreate(root->stackNode->width, root->stackNode->height, root->stackNode->split, root->stackNode->index-1); //= buildTree(root);
root = StackPop(root);
buildTree(root, head, &head, index);
node * tree = NULL;
tree = nodeArrange(tree, &head);

// Packing
clock_t timeStart = clock();
assignCutline(tree);
setCoord(tree);
clock_t timeEnd = clock();
double packTime = (double) (timeEnd - timeStart) / CLOCKS_PER_SEC;
searchNode(tree, &x, &y, 1);
//printPostorderFull(tree);

//Reset output file and save output
FILE * fptr = fopen(argv[2], "w");
saveTree(tree, argv[2]);

// Screen dump
printf("Preorder: ");
printPreorder(tree);
printf("\n\nInorder: ");
printInorder(tree);
printf("\n\nPostorder: ");
printPostorder(tree);
printf("\n\nWidth: %le", tree->width);
printf("\nHeight: %le", tree->height);
printf("\n\nX-coordinate: %le", x);
printf("\nY-coordinate: %le", y); 
printf("\n");

// Rerooting
box * minBox = malloc(sizeof(box));
minBox->width = tree->width;
minBox->height = tree->height;

timeStart = clock();
// ------------------------------------ to run cases without rerooting, comment out the following lines
while (tree->right->split!='-')
{
tree = reroot(tree, minBox);
decideMin(minBox, tree);
//printPostorderFull(tree);
}
// ------------------------------------
timeEnd = clock();
double rootTime = (double) (timeEnd - timeStart) / CLOCKS_PER_SEC;


printf("\nElapsed Time: %le", packTime);
printf("\n\nBest width: %le", minBox->width);
printf("\nBest height: %le\n", minBox->height);
printf("\nElapsed Time for re-routing: %le\n", rootTime);

// Free stack
while(root!=NULL){
  root = StackPop(root);
}

// Memory management
free(root);
free(minBox);
deleteTree(head);
deleteTree(tree);
fclose(fptr);

return EXIT_SUCCESS;
}
Пример #10
0
    TradeWindow::TradeWindow(MWBase::WindowManager& parWindowManager) :
        WindowBase("openmw_trade_window.layout", parWindowManager)
        , ContainerBase(NULL) // no drag&drop
        , mCurrentBalance(0)
    {
        MyGUI::ScrollView* itemView;
        MyGUI::Widget* containerWidget;
        getWidget(containerWidget, "Items");
        getWidget(itemView, "ItemView");
        setWidgets(containerWidget, itemView);

        getWidget(mFilterAll, "AllButton");
        getWidget(mFilterWeapon, "WeaponButton");
        getWidget(mFilterApparel, "ApparelButton");
        getWidget(mFilterMagic, "MagicButton");
        getWidget(mFilterMisc, "MiscButton");

        getWidget(mMaxSaleButton, "MaxSaleButton");
        getWidget(mCancelButton, "CancelButton");
        getWidget(mOfferButton, "OfferButton");
        getWidget(mPlayerGold, "PlayerGold");
        getWidget(mMerchantGold, "MerchantGold");
        getWidget(mIncreaseButton, "IncreaseButton");
        getWidget(mDecreaseButton, "DecreaseButton");
        getWidget(mTotalBalance, "TotalBalance");
        getWidget(mTotalBalanceLabel, "TotalBalanceLabel");
        getWidget(mBottomPane, "BottomPane");

        // adjust size of buttons to fit text
        int curX = 0;
        mFilterAll->setSize( mFilterAll->getTextSize().width + 24, mFilterAll->getSize().height );
        curX += mFilterAll->getTextSize().width + 24 + 4;

        mFilterWeapon->setPosition(curX, mFilterWeapon->getPosition().top);
        mFilterWeapon->setSize( mFilterWeapon->getTextSize().width + 24, mFilterWeapon->getSize().height );
        curX += mFilterWeapon->getTextSize().width + 24 + 4;

        mFilterApparel->setPosition(curX, mFilterApparel->getPosition().top);
        mFilterApparel->setSize( mFilterApparel->getTextSize().width + 24, mFilterApparel->getSize().height );
        curX += mFilterApparel->getTextSize().width + 24 + 4;

        mFilterMagic->setPosition(curX, mFilterMagic->getPosition().top);
        mFilterMagic->setSize( mFilterMagic->getTextSize().width + 24, mFilterMagic->getSize().height );
        curX += mFilterMagic->getTextSize().width + 24 + 4;

        mFilterMisc->setPosition(curX, mFilterMisc->getPosition().top);
        mFilterMisc->setSize( mFilterMisc->getTextSize().width + 24, mFilterMisc->getSize().height );

        mFilterAll->setStateSelected(true);

        mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterMagic->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterMisc->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);

        mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onCancelButtonClicked);
        mOfferButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onOfferButtonClicked);

        mMaxSaleButton->setSize(MyGUI::IntSize(mMaxSaleButton->getTextSize().width + 24, mMaxSaleButton->getHeight()));

        int cancelButtonWidth = mCancelButton->getTextSize().width + 24;
        mCancelButton->setCoord(mBottomPane->getWidth()-cancelButtonWidth,
                                mCancelButton->getTop(),
                                cancelButtonWidth,
                                mCancelButton->getHeight());

        int offerButtonWidth = mOfferButton->getTextSize().width + 24;
        mOfferButton->setCoord(mBottomPane->getWidth()-cancelButtonWidth-offerButtonWidth-8,
                                mOfferButton->getTop(),
                                offerButtonWidth,
                                mOfferButton->getHeight());

        setCoord(400, 0, 400, 300);

        static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &TradeWindow::onWindowResize);
    }
Пример #11
0
float* Sprite::getCoord() {
    setCoord();
    return coord;
}
Пример #12
0
void EnvDialog::accept()
{
    int id;

    if (ed_id->text().isEmpty() ||
        (sscanf((const char *) ed_id->text(), "%d", &id) != 1) ||
        (id < 2) ||
        (id > 127)) {
        QMessageBox::critical(this, "Douml", TR("Invalid identifier, must be an integer between 2 and 127"));
        return;
    }

    int l, t, r, b;
    BooL ok_l, ok_t, ok_r, ok_b;

    setCoord(l, ok_l, ed_xmin);
    setCoord(t, ok_t, ed_ymin);
    setCoord(r, ok_r, ed_xmax);
    setCoord(b, ok_b, ed_ymax);

    if (ok_l && ok_t && ok_r && ok_b) {
        if ((l < 0) || (t < 0) || (r < 0) || (b < 0)) {
            QMessageBox::critical(this, "Douml",
                                  TR("Invalid DEFAULT SCREEN : coordinates can't be negative"));
            return;
        }
        else if ((l != 0) || (t != 0) || (r != 0) || (b != 0)) {
            if (r <= l) {
                QMessageBox::critical(this, "Douml",
                                      TR("Invalid DEFAULT SCREEN : the right must be greater than the left"));
                return;
            }

            if (b <= t) {
                QMessageBox::critical(this, "Douml",
                                      TR("Invalid DEFAULT SCREEN : the bottom must be greater than the top"));
                return;
            }

            if ((r - l) < 500)
                QMessageBox::warning(this, "Douml",
                                     TR("small DEFAULT SCREEN, width less than 500 points !"));

            if ((b - t) < 500)
                QMessageBox::warning(this, "Douml",
                                     TR("small DEFAULT SCREEN, height less than 500 points !"));
        }
    }
    else {
        QMessageBox::critical(this, "Douml",
                              TR("Invalid DEFAULT SCREEN"
                                 "To not specify the desktop all values must be empty or null."
                                 "Else the values must be non negative, the right must be greater\n"
                                 "than the left, and the bottom must be greater than the top"));
        return;
    }

    QSettings settings(QSettings::IniFormat, QSettings::UserScope, "DoUML", "settings");
    settings.setIniCodec(QTextCodec::codecForName("UTF-8"));
    settings.setValue("Main/id", id);
    settings.setValue("Main/manual", ed_doc->text());
    settings.setValue("Main/navigator", ed_navigator->text());
    settings.setValue("Main/template", ed_template->text());
    settings.setValue("Main/editor", ed_editor->text());
    settings.setValue("Main/lang", ed_lang->text());
    settings.setValue("Main/encoding", cb_charset->currentText());
    settings.setValue("Desktop/left", l);
    settings.setValue("Desktop/right", r);
    settings.setValue("Desktop/top", t);
    settings.setValue("Desktop/bottom", b);

    QDialog::accept();
}
Пример #13
0
/* main */
int main(int argc, char *argv[]){
    int devfd = 0; // input device node
    int sockfd = 0; //socket descriptor
    int connfd = 0; // client socket
    struct sockaddr_in serv_addr; // server address
    char sockBuff[1024]; // buffer for socket
    char *tPtr; // tokenizer pointer
    /*  */
    struct pState state;
    state.isDown = 0;
    state.x = -1;
    state.y = -1;

    /* create socket */
    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd == -1){
        fprintf(stderr, "Could not create socket\n");
        return 1;
    }

    /* set memory to 0 */
    memset(&serv_addr, 0, sizeof(serv_addr));

    /* set and bind server */
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_addr.s_addr = INADDR_ANY;
    serv_addr.sin_port = htons(atoi(argv[1]));
    if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0){
        fprintf(stderr, "ERROR on binding\n");
        return 1;
    }

    /* socket listen on server */
    listen(sockfd, 1);
    connfd = accept(sockfd, (struct sockaddr*)NULL, NULL); 

    /*  */
    char e;
    int x;
    int y;
    /* loop while connected */
    while (1){
        /* get message from client */
        memset(sockBuff, 0, sizeof(sockBuff)); 
        read(connfd, sockBuff, sizeof(sockBuff));
        printf("%s\n",sockBuff);
        tPtr = strtok(sockBuff, "#");
        while(tPtr != NULL) {
            e = *tPtr;
            switch(e){
                case 'B':
                    pressButton(BACK);
                    break;
                case 'H':
                    pressButton(HOME);
                    break;
                case 'M':
                    pressButton(MENU);
                    break;
                case 'L':
                    pressButton(VOLUP);
                    break;
                case 'Q':
                    pressButton(VOLDOWN);
                    break;
                case 'P':
                    pressButton(POWER);
                    break;

                case 'D':
                case 'S':
                case 'U':
                    tPtr = strtok(NULL, "#");
                    x = atoi(tPtr);
                    tPtr = strtok(NULL, "#");
                    y = atoi(tPtr) + Y_OFFSET;

                    setCoord(&state, x, y);

                    /* event */
                    if(e == 'D' && !state.isDown){
                        sendEvent(1, TOUCHSCREEN, 1);
                        state.isDown = 1;
                        sendEvent(0, 0, 0);
                    }
                    else if(e == 'U' && state.isDown){
                        sendEvent(1, TOUCHSCREEN, 0);
                        state.isDown = 0;
                        sendEvent(0, 0, 0);
                    }
                    break;

                default:
                    break;
            }
            tPtr = strtok(NULL, "#");
        }
    } 

    /* close connection */
    sleep(1);
    close(connfd);
    close(sockfd);

    return 0;
}
Пример #14
0
void ItemView::setCoord(int _left, int _top, int _width, int _height)
{
    setCoord(MyGUI::IntCoord(_left, _top, _width, _height));
}
Пример #15
0
void RobotAgent::tryMove(int __recursiveIt) {
	// backup old position in case of collision
	this->xReal_old = _wm->_xReal;
	this->yReal_old = _wm->_yReal;

	// update x/y position
	double headingAngle = _wm->_agentAbsoluteOrientation * M_PI / 180;
	double sinHeading, cosHeading;
	sincos(headingAngle, &sinHeading, &cosHeading);
	_xDeltaReal = _wm->_agentAbsoluteLinearSpeed * cosHeading;
	_yDeltaReal = _wm->_agentAbsoluteLinearSpeed * sinHeading;

	_wm->_xReal += _xDeltaReal;
	_wm->_yReal += _yDeltaReal;
	setCoord((int) _wm->_xReal + 0.5, (int) _wm->_yReal + 0.5);

	if (isCollision()) {
		// roborobo assumes pixel-based resolution for solving collision. Ie. ignore sub-pixel translation values. (see _README.TXT for details)
		if (_wm->_agentAbsoluteLinearSpeed >= 1.0) {
			_wm->_agentAbsoluteLinearSpeed--;
		} else if (_wm->_agentAbsoluteLinearSpeed <= -1.0) {
			_wm->_agentAbsoluteLinearSpeed++;
		}
		if ((_wm->_agentAbsoluteLinearSpeed > -1.0) && (_wm->_agentAbsoluteLinearSpeed < 1.0)) {
			_wm->_agentAbsoluteLinearSpeed = 0;
		}

		_wm->_xReal = xReal_old;
		_wm->_yReal = yReal_old;

		// if zero: move is canceled
		if (!::isnan(_wm->_agentAbsoluteLinearSpeed) && _wm->_agentAbsoluteLinearSpeed != 0)
		{
			__recursiveIt++;
			tryMove(__recursiveIt);
		} else {
			// special case: agent cannot not move at all - restore original coordinate (remember, _x/yReal are global and modified during recursive call).
			_wm->_xReal = xReal_old;
			_wm->_yReal = yReal_old;
			setCoord((int) _wm->_xReal + 0.5, (int) _wm->_yReal + 0.5);
		}

		// update world model variables and internal data

		_wm->_agentAbsoluteLinearSpeed = 0;

		if (gLocomotionMode == 1) // consider obstacle friction or not for rotation?
		{
			_wm->_agentAbsoluteOrientation = _lastAgentAbsoluteOrientation;
			_wm->_actualRotationalVelocity = 0;
		} else
			_wm->_actualRotationalVelocity = _wm->_desiredRotationalVelocity;

		//_wm->_desiredTranslationalValue = _wm->_desiredRotationalVelocity = 0;
		_wm->_actualTranslationalValue = 0;

	} else {
		// actual rotational and translational values matches desired values
		_wm->_actualRotationalVelocity = _wm->_desiredRotationalVelocity;
		_wm->_actualTranslationalValue = _wm->_agentAbsoluteLinearSpeed; // (!) _wm->_desiredTranslationalValue is different as the "desired" translation speed may not be reached due to physical actuator limitations
	}
}
Пример #16
0
	void TabControl::setCoord(int _left, int _top, int _width, int _height)
	{
		setCoord(IntCoord(_left, _top, _width, _height));
	}
Пример #17
0
bool ActionMenu::draw(LPDDSurface surface, int x, int y){
	setCoord(x, y);
	return draw(surface);	
}
Пример #18
0
	void Canvas::setCoord(int _left, int _top, int _width, int _height)
	{
		setCoord(IntCoord(_left, _top, _width, _height));
	}
Пример #19
0
    void MainMenu::updateMenu()
    {
        setCoord(0,0, mWidth, mHeight);


        if (!mButtonBox)
            mButtonBox = mMainWidget->createWidget<MyGUI::Widget>("", MyGUI::IntCoord(0, 0, 0, 0), MyGUI::Align::Default);

        int curH = 0;

        MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState();

        std::vector<std::string> buttons;

        if (state==MWBase::StateManager::State_Running)
            buttons.push_back("return");

        buttons.push_back("newgame");

        if (MWBase::Environment::get().getStateManager()->characterBegin()!=
            MWBase::Environment::get().getStateManager()->characterEnd())
            buttons.push_back("loadgame");

        if (state==MWBase::StateManager::State_Running &&
            MWBase::Environment::get().getWorld()->getGlobalInt ("chargenstate")==-1)
            buttons.push_back("savegame");

        buttons.push_back("options");
        //buttons.push_back("credits");
        buttons.push_back("exitgame");

        // Create new buttons if needed
        for (std::vector<std::string>::iterator it = buttons.begin(); it != buttons.end(); ++it)
        {
            if (mButtons.find(*it) == mButtons.end())
            {
                MWGui::ImageButton* button = mButtonBox->createWidget<MWGui::ImageButton>
                        ("ImageBox", MyGUI::IntCoord(0, curH, 0, 0), MyGUI::Align::Default);
                button->setProperty("ImageHighlighted", "textures\\menu_" + *it + "_over.dds");
                button->setProperty("ImageNormal", "textures\\menu_" + *it + ".dds");
                button->setProperty("ImagePushed", "textures\\menu_" + *it + "_pressed.dds");
                button->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::onButtonClicked);
                button->setUserData(std::string(*it));
                mButtons[*it] = button;
            }
        }

        // Start by hiding all buttons
        int maxwidth = 0;
        for (std::map<std::string, MWGui::ImageButton*>::iterator it = mButtons.begin(); it != mButtons.end(); ++it)
        {
            it->second->setVisible(false);
            MyGUI::IntSize requested = it->second->getRequestedSize();
            if (requested.width > maxwidth)
                maxwidth = requested.width;
        }

        // Now show and position the ones we want
        for (std::vector<std::string>::iterator it = buttons.begin(); it != buttons.end(); ++it)
        {
            assert(mButtons.find(*it) != mButtons.end());
            MWGui::ImageButton* button = mButtons[*it];
            button->setVisible(true);
            MyGUI::IntSize requested = button->getRequestedSize();
            button->setCoord((maxwidth-requested.width) / 2, curH, requested.width, requested.height);
            curH += requested.height;
        }

        mButtonBox->setCoord (mWidth/2 - maxwidth/2, mHeight/2 - curH/2, maxwidth, curH);

    }
Пример #20
0
	void Slider::setCoord(int _left, int _top, int _width, int _height)
	{
		setCoord(IntCoord(_left, _top, _width, _height));
	}
Пример #21
0
    void MainMenu::updateMenu()
    {
        setCoord(0,0, mWidth, mHeight);

        if (!mButtonBox)
            mButtonBox = mMainWidget->createWidget<MyGUI::Widget>("", MyGUI::IntCoord(0, 0, 0, 0), MyGUI::Align::Default);

        int curH = 0;

        MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState();

        mVersionText->setVisible(state == MWBase::StateManager::State_NoGame);

        std::vector<std::string> buttons;

        if (state==MWBase::StateManager::State_Running)
            buttons.push_back("return");

        buttons.push_back("newgame");

        if (state==MWBase::StateManager::State_Running &&
            MWBase::Environment::get().getWorld()->getGlobalInt ("chargenstate")==-1 &&
                MWBase::Environment::get().getWindowManager()->isSavingAllowed())
            buttons.push_back("savegame");

        if (MWBase::Environment::get().getStateManager()->characterBegin()!=
            MWBase::Environment::get().getStateManager()->characterEnd())
            buttons.push_back("loadgame");

        buttons.push_back("options");

        if (state==MWBase::StateManager::State_NoGame)
            buttons.push_back("credits");

        buttons.push_back("exitgame");

        // Create new buttons if needed
        for (std::vector<std::string>::iterator it = buttons.begin(); it != buttons.end(); ++it)
        {
            if (mButtons.find(*it) == mButtons.end())
            {
                Gui::ImageButton* button = mButtonBox->createWidget<Gui::ImageButton>
                        ("ImageBox", MyGUI::IntCoord(0, curH, 0, 0), MyGUI::Align::Default);
                button->setProperty("ImageHighlighted", "textures\\menu_" + *it + "_over.dds");
                button->setProperty("ImageNormal", "textures\\menu_" + *it + ".dds");
                button->setProperty("ImagePushed", "textures\\menu_" + *it + "_pressed.dds");
                button->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::onButtonClicked);
                button->setUserData(std::string(*it));
                mButtons[*it] = button;
            }
        }

        // Start by hiding all buttons
        int maxwidth = 0;
        for (std::map<std::string, Gui::ImageButton*>::iterator it = mButtons.begin(); it != mButtons.end(); ++it)
        {
            it->second->setVisible(false);
            MyGUI::IntSize requested = it->second->getRequestedSize();
            if (requested.width > maxwidth)
                maxwidth = requested.width;
        }

        // Now show and position the ones we want
        for (std::vector<std::string>::iterator it = buttons.begin(); it != buttons.end(); ++it)
        {
            assert(mButtons.find(*it) != mButtons.end());
            Gui::ImageButton* button = mButtons[*it];
            button->setVisible(true);

            MyGUI::IntSize requested = button->getRequestedSize();

            // Trim off some of the excessive padding
            // TODO: perhaps do this within ImageButton?
            int trim = 8;
            button->setImageCoord(MyGUI::IntCoord(0, trim, requested.width, requested.height-trim));
            int height = requested.height-trim*2;
            button->setImageTile(MyGUI::IntSize(requested.width, height));
            button->setCoord((maxwidth-requested.width) / 2, curH, requested.width, height);
            curH += height;
        }

        if (state == MWBase::StateManager::State_NoGame)
        {
            // Align with the background image
            int bottomPadding=24;
            mButtonBox->setCoord (mWidth/2 - maxwidth/2, mHeight - curH - bottomPadding, maxwidth, curH);
        }
        else
            mButtonBox->setCoord (mWidth/2 - maxwidth/2, mHeight/2 - curH/2, maxwidth, curH);

    }