Merge pull request #16 from devZoGok/bf-15-dep-corr

Bf 15 dep corr
This commit is contained in:
devZoGok
2023-09-02 15:17:13 +00:00
committed by GitHub
12 changed files with 37 additions and 35 deletions
-3
View File
@@ -7,9 +7,6 @@
[submodule "external/vb01"]
path = external/vb01
url = https://github.com/devZoGok/vb01
[submodule "external/lua"]
path = external/lua
url = https://github.com/lua/lua
[submodule "external/tinydir"]
path = external/tinydir
url = https://github.com/cxong/tinydir
-1
View File
@@ -1 +0,0 @@
PATH = "/home/dominykas/c++/Battleship/Assets/"
+7 -7
View File
@@ -17,7 +17,7 @@ namespace battleship{
namespace configData{
using namespace gameBase;
const std::string DEFAULT_TEXTURE = GameManager::getSingleton()->getPath() + "Textures/defaultTexture.jpg";
const std::string DEFAULT_TEXTURE = "Textures/defaultTexture.jpg";
const double camPanSpeed = .1, cellLength = 14, cellWidth = 14, cellDepth = 7;
const int maxNumGroups = 10;
const vb01::u32 IMPASS_NODE_VAL = 65535;
@@ -29,13 +29,13 @@ namespace battleship{
const static int maxConfBinds = 22;
const static int numScripts = 5;
const static std::string scriptPathBase = GameManager::getSingleton()->getPath() + "Scripts/";
const static std::string scriptPathBase = "Scripts/";
const static std::vector<std::string> scripts = std::vector<std::string>{
scriptPathBase + "options.lua",
scriptPathBase + "unitData.lua",
scriptPathBase + "vehicleData.lua",
scriptPathBase + "structureData.lua",
scriptPathBase + "player.lua"
"Scripts/options.lua",
"Scripts/unitData.lua",
"Scripts/vehicleData.lua",
"Scripts/structureData.lua",
"Scripts/player.lua"
};
const static Bind staticBinds[numAppStates][maxStaticBinds]{
-1
Submodule external/lua deleted from c33b1728ae
+1 -1
+12 -12
View File
@@ -26,26 +26,26 @@ namespace battleship{
return gameManager;
}
GameManager::GameManager() {
LuaManager *luaManager = LuaManager::getSingleton();
string pathBase = "../Assets/Scripts/";
luaManager->buildScript(vector<string>{pathBase + "defPaths.lua"});
path = luaManager->getString("PATH");
}
void GameManager::start(string gameDir) {
path = gameDir + "Assets/";
GameManager::~GameManager() {}
void GameManager::start() {
LuaManager *luaManager = LuaManager::getSingleton();
luaManager->buildScript(vector<string>{path + "Scripts/main.lua"});
luaManager->buildScript(configData::scripts);
luaManager->executeCode("PATH = \"" + path + "\";");
vector<string> files = configData::scripts;
files.emplace(files.begin(), "Scripts/main.lua");
for(string &f : files)
f = path + f;
luaManager->buildScript(files);
string ind1 = "graphics", ind2 = "resolution";
width = luaManager->getIntFromTable(ind1, vector<Index>{Index(ind2), Index("x")});
height = luaManager->getIntFromTable(ind1, vector<Index>{Index(ind2), Index("y")});
Root *root = Root::getSingleton();
root->start(width, height, "../../vb01/", "Battleship");
root->start(width, height, path + "../external/vb01/", "Battleship");
stateManager = new StateManager();
inputManager = new InputManager(stateManager, root->getWindow());
+3 -3
View File
@@ -18,7 +18,7 @@ namespace battleship{
class GameManager {
public:
static GameManager* getSingleton();
void start();
void start(std::string);
void update();
inline int getWidth(){return width;}
inline int getHeight(){return height;}
@@ -27,8 +27,8 @@ namespace battleship{
inline bool isServerSide(){return serverSide;}
inline gameBase::StateManager* getStateManager(){return stateManager;}
private:
GameManager();
~GameManager();
GameManager(){}
~GameManager(){}
gameBase::StateManager *stateManager = nullptr;
gameBase::InputManager *inputManager = nullptr;
+8 -2
View File
@@ -7,12 +7,18 @@
#include <assetManager.h>
#include <string>
using namespace battleship;
using namespace vb01;
using namespace std;
int main() {
int main(int argc, char **argv) {
GameManager *gm = GameManager::getSingleton();
gm->start();
string gamePath = string(argv[0]);
gamePath = gamePath.substr(0, gamePath.find_last_of("/") + 1) + "../";
gm->start(gamePath);
gm->getStateManager()->attachAppState(new GuiAppState());
AssetManager::getSingleton()->load(gm->getPath() + "Fonts/batang.ttf");
+3 -2
View File
@@ -211,9 +211,10 @@ namespace battleship{
//TODO simplify the dubplicatory field extraction statements
void Map::loadPlayers(){
AssetManager *assetManager = AssetManager::getSingleton();
assetManager->load(DEFAULT_TEXTURE);
string path = GameManager::getSingleton()->getPath();
assetManager->load(path + DEFAULT_TEXTURE);
LuaManager *lm = LuaManager::getSingleton();
assetManager->load(GameManager::getSingleton()->getPath() + lm->getString("modelPrefix"), true);
assetManager->load(path + lm->getString("modelPrefix"), true);
int numPlayers = lm->getIntFromTable(mapTable, vector<Index>{Index("numPlayers")});
string playerInd = "players", unitInd = "units", spawnPointInd = "spawnPointId", posInd = "pos", rotInd = "rot";
+1 -1
View File
@@ -55,7 +55,7 @@ namespace battleship{
AssetManager *assetManager = AssetManager::getSingleton();
assetManager->load(basePath + "Models/Units/", true);
assetManager->load(DEFAULT_TEXTURE);
assetManager->load(basePath + DEFAULT_TEXTURE);
}
void MapEditorAppState::MapEditor::updateCircleRadius(bool increase){
+1 -1
View File
@@ -77,7 +77,7 @@ namespace battleship{
string libPath = root->getLibPath();
Material *mat = new Material(libPath + "texture");
string f[]{configData::DEFAULT_TEXTURE};
string f[]{GameManager::getSingleton()->getPath() + configData::DEFAULT_TEXTURE};
Texture *diffuseTexture = new Texture(f, 1, false);
mat->addBoolUniform("texturingEnabled", true);
mat->addBoolUniform("lightingEnabled", false);