mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
loading the map after loading the assets
This commit is contained in:
@@ -17,7 +17,7 @@ gui = {
|
|||||||
guiType = GuiType.GUI_RECTANGLE,
|
guiType = GuiType.GUI_RECTANGLE,
|
||||||
pos = {x = initPos.x, y = initPos.y + Size.y, z = initPos.z},
|
pos = {x = initPos.x, y = initPos.y + Size.y, z = initPos.z},
|
||||||
size = Size,
|
size = Size,
|
||||||
color = {x = 0, y = 0, z = 0, w = 1}
|
color = {x = .3, y = .3, z = .3, w = 1}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
guiType = GuiType.GUI_RECTANGLE,
|
guiType = GuiType.GUI_RECTANGLE,
|
||||||
|
|||||||
Vendored
+1
-1
Submodule external/vb01 updated: 044828c7cf...89389589de
+5
-2
@@ -48,18 +48,21 @@ namespace battleship{
|
|||||||
Console::execute(wstringToString(textbox->getText()));
|
Console::execute(wstringToString(textbox->getText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
InGameAppState::InGameAppState() : AbstractAppState(
|
InGameAppState::InGameAppState(std::string mn) : AbstractAppState(
|
||||||
AppStateType::IN_GAME_STATE,
|
AppStateType::IN_GAME_STATE,
|
||||||
configData::calcSumBinds(AppStateType::IN_GAME_STATE, true),
|
configData::calcSumBinds(AppStateType::IN_GAME_STATE, true),
|
||||||
configData::calcSumBinds(AppStateType::IN_GAME_STATE, false),
|
configData::calcSumBinds(AppStateType::IN_GAME_STATE, false),
|
||||||
GameManager::getSingleton()->getPath() + scripts[(int)ScriptFiles::OPTIONS]
|
GameManager::getSingleton()->getPath() + scripts[(int)ScriptFiles::OPTIONS]
|
||||||
),
|
),
|
||||||
|
mapName(mn),
|
||||||
playerId(0){}
|
playerId(0){}
|
||||||
|
|
||||||
void InGameAppState::onAttached() {
|
void InGameAppState::onAttached() {
|
||||||
AbstractAppState::onAttached();
|
AbstractAppState::onAttached();
|
||||||
|
|
||||||
Map::getSingleton()->loadPlayerGameObjects();
|
Map *map = Map::getSingleton();
|
||||||
|
map->load(mapName);
|
||||||
|
map->loadPlayerGameObjects();
|
||||||
|
|
||||||
Camera *cam = Root::getSingleton()->getCamera();
|
Camera *cam = Root::getSingleton()->getCamera();
|
||||||
cam->setPosition(Map::getSingleton()->getSpawnPoint(playerId) + Vector3(1, 1, 1) * configData::CAMERA_DISTANCE);
|
cam->setPosition(Map::getSingleton()->getSpawnPoint(playerId) + Vector3(1, 1, 1) * configData::CAMERA_DISTANCE);
|
||||||
|
|||||||
+2
-1
@@ -39,7 +39,7 @@ namespace battleship{
|
|||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
InGameAppState();
|
InGameAppState(std::string);
|
||||||
~InGameAppState(){}
|
~InGameAppState(){}
|
||||||
void onAttached();
|
void onAttached();
|
||||||
void onDettached();
|
void onDettached();
|
||||||
@@ -53,6 +53,7 @@ namespace battleship{
|
|||||||
std::vector<std::string> modelPaths;
|
std::vector<std::string> modelPaths;
|
||||||
Player *mainPlayer;
|
Player *mainPlayer;
|
||||||
int playerId;
|
int playerId;
|
||||||
|
std::string mapName = "";
|
||||||
ActiveGameState* activeState;
|
ActiveGameState* activeState;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -27,8 +27,8 @@ namespace battleship{
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
void LoadingAppState::onDettached(){
|
void LoadingAppState::onDettached(){
|
||||||
GameManager::getSingleton()->getStateManager()->attachAppState(newState);
|
|
||||||
ConcreteGuiManager::getSingleton()->readLuaScreenScript(newScreen);
|
ConcreteGuiManager::getSingleton()->readLuaScreenScript(newScreen);
|
||||||
|
GameManager::getSingleton()->getStateManager()->attachAppState(newState);
|
||||||
|
|
||||||
AbstractAppState::onDettached();
|
AbstractAppState::onDettached();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -18,7 +18,6 @@ namespace battleship{
|
|||||||
PlayButton::PlayButton(Listbox *ml, Vector3 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", GLFW_KEY_P, separate), mapListbox(ml) {}
|
PlayButton::PlayButton(Listbox *ml, Vector3 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", GLFW_KEY_P, separate), mapListbox(ml) {}
|
||||||
|
|
||||||
void PlayButton::onClick() {
|
void PlayButton::onClick() {
|
||||||
|
|
||||||
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
|
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
|
||||||
vector<Listbox*> factionsListboxes, difficultiesListboxes, colorsListboxes, teamsListboxes;
|
vector<Listbox*> factionsListboxes, difficultiesListboxes, colorsListboxes, teamsListboxes;
|
||||||
|
|
||||||
@@ -36,10 +35,7 @@ namespace battleship{
|
|||||||
|
|
||||||
int selectedMap = mapListbox->getSelectedOption();
|
int selectedMap = mapListbox->getSelectedOption();
|
||||||
string mapName = wstringToString(mapListbox->getContents()[selectedMap]);
|
string mapName = wstringToString(mapListbox->getContents()[selectedMap]);
|
||||||
|
int numPlayers = Map::getSingleton()->getNumMapSpawnPoints(mapName);
|
||||||
Map *map = Map::getSingleton();
|
|
||||||
map->load(mapName);
|
|
||||||
int numPlayers = map->getNumSpawnPoints();
|
|
||||||
|
|
||||||
for(int i = 0; i < numPlayers; i++){
|
for(int i = 0; i < numPlayers; i++){
|
||||||
int factionChoice = factionsListboxes[i]->getSelectedOption();
|
int factionChoice = factionsListboxes[i]->getSelectedOption();
|
||||||
@@ -71,6 +67,6 @@ namespace battleship{
|
|||||||
game->addPlayer(new Player(difficulty, faction, team, color, cpuPlayer, i, name));
|
game->addPlayer(new Player(difficulty, faction, team, color, cpuPlayer, i, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLoadingGui(new LoadingAppState(new InGameAppState(), "inGame.lua"));
|
handleLoadingGui(new LoadingAppState(new InGameAppState(mapName), "inGame.lua"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user