Example #1
0
void Terrain::resetMap()
{
	if (_runningMapList.size() > 0)
	{
		float cacheScale = GameplayModel::sharedModel()->getCacheScale();
		//float scale = 1;//GameplayModel::sharedModel()->getTerrainScale();
		MyMap* firstMap = _runningMapList.front();
		if((firstMap->_map->getPositionX() + TMX_WIDTH(firstMap->_map) + getPositionX() ) < ( - _sceenSize.width *CONST_OUTSIZDE_SCREEN / cacheScale ))
		{/*左边地图右半滑出屏幕8分之区域**/
			removeMap(firstMap);
			_runningMapList.remove(firstMap);
			_freeMapList.push_back(firstMap);
		}
		
		MyMap* lastMap = _runningMapList.back();
		if ( (lastMap->_map->getPositionX() + TMX_WIDTH(lastMap->_map) + getPositionX() ) < ( _sceenSize.width * (CONST_OUTSIZDE_SCREEN+1) / cacheScale ))
		{/*左边地图左半进入屏幕8分之区域**/
			createMap();
		}
// 		CCPoint firstMapWorldPos = convertToWorldSpace(ccp(firstMap->_map->getPositionX() + TMX_WIDTH(firstMap->_map),firstMap->_map->getPositionY()));
// 		if (firstMapWorldPos.x < ( - _sceenSize.width *CONST_OUTSIZDE_SCREEN ))
// 		{/*左边地图右半滑出屏幕8分之区域**/
// 			removeMap(firstMap);
// 			_runningMapList.remove(firstMap);
// 			_freeMapList.push_back(firstMap);
// 		}
// 
// 		MyMap* lastMap = _runningMapList.back();
// 		CCPoint lastMapWorldPos = convertToWorldSpace(ccp(lastMap->_map->getPositionX() + TMX_WIDTH(lastMap->_map),lastMap->_map->getPositionY()));
// 		if ( lastMapWorldPos.x < ( _sceenSize.width * (CONST_OUTSIZDE_SCREEN+1) ))
// 		{/*左边地图左半进入屏幕8分之区域**/
// 			createMap();
// 		}
	}
}
Example #2
0
/* -------------------------------------------------------------------------------------------
 *
 * ------------------------------------------------------------------------------------------- */
void DMWindow::createDockWindows() {

  // maps
  this->mapDock = new QDockWidget(tr("Maps"),this);
  this->mapList = new DockListWidget(this->mapDock);
  this->mapDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  this->mapDock->setObjectName("map-dock");    
  this->mapDock->setWidget(this->mapList);
  this->mapList->addButton("Add map",this, SLOT(addMap()), false);
  this->mapList->addButton("Remove map", this, SLOT(removeMap()), false);
  this->mapList->addButton("Show Map on Table", this, SLOT(showMapOnTable()), true);
  this->mapList->addButton("Show Map in Popup", this, SLOT(showMapOnPopup()), false);
  this->addDockWidget(Qt::LeftDockWidgetArea, this->mapDock);
  this->viewMenu->addAction(this->mapDock->toggleViewAction());

  // artifacts -- things like letters, artifacts, etc can be shown to the players
  this->artifactDock = new QDockWidget(tr("Artifacts"),this);
  this->assetList = new DockListWidget(this->artifactDock);
  this->artifactDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  this->artifactDock->setObjectName("artifact-dock");
  this->artifactDock->setWidget(this->assetList);
  this->addDockWidget(Qt::LeftDockWidgetArea, this->artifactDock);
  this->viewMenu->addAction(this->artifactDock->toggleViewAction());

  // initiative
  this->initiativeDock = new QDockWidget(tr("Initiative"),this);
  this->initiativeDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  this->initiativeDock->setObjectName("initiative-dock");
  this->initiativeList = new DockListWidget(this->initiativeDock);
  this->initiativeDock->setWidget(this->initiativeList);
  this->addDockWidget(Qt::LeftDockWidgetArea, this->initiativeDock);
  this->viewMenu->addAction(this->initiativeDock->toggleViewAction());

  // player characters
  this->pcDock = new QDockWidget(tr("PCs"),this);
  this->pcList = new DockListWidget(this->pcDock);
  this->pcDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  this->pcDock->setObjectName("player-character-dock");  
  this->pcDock->setWidget(this->pcList);
  this->pcList->addButton("Add Player Character",this,SLOT(addPc()), false);
  this->pcList->addButton("Remove Player Character",this,SLOT(removePc()), false);
  this->addDockWidget(Qt::RightDockWidgetArea, this->pcDock);
  this->viewMenu->addAction(this->pcDock->toggleViewAction());

  // non player characters
  this->npcDock = new QDockWidget(tr("NPCs"),this);
  this->npcDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  this->npcDock->setObjectName("non-player-character-dock");
  this->npcList = new DockListWidget(this->npcDock);
  this->npcDock->setWidget(this->npcList);
  this->addDockWidget(Qt::RightDockWidgetArea, this->npcDock);
  this->viewMenu->addAction(this->npcDock->toggleViewAction());

  // monsters
  this->monsterDock = new QDockWidget(tr("Monsters"),this);
  this->monsterDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  this->monsterDock->setObjectName("monster-dock");
  this->monsterList = new DockListWidget(this->monsterDock);
  this->monsterDock->setWidget(this->monsterList);
  this->addDockWidget(Qt::RightDockWidgetArea, this->monsterDock);
  this->viewMenu->addAction(this->monsterDock->toggleViewAction());

}