void InitGame(Game* game) { NewApple(game); NewMap(game); NewSnake(game); NewText(game); NewConsts(game); game->state = STARTGAME; }
void Minigame::NewGame() { GameState = Minigame::WAITING; Level = 0; lmState = 0; SetupEnv(); NewMap(); }
static int yp_yajl_start_map(void *o) { JsonParserCtx *ctx = static_cast<JsonParserCtx*>(o); JsonEl *map = NewMap(); if (ctx->nestingChain) jp_add_element(ctx, map); return jp_nesting_chain_head_push(ctx, map); }
void Minigame::WinningThink() { lmState = Engine()->GetLmDevice()->LMRefresh(); if (lmState == 2) { NewMap(); SetState(GAMESTATE::WAITING); Engine()->GetLmDevice()->Reset(); } }
void EpetraMultiVector::replaceMap(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& map) { int err = 0; if (!map.is_null()) { err = this->getEpetra_MultiVector()->ReplaceMap(toEpetra(map)); } else { // Replace map with a dummy map to avoid potential hangs later Epetra_SerialComm SComm; Epetra_Map NewMap(vec_->MyLength(), vec_->Map().IndexBase(), SComm); err = this->getEpetra_MultiVector()->ReplaceMap(NewMap); } TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra."); }
Minigame::Minigame() { GameState = Minigame::WAITING; Level = 0; lmState = 0; SetupEnv(); NewMap(); // Load default textures Engine()->GetGlDevice()->LoadTexture("ball.bmp", "ball", false); Engine()->GetGlDevice()->LoadTexture("hole.bmp", "hole", false); Engine()->GetGlDevice()->LoadTexture("block.bmp", "block", false); Engine()->GetGlDevice()->LoadTexture("you_suck.bmp", "you_suck", false); Engine()->GetGlDevice()->LoadTexture("you_rock.bmp", "you_rock", false); Engine()->GetGlDevice()->LoadTexture("background.bmp", "background", false); }
void Init_All() { Init_Graphics(); InitSpriteList(); Init_Audio(); InitSoundList(); atexit(CleanUpAll); LoadFonts(); InitMessages(); LoadMouse(Cyan,Gold,DarkViolet); InitEntityList(); ResetAllParticles(); DrawSplashScreen(); LoadContent(); NewMap(32, 48,0,15); DrawMap(); }
void MapCreater::NewArea(STRARR& cmd) { if (cmd.size()>1) { if(!CheckDirExist(cmd[0])) NewMap(STRARR(cmd.begin(), cmd.begin()+1)); string mappath = _working_dir + "/" + cmd[0]; ConfigFile mapdata(mappath + MAPDATA); mapdata.Add(string("area_") + cmd[1], cmd[1]); string areapath = mappath + "/" + cmd[1]; CheckFileExist(areapath + AREADATA); cout<<"Area ["<<cmd[1]<<"] created in ["<<cmd[0]<<"]\n"; } else cout<<"newarea (mapname) (areaname)\n"; }
void Designer::OnControlEvent(Control* control) { if(control == StartPanel->NewMapButton) { NewMap(); } else if(control == StartPanel->CancelButton) { OnExit(); } else if(control == StartPanel->LoadMapButton) { LoadGame(""); MainCamera = new Camera(MainMap, Renderer, 800, 600); MainCamera->ShowSelectedTile = true; MainCamera->ControlRect.x = 0; MainCamera->ControlRect.y = 0; ChildControls.insert(ChildControls.begin(), MainCamera); selectedTile.Height = 0; selectedTile.TileID = 3; selectedTile.TileSubID = 0; StartPanel->Visible = false; FocusedControl = MainCamera; TileSelector->Visible = true; TabMenu->Visible = true; DeleteCB->Visible = true; PlayerCB->Visible = true; TickingCB->Visible = true; Paused = false; } else if(control == EntityList) { UpdateEditMode(ENTITY); } else if(control == TileEntityList) { UpdateEditMode(TILEENTITY); } else if(control == TabMenu) { if(TabMenu->SelectedTab == -1) { UpdateEditMode(TILE); } } else if(control == DeleteCB) { if(DeleteCB->Checked) { UpdateEditMode(DELETE); } else { UpdateEditMode(TILE); } } else if(control == PlayerCB) { if(PlayerCB->Checked) { UpdateEditMode(PLAYER); } else { UpdateEditMode(TILE); } } };
/** * Constructs and displays the main UI for FortEdit * @param parent QWidget parent, typically null */ CFortEdit::CFortEdit(QWidget *parent) : QMainWindow(parent), DUi(new Ui::FortEdit), DActiveTool(0), DTerrainTool(0), DTerritoryTool(0), DObjectTool(0), DSelectTool(0), DSoundHandler(this), DLuaEditor(0) { DUi->setupUi(this); DGraphicsScene = new QGraphicsScene(); DUi->GraphicsView->setMouseTracking(true); DUi->GraphicsView->setScene(DGraphicsScene); DUi->GraphicsView->setUpdatesEnabled(true); // Ui connectivity / setup QObject::connect(DUi->ActionOpen, SIGNAL(triggered()), this, SLOT(OpenMap())); QObject::connect(DUi->ActionSaveAs, SIGNAL(triggered()), this, SLOT(SaveMapAs())); QObject::connect(DUi->ActionSave, SIGNAL(triggered()), this, SLOT(SaveMap())); QObject::connect(DUi->ActionNew, SIGNAL(triggered()), this, SLOT(NewMap())); QObject::connect(DUi->MapNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(UpdateSceneTitle(QString))); QObject::connect(DUi->MapWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateSceneWidth(int))); QObject::connect(DUi->MapHeightSpinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateSceneHeight(int))); QObject::connect(DUi->ObjectVisibilityToggle, SIGNAL(toggled(bool)), this, SLOT(UpdateSceneObjectVisibility(bool))); QObject::connect(DUi->GridCheckBox, SIGNAL(toggled(bool)), this, SLOT(UpdateSceneGridVisibility(bool))); QObject::connect(DUi->DisplayModeCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(UpdateSceneDisplayMode(QString))); QObject::connect(DUi->ToolTerrain, SIGNAL(clicked()), this, SLOT(UpdateActiveTool())); QObject::connect(DUi->ToolTerritory, SIGNAL(clicked()), this, SLOT(UpdateActiveTool())); QObject::connect(DUi->ToolObject, SIGNAL(clicked()), this, SLOT(UpdateActiveTool())); QObject::connect(DUi->ToolSelect, SIGNAL(clicked()), this, SLOT(UpdateActiveTool())); QObject::connect(DUi->AudioOptions, SIGNAL(clicked()), this, SLOT(UpdateActiveTool())); QObject::connect(DUi->ActionSaveSoundSet, SIGNAL(triggered()), this, SLOT(SaveSoundSet())); QObject::connect(DUi->ActionLoadSoundSet, SIGNAL(triggered()), &DSoundHandler, SLOT(LoadSoundSet())); QObject::connect(DUi->LuaEditorButton, SIGNAL(clicked()), this, SLOT(ToggleLuaEditor())); QObject::connect(DUi->PlayButton, SIGNAL(clicked()), this, SLOT(InvokeEngineDialog())); // Invocation dialog connectivity DInvocationDialog = new QDialog; DInvocationUi.setupUi(DInvocationDialog); LoadSettings(); DInvocationUi.executablePath->setText(DEnginePath); DInvocationUi.modeCombo->setCurrentIndex(DInvocationMode); DInvocationUi.aiCombo->setCurrentIndex(DInvocationDifficulty); DInvocationUi.castleIndexCombo->setCurrentIndex(DInvocationIndex); DInvocationUi.windCheck->setChecked(DInvocationWind); QObject::connect(DInvocationUi.locateButton, SIGNAL(clicked()), this, SLOT(LocateEngine())); QObject::connect(DInvocationUi.modeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateInvocationConfig())); QObject::connect(DInvocationUi.aiCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateInvocationConfig())); QObject::connect(DInvocationUi.castleIndexCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateInvocationConfig())); QObject::connect(DInvocationUi.windCheck, SIGNAL(stateChanged(int)), this, SLOT(UpdateInvocationConfig())); QObject::connect(DInvocationUi.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(InvokeEngine(QAbstractButton*))); // TODO: Make sure this order is consistent... This is pretty bad as it stands DUi->PropertyPageStack->addWidget(DTerrainTool.GetPropertiesWidget()); DUi->PropertyPageStack->addWidget(DTerritoryTool.GetPropertiesWidget()); DUi->PropertyPageStack->addWidget(DSelectTool.GetPropertiesWidget()); DUi->PropertyPageStack->addWidget(DSoundHandler.GetPropertiesWidget()); DUi->PropertyPageStack->addWidget(DObjectTool.GetPropertiesWidget()); DScene = new CScene(":/default-maps/res/new.map", DGraphicsScene, &DSoundHandler); DUi->ActionSave->setEnabled(false); UpdateUi(); }