/* QGUIUpDownPairMod */ QGUIUpDownPairMod::QGUIUpDownPairMod(plCreatable* pCre, QWidget* parent) : QCreatable(pCre, kGUIUpDownPairMod, parent) { pfGUIUpDownPairMod* ctrl = pfGUIUpDownPairMod::Convert(fCreatable); fControlModLink = new QCreatableLink(this, false); fControlModLink->setText(tr("GUI Control Common Properties")); fControlModLink->setCreatable(ctrl); fControlModLink->setForceType(kGUIControlMod); fMin = new QFloatEdit(this); fMin->setRange(-2147483648.0, 2147483647.0, 3); fMin->setValue(ctrl->getMin()); fMax = new QFloatEdit(this); fMax->setRange(-2147483648.0, 2147483647.0, 3); fMax->setValue(ctrl->getMax()); fStep = new QFloatEdit(this); fStep->setRange(-2147483648.0, 2147483647.0, 3); fStep->setValue(ctrl->getStep()); fUpCtrl = new QCreatableLink(this); fUpCtrl->setKey(ctrl->getUpControl()); fUpCtrl->setText(ctrl->getUpControl().Exists() ? ~ctrl->getUpControl()->getName() : "(None)"); fDownCtrl = new QCreatableLink(this); fDownCtrl->setKey(ctrl->getDownControl()); fDownCtrl->setText(ctrl->getDownControl().Exists() ? ~ctrl->getDownControl()->getName() : "(None)"); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); layout->addWidget(fControlModLink, 0, 0, 1, 3); layout->addWidget(new QLabel(tr("Range:"), this), 1, 0); layout->addWidget(fMin, 1, 1); layout->addWidget(fMax, 1, 2); layout->addWidget(new QLabel(tr("Step:"), this), 2, 0); layout->addWidget(fStep, 2, 1); layout->addWidget(new QLabel(tr("Up Control:"), this), 3, 0); layout->addWidget(fUpCtrl, 3, 1, 1, 2); layout->addWidget(new QLabel(tr("Down Control:"), this), 4, 0); layout->addWidget(fDownCtrl, 4, 1, 1, 2); connect(fUpCtrl, SIGNAL(addObject()), this, SLOT(setUpCtrl())); connect(fUpCtrl, SIGNAL(delObject()), this, SLOT(unsetUpCtrl())); connect(fDownCtrl, SIGNAL(addObject()), this, SLOT(setDownCtrl())); connect(fDownCtrl, SIGNAL(delObject()), this, SLOT(unsetDownCtrl())); }
void Controller::gameController() { // Set the view's global transform sf::Transform playerPos; playerPos.translate(-(p->getPosition()).getSfVec()); playerPos.translate(view->WINDOW_WIDTH / 2, view->WINDOW_HEIGHT / 2); view->setTransform(playerPos); // Set the global DEBUG state Debug::debugging = Global::DEBUG; // Check the static list for objects to add for (auto it = GameObject::staticGameObjects.begin(); it != GameObject::staticGameObjects.end(); ++it) { addObject(*it); } GameObject::staticGameObjects.clear(); // Check the static list for objects to delete for (auto it = GameObject::staticGameObjectsDel.begin(); it != GameObject::staticGameObjectsDel.end(); ++it) { delObject(*it); } GameObject::staticGameObjectsDel.clear(); // Check the static list for objects to remove for (auto it = GameObject::staticGameObjectsRem.begin(); it != GameObject::staticGameObjectsRem.end(); ++it) { auto remObj = std::find(gameObjects.begin(), gameObjects.end(), *it); // Add it to the appropriate lists if ((*remObj)->isUpdatable()) model->remUpdatable(dynamic_cast<Updatable*>(*remObj)); if ((*remObj)->isDrawable()) view->remDrawable(dynamic_cast<Drawable*>(*remObj)); if ((*remObj)->isCollidable()) model->remCollidable(dynamic_cast<Collidable*>(*remObj)); gameObjects.erase(remObj); } GameObject::staticGameObjectsRem.clear(); // Check all game objects for (auto it = gameObjects.begin(); it != gameObjects.end(); ) { if ((*it)->removeFunc() && (*it)->isNone()) { // Delete the memory for this game object, as all lists have removed it now delete (*it); (*it) = NULL; it = gameObjects.erase(it); } else { ++it; } } }
/* QGUIListBoxMod */ QGUIListBoxMod::QGUIListBoxMod(plCreatable* pCre, QWidget* parent) : QCreatable(pCre, kGUIListBoxMod, parent) { pfGUIListBoxMod* ctrl = pfGUIListBoxMod::Convert(fCreatable); fControlModLink = new QCreatableLink(this, false); fControlModLink->setText(tr("GUI Control Common Properties")); fControlModLink->setCreatable(ctrl); fControlModLink->setForceType(kGUIControlMod); QGroupBox* grpFlags = new QGroupBox(tr("Flags"), this); fModFlags[pfGUIListBoxMod::kSingleSelect - kModFlagStart] = new QCheckBox(tr("Single Select"), grpFlags); fModFlags[pfGUIListBoxMod::kDragAndDropCapable - kModFlagStart] = new QCheckBox(tr("Drag & Drop"), grpFlags); fModFlags[pfGUIListBoxMod::kDisableSelection - kModFlagStart] = new QCheckBox(tr("Disable Selection"), grpFlags); fModFlags[pfGUIListBoxMod::kDisableKeyActions - kModFlagStart] = new QCheckBox(tr("Disable Key Actions"), grpFlags); fModFlags[pfGUIListBoxMod::kScrollLeftToRight - kModFlagStart] = new QCheckBox(tr("Scroll Horizontally"), grpFlags); fModFlags[pfGUIListBoxMod::kAllowMultipleElementsPerRow - kModFlagStart] = new QCheckBox(tr("Multiple Elements per Row"), grpFlags); fModFlags[pfGUIListBoxMod::kAllowMousePassThrough - kModFlagStart] = new QCheckBox(tr("Allow Mouse Pass-Through"), grpFlags); fModFlags[pfGUIListBoxMod::kGrowLeavesAndProcessOxygen - kModFlagStart] = new QCheckBox(tr("Grow Leaves and Process Oxygen"), grpFlags); fModFlags[pfGUIListBoxMod::kHandsOffMultiSelect - kModFlagStart] = new QCheckBox(tr("Hands-Off Multi-Select"), grpFlags); fModFlags[pfGUIListBoxMod::kForbidNoSelection - kModFlagStart] = new QCheckBox(tr("Forbid No Selection"), grpFlags); QGridLayout* flagLayout = new QGridLayout(grpFlags); flagLayout->setContentsMargins(8, 8, 8, 8); flagLayout->setVerticalSpacing(0); flagLayout->setHorizontalSpacing(8); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kSingleSelect - kModFlagStart], 0, 0); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kDragAndDropCapable - kModFlagStart], 1, 0); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kDisableSelection - kModFlagStart], 2, 0); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kDisableKeyActions - kModFlagStart], 3, 0); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kScrollLeftToRight - kModFlagStart], 4, 0); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kAllowMultipleElementsPerRow - kModFlagStart], 0, 1); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kAllowMousePassThrough - kModFlagStart], 1, 1); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kGrowLeavesAndProcessOxygen - kModFlagStart], 2, 1); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kHandsOffMultiSelect - kModFlagStart], 3, 1); flagLayout->addWidget(fModFlags[pfGUIListBoxMod::kForbidNoSelection - kModFlagStart], 4, 1); for (size_t i=0; i<kModFlagCount; i++) fModFlags[i]->setChecked(ctrl->getFlag(i + kModFlagStart)); fScrollCtrl = new QCreatableLink(this); fScrollCtrl->setKey(ctrl->getScrollCtrl()); fScrollCtrl->setText(ctrl->getScrollCtrl().Exists() ? ~ctrl->getScrollCtrl()->getName() : "(None)"); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); layout->addWidget(fControlModLink, 0, 0, 1, 2); layout->addWidget(grpFlags, 1, 0, 1, 2); layout->addWidget(new QLabel(tr("Scroll Ctrl:"), this), 2, 0); layout->addWidget(fScrollCtrl, 2, 1); connect(fScrollCtrl, SIGNAL(addObject()), this, SLOT(setScrollCtrl())); connect(fScrollCtrl, SIGNAL(delObject()), this, SLOT(unsetScrollCtrl())); }
void QCreatableLink::menuRequested() { QMenu menu(this); QAction* setObjItem = menu.addAction(tr("Set Object...")); QAction* delObjItem = menu.addAction(tr("Remove Object")); QPoint pos = fEditLabel->mapToGlobal(QPoint(0, fEditLabel->height())); QAction* sel = menu.exec(pos); if (sel == setObjItem) emit addObject(); else if (sel == delObjItem) emit delObject(); }
/* QGUIMultiLineEditCtrl */ QGUIMultiLineEditCtrl::QGUIMultiLineEditCtrl(plCreatable* pCre, QWidget* parent) : QCreatable(pCre, kGUIMultiLineEditCtrl, parent) { pfGUIMultiLineEditCtrl* ctrl = pfGUIMultiLineEditCtrl::Convert(fCreatable); fControlModLink = new QCreatableLink(this, false); fControlModLink->setCreatable(ctrl, tr("GUI Control Common Properties")); fControlModLink->setForceType(kGUIControlMod); fScrollCtrl = new QCreatableLink(this); fScrollCtrl->setKey(ctrl->getScrollCtrl()); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); layout->addWidget(fControlModLink, 0, 0, 1, 2); layout->addWidget(new QLabel(tr("Scroll Ctrl:"), this), 1, 0); layout->addWidget(fScrollCtrl, 1, 1); connect(fScrollCtrl, SIGNAL(addObject()), this, SLOT(setScrollCtrl())); connect(fScrollCtrl, SIGNAL(delObject()), this, SLOT(unsetScrollCtrl())); }
/* QWinSound */ QWinSound::QWinSound(plCreatable* pCre, QWidget* parent) : QCreatable(pCre, kSound, parent) { plSound* obj = plSound::Convert(fCreatable); fSynchObjLink = new QCreatableLink(this, false); fSynchObjLink->setCreatable(obj, tr("Synch Flags")); fSynchObjLink->setForceType(kSynchedObject); fTime = new QFloatEdit(this); fMaxFalloff = new QIntEdit(this); fMinFalloff = new QIntEdit(this); fCurrVolume = new QFloatEdit(this); fDesiredVolume = new QFloatEdit(this); fSoundType = new QComboBox(this); fSoundType->addItems(QStringList() << "Sound FX" << "Ambience" << "Background Music" << "GUI Sound" << "NPC Voices"); fOuterVol = new QIntEdit(this); fInnerCone = new QIntEdit(this); fOuterCone = new QIntEdit(this); fFadedVolume = new QFloatEdit(this); fPriority = new QIntEdit(this); fPriority->setRange(0, 0xFF); fPlaying = new QCheckBox(tr("Playing"), this); fSubtitleId = new QLineEdit(this); fTime->setValue(obj->getTime()); fMaxFalloff->setValue(obj->getMaxFalloff()); fMinFalloff->setValue(obj->getMinFalloff()); fCurrVolume->setValue(obj->getCurrVolume()); fDesiredVolume->setValue(obj->getDesiredVolume()); fSoundType->setCurrentIndex(obj->getType()); fOuterVol->setValue(obj->getOuterVol()); fInnerCone->setValue(obj->getInnerCone()); fOuterCone->setValue(obj->getOuterCone()); fFadedVolume->setValue(obj->getFadedVolume()); fPriority->setValue(obj->getPriority()); fPlaying->setChecked(obj->isPlaying()); fSubtitleId->setText(st2qstr(obj->getSubtitleId())); QGroupBox* grpProperties = new QGroupBox(tr("Properties"), this); QGridLayout* layProperties = new QGridLayout(grpProperties); layProperties->setVerticalSpacing(0); layProperties->setHorizontalSpacing(8); fProperties[kPropIs3DSound] = new QCheckBox(tr("Is 3D Sound"), grpProperties); fProperties[kPropDisableLOD] = new QCheckBox(tr("Disable LOD"), grpProperties); fProperties[kPropLooping] = new QCheckBox(tr("Looping"), grpProperties); fProperties[kPropAutoStart] = new QCheckBox(tr("Auto Start"), grpProperties); fProperties[kPropLocalOnly] = new QCheckBox(tr("Local Only"), grpProperties); fProperties[kPropLoadOnlyOnCall] = new QCheckBox(tr("Load Only on Call"), grpProperties); fProperties[kPropFullyDisabled] = new QCheckBox(tr("Fully Disabled"), grpProperties); fProperties[kPropDontFade] = new QCheckBox(tr("Don't Fade"), grpProperties); fProperties[kPropIncidental] = new QCheckBox(tr("Incidental"), grpProperties); fProperties[kPropIs3DSound]->setChecked((obj->getProperties() & plSound::kPropIs3DSound) != 0); fProperties[kPropDisableLOD]->setChecked((obj->getProperties() & plSound::kPropDisableLOD) != 0); fProperties[kPropLooping]->setChecked((obj->getProperties() & plSound::kPropLooping) != 0); fProperties[kPropAutoStart]->setChecked((obj->getProperties() & plSound::kPropAutoStart) != 0); fProperties[kPropLocalOnly]->setChecked((obj->getProperties() & plSound::kPropLocalOnly) != 0); fProperties[kPropLoadOnlyOnCall]->setChecked((obj->getProperties() & plSound::kPropLoadOnlyOnCall) != 0); fProperties[kPropFullyDisabled]->setChecked((obj->getProperties() & plSound::kPropFullyDisabled) != 0); fProperties[kPropDontFade]->setChecked((obj->getProperties() & plSound::kPropDontFade) != 0); fProperties[kPropIncidental]->setChecked((obj->getProperties() & plSound::kPropIncidental) != 0); layProperties->addWidget(fProperties[kPropIs3DSound], 0, 0); layProperties->addWidget(fProperties[kPropDisableLOD], 1, 0); layProperties->addWidget(fProperties[kPropLooping], 2, 0); layProperties->addWidget(fProperties[kPropAutoStart], 0, 1); layProperties->addWidget(fProperties[kPropLocalOnly], 1, 1); layProperties->addWidget(fProperties[kPropLoadOnlyOnCall], 2, 1); layProperties->addWidget(fProperties[kPropFullyDisabled], 0, 2); layProperties->addWidget(fProperties[kPropDontFade], 1, 2); layProperties->addWidget(fProperties[kPropIncidental], 2, 2); QGroupBox* grpFadeIn = new QGroupBox(tr("Fade In Parameters"), this); QGridLayout* layFadeIn = new QGridLayout(grpFadeIn); layFadeIn->setVerticalSpacing(4); layFadeIn->setHorizontalSpacing(8); fFadeInParams.fLength = new QFloatEdit(grpFadeIn); fFadeInParams.fVolStart = new QFloatEdit(grpFadeIn); fFadeInParams.fVolEnd = new QFloatEdit(grpFadeIn); fFadeInParams.fType = new QComboBox(grpFadeIn); fFadeInParams.fCurrTime = new QFloatEdit(grpFadeIn); fFadeInParams.fStopWhenDone = new QCheckBox(tr("Stop When Done"), grpFadeIn); fFadeInParams.fFadeSoftVol = new QCheckBox(tr("Fade Soft Volume"), grpFadeIn); fFadeInParams.fType->addItems(QStringList() << "Linear" << "Logarithmic" << "Exponential"); fFadeInParams.fLength->setValue(obj->getFadeInParams().fLengthInSecs); fFadeInParams.fVolStart->setValue(obj->getFadeInParams().fVolStart); fFadeInParams.fVolEnd->setValue(obj->getFadeInParams().fVolEnd); fFadeInParams.fType->setCurrentIndex(obj->getFadeInParams().fType); fFadeInParams.fCurrTime->setValue(obj->getFadeInParams().fCurrTime); fFadeInParams.fStopWhenDone->setChecked(obj->getFadeInParams().fStopWhenDone); fFadeInParams.fFadeSoftVol->setChecked(obj->getFadeInParams().fFadeSoftVol); layFadeIn->addWidget(new QLabel(tr("Length (Secs):"), grpFadeIn), 0, 0); layFadeIn->addWidget(fFadeInParams.fLength, 0, 1); layFadeIn->addWidget(new QLabel(tr("Volume Start:"), grpFadeIn), 1, 0); layFadeIn->addWidget(fFadeInParams.fVolStart, 1, 1); layFadeIn->addWidget(new QLabel(tr("Volume End:"), grpFadeIn), 2, 0); layFadeIn->addWidget(fFadeInParams.fVolEnd, 2, 1); layFadeIn->addWidget(new QLabel(tr("Type:"), grpFadeIn), 3, 0); layFadeIn->addWidget(fFadeInParams.fType, 3, 1); layFadeIn->addWidget(new QLabel(tr("Current Time:"), grpFadeIn), 4, 0); layFadeIn->addWidget(fFadeInParams.fCurrTime, 4, 1); layFadeIn->addWidget(fFadeInParams.fStopWhenDone, 5, 0, 1, 2); layFadeIn->addWidget(fFadeInParams.fFadeSoftVol, 6, 0, 1, 2); QGroupBox* grpFadeOut = new QGroupBox(tr("Fade Out Parameters"), this); QGridLayout* layFadeOut = new QGridLayout(grpFadeOut); layFadeOut->setVerticalSpacing(4); layFadeOut->setHorizontalSpacing(8); fFadeOutParams.fLength = new QFloatEdit(grpFadeOut); fFadeOutParams.fVolStart = new QFloatEdit(grpFadeOut); fFadeOutParams.fVolEnd = new QFloatEdit(grpFadeOut); fFadeOutParams.fType = new QComboBox(grpFadeOut); fFadeOutParams.fCurrTime = new QFloatEdit(grpFadeOut); fFadeOutParams.fStopWhenDone = new QCheckBox(tr("Stop When Done"), grpFadeOut); fFadeOutParams.fFadeSoftVol = new QCheckBox(tr("Fade Soft Volume"), grpFadeOut); fFadeOutParams.fType->addItems(QStringList() << "Linear" << "Logarithmic" << "Exponential"); fFadeOutParams.fLength->setValue(obj->getFadeOutParams().fLengthInSecs); fFadeOutParams.fVolStart->setValue(obj->getFadeOutParams().fVolStart); fFadeOutParams.fVolEnd->setValue(obj->getFadeOutParams().fVolEnd); fFadeOutParams.fType->setCurrentIndex(obj->getFadeOutParams().fType); fFadeOutParams.fCurrTime->setValue(obj->getFadeOutParams().fCurrTime); fFadeOutParams.fStopWhenDone->setChecked(obj->getFadeOutParams().fStopWhenDone); fFadeOutParams.fFadeSoftVol->setChecked(obj->getFadeOutParams().fFadeSoftVol); layFadeOut->addWidget(new QLabel(tr("Length (Secs):"), grpFadeOut), 0, 0); layFadeOut->addWidget(fFadeOutParams.fLength, 0, 1); layFadeOut->addWidget(new QLabel(tr("Volume Start:"), grpFadeOut), 1, 0); layFadeOut->addWidget(fFadeOutParams.fVolStart, 1, 1); layFadeOut->addWidget(new QLabel(tr("Volume End:"), grpFadeOut), 2, 0); layFadeOut->addWidget(fFadeOutParams.fVolEnd, 2, 1); layFadeOut->addWidget(new QLabel(tr("Type:"), grpFadeOut), 3, 0); layFadeOut->addWidget(fFadeOutParams.fType, 3, 1); layFadeOut->addWidget(new QLabel(tr("Current Time:"), grpFadeOut), 4, 0); layFadeOut->addWidget(fFadeOutParams.fCurrTime, 4, 1); layFadeOut->addWidget(fFadeOutParams.fStopWhenDone, 5, 0, 1, 2); layFadeOut->addWidget(fFadeOutParams.fFadeSoftVol, 6, 0, 1, 2); fSoftRegion = new QCreatableLink(this); fSoftRegion->setKey(obj->getSoftRegion()); fDataBuffer = new QCreatableLink(this); fDataBuffer->setKey(obj->getDataBuffer()); fSoftOcclusionRegion = new QCreatableLink(this); fSoftOcclusionRegion->setKey(obj->getSoftOcclusionRegion()); QWidget* eaxWidget = new QWidget(this); QHBoxLayout* eaxLayout = new QHBoxLayout(eaxWidget); eaxLayout->setContentsMargins(0, 0, 0, 0); eaxLayout->setSpacing(4); QLinkLabel* linkEaxSettings = new QLinkLabel(eaxWidget); linkEaxSettings->setText(tr("EAX Settings")); eaxLayout->addWidget(linkEaxSettings); eaxLayout->addStretch(); connect(linkEaxSettings, SIGNAL(activated()), this, SLOT(editEaxSettings())); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); layout->addWidget(fSynchObjLink, 0, 0, 1, 4); layout->addWidget(new QLabel(tr("Time:"), this), 1, 0); layout->addWidget(fTime, 1, 1); layout->addWidget(new QLabel(tr("Max Falloff:"), this), 2, 0); layout->addWidget(fMaxFalloff, 2, 1); layout->addWidget(new QLabel(tr("Min Falloff:"), this), 3, 0); layout->addWidget(fMinFalloff, 3, 1); layout->addWidget(new QLabel(tr("Current Vol:"), this), 4, 0); layout->addWidget(fCurrVolume, 4, 1); layout->addWidget(new QLabel(tr("Desired Vol:"), this), 5, 0); layout->addWidget(fDesiredVolume, 5, 1); layout->addWidget(new QLabel(tr("Type:"), this), 6, 0); layout->addWidget(fSoundType, 6, 1); layout->addWidget(new QLabel(tr("Outer Volume:"), this), 1, 2); layout->addWidget(fOuterVol, 1, 3); layout->addWidget(new QLabel(tr("Inner Cone:"), this), 2, 2); layout->addWidget(fInnerCone, 2, 3); layout->addWidget(new QLabel(tr("Outer Cone:"), this), 3, 2); layout->addWidget(fOuterCone, 3, 3); layout->addWidget(new QLabel(tr("Faded Volume:"), this), 4, 2); layout->addWidget(fFadedVolume, 4, 3); layout->addWidget(new QLabel(tr("Priority:"), this), 5, 2); layout->addWidget(fPriority, 5, 3); layout->addWidget(fPlaying, 6, 2, 1, 2, Qt::AlignRight); layout->addWidget(new QLabel(tr("Subtitle ID:"), this), 7, 0); layout->addWidget(fSubtitleId, 7, 1, 1, 3); layout->addWidget(grpProperties, 8, 0, 1, 4); layout->addWidget(grpFadeIn, 9, 0, 1, 2); layout->addWidget(grpFadeOut, 9, 2, 1, 2); layout->addWidget(new QLabel(tr("Soft Region:"), this), 10, 0); layout->addWidget(fSoftRegion, 10, 1, 1, 3); layout->addWidget(new QLabel(tr("Data Buffer:"), this), 11, 0); layout->addWidget(fDataBuffer, 11, 1, 1, 3); layout->addWidget(new QLabel(tr("Soft Occlusion:"), this), 12, 0); layout->addWidget(fSoftOcclusionRegion, 12, 1, 1, 3); layout->addWidget(eaxWidget, 13, 0, 1, 4); connect(fSoftRegion, SIGNAL(addObject()), this, SLOT(setSoftRegion())); connect(fSoftRegion, SIGNAL(delObject()), this, SLOT(unsetSoftRegion())); connect(fDataBuffer, SIGNAL(addObject()), this, SLOT(setDataBuffer())); connect(fDataBuffer, SIGNAL(delObject()), this, SLOT(unsetDataBuffer())); connect(fSoftOcclusionRegion, SIGNAL(addObject()), this, SLOT(setSoftOcclusionRegion())); connect(fSoftOcclusionRegion, SIGNAL(delObject()), this, SLOT(unsetSoftOcclusionRegion())); }
void Controller::input() { // reset player's important key presses if (p) { p->inputs.F = false; p->inputs.RClick = false; } // EVENT-BASED INPUT sf::Event e; while (view->window.pollEvent(e)) { switch (e.type) { case sf::Event::Closed: view->window.close(); break; case sf::Event::GainedFocus: inFocus = true; Global::INFOCUS = true; break; case sf::Event::LostFocus: inFocus = false; Global::INFOCUS = false; break; case sf::Event::KeyReleased: if (e.key.code == sf::Keyboard::Escape) view->window.close(); break; case sf::Event::KeyPressed: if (inFocus && p && e.key.code == sf::Keyboard::F) p->inputs.F = true; break; case sf::Event::Resized: view->WINDOW_WIDTH = e.size.width; view->WINDOW_HEIGHT = e.size.height; Global::middleWindowCoords = sf::Vector2i(e.size.width / 2, e.size.height / 2); break; case sf::Event::MouseButtonPressed: if (inFocus && view->menu->processClick(e.mouseButton.x, e.mouseButton.y)) break; if (inFocus && p && e.mouseButton.button == sf::Mouse::Right) p->inputs.RClick = true; break; } if (!view->window.isOpen()) break; } // REAL-TIME INPUT // Set the static mouse coordinates Global::mouseWindowCoords = sf::Mouse::getPosition(view->window); // Wall loading if (Global::DEBUG) { if (sf::Keyboard::isKeyPressed(sf::Keyboard::R)) { // Delete old objects for (auto it = gameObjects.begin(); it != gameObjects.end(); ++it) { if (*it != NULL && (*it)->getTag() == sf::String("Obj_T")) { delObject(*it); } } // Add new walls std::vector<GameObject*> ws = loadObjects(sf::String("txts/walls.txt")); for (auto it = ws.begin(); it != ws.end(); ++it) { addObjectBeginning(*it); } } } }
/* QGUIDialogMod */ QGUIDialogMod::QGUIDialogMod(plCreatable* pCre, QWidget* parent) : QCreatable(pCre, kGUIDialogMod, parent) { pfGUIDialogMod* dlg = pfGUIDialogMod::Convert(fCreatable); fSynchObjLink = new QCreatableLink(this, false); fSynchObjLink->setText(tr("Synch Flags")); fSynchObjLink->setCreatable(dlg); fSynchObjLink->setForceType(kSynchedObject); QGroupBox* grpFlags = new QGroupBox(tr("Flags"), this); fModFlagModal = new QCheckBox(tr("Modal"), grpFlags); QGridLayout* flagLayout = new QGridLayout(grpFlags); flagLayout->setContentsMargins(8, 8, 8, 8); flagLayout->addWidget(fModFlagModal, 0, 0); fModFlagModal->setChecked(dlg->getFlag(pfGUIDialogMod::kModal)); QGroupBox* colorSchemeGrp = new QGroupBox(tr("Color Scheme"), this); fColorScheme = new QGUIColorScheme(colorSchemeGrp); fColorScheme->setColorScheme(&dlg->getColorScheme()); QGridLayout* skinLayout = new QGridLayout(colorSchemeGrp); skinLayout->setContentsMargins(0, 0, 0, 0); skinLayout->addWidget(fColorScheme, 0, 0); fName = new QLineEdit(this); fName->setText(~dlg->getName()); fTagID = new QIntEdit(this); fTagID->setRange(-0x80000000, 0x7FFFFFFF); fTagID->setValue(dlg->getTagID()); fVersion = new QIntEdit(this); fVersion->setRange(-0x80000000, 0x7FFFFFFF); fVersion->setValue(dlg->getVersion()); fControls = new QKeyList(dlg->getKey(), this); for (size_t i=0; i<dlg->getControls().size(); i++) fControls->addKey(dlg->getControls()[i]); fRenderMod = new QCreatableLink(this); fRenderMod->setKey(dlg->getRenderMod()); fRenderMod->setText(dlg->getRenderMod().Exists() ? ~dlg->getRenderMod()->getName() : "(None)"); fProcReceiver = new QCreatableLink(this); fProcReceiver->setKey(dlg->getProcReceiver()); fProcReceiver->setText(dlg->getProcReceiver().Exists() ? ~dlg->getProcReceiver()->getName() : "(None)"); fSceneNode = new QCreatableLink(this); fSceneNode->setKey(dlg->getSceneNode()); fSceneNode->setText(dlg->getSceneNode().Exists() ? ~dlg->getSceneNode()->getName() : "(None)"); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); layout->addWidget(fSynchObjLink, 0, 0, 1, 5); layout->addWidget(grpFlags, 1, 0, 1, 5); layout->addWidget(colorSchemeGrp, 2, 0, 1, 5); layout->addWidget(new QLabel(tr("Name:"), this), 3, 0); layout->addWidget(fName, 3, 1, 1, 4); layout->addWidget(new QLabel(tr("Tag ID:"), this), 4, 0); layout->addWidget(fTagID, 4, 1); layout->addWidget(new QLabel(tr("Version:"), this), 4, 3); layout->addWidget(fVersion, 4, 4); layout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum), 4, 2); layout->addWidget(new QLabel(tr("Controls:"), this), 5, 0, 1, 5); layout->addWidget(fControls, 6, 0, 1, 5); layout->addWidget(new QLabel(tr("Render Mod:"), this), 7, 0); layout->addWidget(fRenderMod, 7, 1, 1, 4); layout->addWidget(new QLabel(tr("Proc Receiver:"), this), 8, 0); layout->addWidget(fProcReceiver, 8, 1, 1, 4); layout->addWidget(new QLabel(tr("Scene Node:"), this), 9, 0); layout->addWidget(fSceneNode, 9, 1, 1, 4); connect(fRenderMod, SIGNAL(addObject()), this, SLOT(setRenderMod())); connect(fRenderMod, SIGNAL(delObject()), this, SLOT(unsetRenderMod())); connect(fProcReceiver, SIGNAL(addObject()), this, SLOT(setProcReceiver())); connect(fProcReceiver, SIGNAL(delObject()), this, SLOT(unsetProcReceiver())); connect(fSceneNode, SIGNAL(addObject()), this, SLOT(setSceneNode())); connect(fSceneNode, SIGNAL(delObject()), this, SLOT(unsetSceneNode())); fControls->adjustColumns(); }
void QControllerLink::menuRequested() { QMenu menu(this); QMenu* m_createTypes = new QMenu(tr("Create..."), &menu); QAction* newEase = m_createTypes->addAction(tr("Ease Controller")); QAction* newMat33 = m_createTypes->addAction(tr("Matrix33 Controller")); QAction* newMat44 = m_createTypes->addAction(tr("Matrix44 Controller")); QAction* newPoint3 = m_createTypes->addAction(tr("Point3 Controller")); QAction* newQuat = m_createTypes->addAction(tr("Quat Controller")); QAction* newScalar = m_createTypes->addAction(tr("Scalar Controller")); QAction* newScaleValue = m_createTypes->addAction(tr("Scale Value Controller")); m_createTypes->addSeparator(); QAction* newSimpleScale = m_createTypes->addAction(tr("Simple Scale Controller")); QAction* newSimpleRot = m_createTypes->addAction(tr("Simple Rot Controller")); QAction* newCompoundRot = m_createTypes->addAction(tr("Compound Rot Controller")); QAction* newSimplePos = m_createTypes->addAction(tr("Simple Pos Controller")); QAction* newCompoundPos = m_createTypes->addAction(tr("Compound Pos Controller")); m_createTypes->addSeparator(); QAction* newTM = m_createTypes->addAction(tr("TM Controller")); QAction* newCompound = m_createTypes->addAction(tr("Compound Controller")); QAction* newLeaf = m_createTypes->addAction(tr("MOUL/Myst 5 Controller")); menu.addMenu(m_createTypes); QAction* delObjItem = menu.addAction(tr("Delete")); if (fCreatable == NULL) delObjItem->setEnabled(false); QPoint pos = fEditLabel->mapToGlobal(QPoint(0, fEditLabel->height())); QAction* sel = menu.exec(pos); if (sel == delObjItem) emit delObject(); else if (sel == newEase) emit createObject(kEaseController); else if (sel == newMat33) emit createObject(kMatrix33Controller); else if (sel == newMat44) emit createObject(kMatrix44Controller); else if (sel == newPoint3) emit createObject(kPoint3Controller); else if (sel == newQuat) emit createObject(kQuatController); else if (sel == newScalar) emit createObject(kScalarController); else if (sel == newScaleValue) emit createObject(kScaleValueController); else if (sel == newSimpleScale) emit createObject(kSimpleScaleController); else if (sel == newSimpleRot) emit createObject(kSimpleRotController); else if (sel == newCompoundRot) emit createObject(kCompoundRotController); else if (sel == newSimplePos) emit createObject(kSimplePosController); else if (sel == newCompoundPos) emit createObject(kCompoundPosController); else if (sel == newTM) emit createObject(kTMController); else if (sel == newCompound) emit createObject(kCompoundController); else if (sel == newLeaf) emit createObject(kLeafController); }
/* QGUISkin */ QGUISkin::QGUISkin(plCreatable* pCre, QWidget* parent) : QCreatable(pCre, kGUISkin, parent), fCurElement(-1) { pfGUISkin* skin = pfGUISkin::Convert(fCreatable); fItemMargin = new QIntEdit(this); fItemMargin->setRange(0, 0xFFFF); fItemMargin->setValue(skin->getItemMargin()); fBorderMargin = new QIntEdit(this); fBorderMargin->setRange(0, 0xFFFF); fBorderMargin->setValue(skin->getBorderMargin()); fTexture = new QCreatableLink(this); fTexture->setKey(skin->getTexture()); fElements = new QComboBox(this); fElements->addItems(QStringList() << tr("Upper-Left Corner") << tr("Top Span") << tr("Upper-Right Corner") << tr("Right Span") << tr("Lower-Right Corner") << tr("Bottom Span") << tr("Lower-Left Corner") << tr("Left Span") << tr("Middle Fill") << tr("Selection Fill") << tr("Submenu Arrow") << tr("Selected Submenu Arrow") << tr("Tree Button Closed") << tr("Tree Button Open")); QGroupBox* grpElement = new QGroupBox(tr("Element Texture Source"), this); fX = new QIntEdit(grpElement); fX->setRange(0, 0xFFFF); fY = new QIntEdit(grpElement); fY->setRange(0, 0xFFFF); fWidth = new QIntEdit(grpElement); fWidth->setRange(0, 0xFFFF); fHeight = new QIntEdit(grpElement); fHeight->setRange(0, 0xFFFF); setElement(0); QGridLayout* layElement = new QGridLayout(grpElement); layElement->setContentsMargins(8, 8, 8, 8); layElement->setHorizontalSpacing(4); layElement->setVerticalSpacing(4); layElement->addWidget(new QLabel("X", grpElement), 0, 1, 1, 1, Qt::AlignCenter); layElement->addWidget(new QLabel("Y", grpElement), 0, 2, 1, 1, Qt::AlignCenter); layElement->addWidget(new QLabel("Position:", grpElement), 1, 0); layElement->addWidget(new QLabel("Size:", grpElement), 2, 0); layElement->addWidget(fX, 1, 1); layElement->addWidget(fY, 1, 2); layElement->addWidget(fWidth, 2, 1); layElement->addWidget(fHeight, 2, 2); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); layout->addWidget(new QLabel(tr("Item Margin:"), this), 0, 0); layout->addWidget(fItemMargin, 0, 1); layout->addWidget(new QLabel(tr("Border:"), this), 1, 0); layout->addWidget(fBorderMargin, 1, 1); layout->addWidget(new QLabel(tr("Texture:"), this), 2, 0); layout->addWidget(fTexture, 2, 1); layout->addItem(new QSpacerItem(0, 16, QSizePolicy::Minimum, QSizePolicy::Minimum), 3, 0, 1, 2); layout->addWidget(new QLabel(tr("Element:"), this), 4, 0); layout->addWidget(fElements, 4, 1); layout->addWidget(grpElement, 5, 0, 1, 2); connect(fTexture, SIGNAL(addObject()), this, SLOT(setTexture())); connect(fTexture, SIGNAL(delObject()), this, SLOT(unsetTexture())); connect(fElements, SIGNAL(currentIndexChanged(int)), this, SLOT(setElement(int))); }