void Initialize() { std::cout << "Starting Initialization" << std::endl; /* Variable Initialization */ modelChosen = THIRTEENBOX; spotLightChosen = NOSPOTLIGHT; planeEnabled = true; /* Model Initialization */ camera = viewglut_create(1.0, 100.0); p = plane_create(20); box = obj_create("thirteen-box.obj"); troll = obj_create("trolluvd1.obj"); //glEnable(GL_TEXTURE_2D); glEnable(GL_DEPTH_TEST); glEnable(GL_LESS); createMenuItems(); boxloader = new ShaderLoader("thirteenBoxVertexShader2.glsl", "thirteenBoxFragmentShader2.glsl"); boxloader->initializeTextures("thirteen-diffuse.png"); boxloader->initializeTextures("thirteen-normal.png"); //boxloader->initializeTextures("thirteen-specular.png"); spotlight1loader = new ShaderLoader("spotlightVertexShader.glsl", "spotlightFragmentShader.glsl"); spotlight1loader->initializeTextures("spotlight2.png"); std::cout << "Initialization Finished" << std::endl; }
void LayerContextMenu::populate() { _sortedLayers.clear(); // Populate the map with all layer names and IDs scene::getLayerSystem().foreachLayer([&](int layerId, const std::string& layerName) { _sortedLayers.insert(SortedLayerMap::value_type(layerName, layerId)); }); // Clear all existing items for (const MenuItemIdToLayerMapping::value_type& i : _menuItemMapping) { wxMenu* parentMenu = GetParent(); #ifdef __WXGTK__ // wxMSW and wxGTK are doing it differently (see comments in createMenuItems() below) parentMenu = this; #endif if (parentMenu != nullptr) { parentMenu->Disconnect(i.first, wxEVT_MENU, wxCommandEventHandler(LayerContextMenu::onActivate), nullptr, this); } Delete(i.first); } _menuItemMapping.clear(); // Create the menu items createMenuItems(); }
bool DoNothingPlugin::initialize(const QStringList& args, QString *errMsg) { // The initialize() method is called when Qt Creator wants the plugin to initialize itself. This function is ideally used to initialize the internal state of the plugin and register actions/objects with Qt Creator. // The function is called after all the dependencies of this plugin have been loaded. Q_UNUSED(args); Q_UNUSED(errMsg); createMenuItems(); createMenus(); // Return true signifying that the initialization was successful. // If the initialization was unsuccessful (for some wired reason); the errMsg string should be set to a human readable error message. return true; }
bool MenusLayer::init() { bool bRet = false; do { CC_BREAK_IF(!Layer::init()); createMenuItems(); bRet = true; } while (0); return bRet; }
/*! * \brief Creates a navigation menu for the DR/RR property window. * * \param folder The folder that i currently active. * \param activeMsgId Message ID of the active message * \param msgType The type of the active message. See #MmsFileType. * \param forwardLock TRUE if the current message has forward lock, otherwise * FALSE. * \return TRUE if the operation was successful, otherwise FALSE. *****************************************************************************/ MSF_BOOL meaCreateMvPropNavMenu(MeaFolder folder, MmsMsgId activeMsgId, MmsFileType msgType, MSF_BOOL forwardLock) { extern MSF_BOOL mmcIsJSRMsg(MSF_UINT32 msgId); /* Create navigation menu */ if (!meaCreatePropNavMenu(0, navMenuSignalConverter)) { meaRemovePropNavMenu(); return FALSE; } else if (!createMenuItems(folder, activeMsgId, msgType, forwardLock, mmcIsJSRMsg(activeMsgId))) { meaRemovePropNavMenu(); return FALSE; } else if (!meaShowPropNavMenu()) { meaRemovePropNavMenu(); return FALSE; } return TRUE; }
void SeaScene::setupMap(int ghosts, int rocks, int octopuses, int octopusSpeed) { //empty the map clear(); setItemPointersNull(); createMenuItems(); createAboutBoxItems(); createSelectLevelsetFromListItems(); createVictoryItems(); createLevelCompletedItems(); //empty the list of moving items movingItems_.clear(); //empty the list of free slots freeTiles_.clear(); //fill the list of free slots int numberOfXTiles = width() / 40; int numberOfYTiles = height() /40; // qDebug() << numberOfXTiles << " slots in x direction"; // qDebug() << numberOfYTiles << " slots in y rirection"; for (int i = 0; i < numberOfXTiles; i++ ) { for (int j = 0; j < numberOfYTiles; j++) { freeTiles_.append(QPointF(i*40,j*40)); } } //spread the rocks for (int i = 0; i < rocks; i++) { QPointF * pPosition = findRandomFreeSlot(); //If there was no room no point to continue if (pPosition == NULL) break; QPixmap rockPixmap (":/pix/kari.png"); QGraphicsPixmapItem * pRock = addPixmap(rockPixmap); pRock->setData(0,"rock"); pRock->setPos(*pPosition); delete pPosition; } //spread the ghosts ghostsLeft_ = ghosts; spreadGhosts(ghosts); //spread the octopuses QList <Octopus*> octopusList; for (int i=0; i < octopuses; i++) { QPointF * pPosition = findRandomFreeSlot(); //If there was no room no point to continue if (pPosition == NULL) break; QPixmap octopusPixmap (":/pix/tursas.png"); Octopus * pOctopus = new Octopus(octopusPixmap,octopusSpeed); pOctopus->setData(0,"octopus"); pOctopus->setPos(*pPosition); addItem(pOctopus); pOctopus->startMoving(); movingItems_.append(pOctopus); connect(this,SIGNAL(pauseOn()),pOctopus,SLOT(stopMoving())); connect(this,SIGNAL(pauseOff()),pOctopus,SLOT(startMoving())); octopusList.append(pOctopus); delete pPosition; } //place the ship QPointF * pPosition = findRandomFreeSlot(); if (pPosition == NULL) { // Game cannot begin without a free position for ship, so give an error message and return QMessageBox::critical(NULL,"Error! Too many objects on screen","No free space to place the ship. The game cannot start. Please choose another level."); return; } QList<QPixmap> shipImages; shipImages.append(QPixmap(":/pix/laiva.png")); shipImages.append(QPixmap(":/pix/laiva_1aave.png")); shipImages.append(QPixmap(":/pix/laiva_2aave.png")); shipImages.append(QPixmap(":/pix/laiva_3aave.png")); shipImages.append(QPixmap(":/pix/laiva_4aave.png")); shipImages.append(QPixmap(":/pix/laiva_5aave.png")); shipImages.append(QPixmap(":/pix/laiva_6aave.png")); shipImages.append(QPixmap(":/pix/laiva_7aave.png")); shipImages.append(QPixmap(":/pix/laiva_8aave.png")); shipImages.append(QPixmap(":/pix/laiva_9aave.png")); shipImages.append(QPixmap(":/pix/laiva_10aave.png")); Ship * pShip = new Ship (shipImages); pShip->setData(0,"ship"); pShip->setPos(*pPosition); addItem(pShip); connect(pShip,SIGNAL(pickingGhost(QGraphicsItem*)),this, SLOT(removeGhost(QGraphicsItem*)) ); connect(pShip,SIGNAL(droppingGhosts(int)),this,SLOT(ghostsDropped(int))); connect(this,SIGNAL(vibrationActivated(bool)),pShip,SLOT(setVibrationActivate(bool))); pShip->startMoving(); movingItems_.append(pShip); connect(this,SIGNAL(pauseOn()),pShip,SLOT(stopMoving())); connect(this,SIGNAL(pauseOff()),pShip,SLOT(startMoving())); foreach (Octopus* pOctopus, octopusList) { connect(pOctopus,SIGNAL(droppingGhosts()),pShip,SLOT(dropAllGhosts())); }