diff --git a/activeGameState.cpp b/activeGameState.cpp index 0c6eebf..e72daeb 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -405,6 +405,7 @@ namespace battleship{ if (cursorPos.y >= height && 0 < cursorPos.x && cursorPos.x < width) cam->setPosition(cam->getPosition() - forwVec * camPanSpeed); + /* if (cam->getPosition().x > map->getSize().x / 2) cam->setPosition(Vector3(map->getSize().x / 2, cam->getPosition().y, cam->getPosition().z)); else if (cam->getPosition().x < -map->getSize().x / 2) @@ -414,6 +415,7 @@ namespace battleship{ cam->setPosition(Vector3(cam->getPosition().x, cam->getPosition().y, map->getSize().y / 2)); else if (cam->getPosition().z < -map->getSize().y / 2) cam->setPosition(Vector3(cam->getPosition().x, cam->getPosition().y, -map->getSize().y / 2)); + */ } void ActiveGameState::issueOrder(Order::TYPE type, vector pos, bool addOrder) { diff --git a/guiAppState.cpp b/guiAppState.cpp index c5ee85c..3711fac 100755 --- a/guiAppState.cpp +++ b/guiAppState.cpp @@ -10,8 +10,6 @@ using namespace vb01Gui; using namespace std; namespace battleship{ - Vector2 mousePos; - GuiAppState::GuiAppState() { type = AppStateTypes::GUI_STATE; } @@ -20,7 +18,7 @@ namespace battleship{ void GuiAppState::update() { GameManager *gm = GameManager::getSingleton(); - mousePos = getCursorPos(); + Vector2 mousePos = getCursorPos(); for (Button *b : buttons) { if (b->isSeparate()) @@ -80,6 +78,7 @@ namespace battleship{ case Mapping::LEFT_CLICK: if(isPressed) for (int i = 0; i < buttons.size(); i++) { + Vector2 mousePos = getCursorPos(); Button *b = buttons[i]; bool withinX = mousePos.x > b->getPos().x && mousePos.x < b->getPos().x + b->getSize().x; bool withinY = mousePos.y > b->getPos().y && mousePos.y < b->getPos().y + b->getSize().y; diff --git a/map.cpp b/map.cpp index 6d43f2a..6434f29 100755 --- a/map.cpp +++ b/map.cpp @@ -25,11 +25,11 @@ namespace battleship{ void Map::load() { string path[]{ - PATH + "Textures/down.jpg", PATH + "Textures/left.jpg", PATH + "Textures/right.jpg", + PATH + "Textures/top.jpg", + PATH + "Textures/bottom.jpg", PATH + "Textures/front.jpg", - PATH + "Textures/back.jpg", PATH + "Textures/back.jpg" }; @@ -38,11 +38,11 @@ namespace battleship{ Quad *quad = new Quad(Vector3(size.x, size.y, 1) * 1, true); Material *mat = new Material(root->getLibPath() + "texture"); - mat->addVariable("texturingEnabled", true); - mat->addVariable("lightingEnabled", false); + mat->addBoolUniform("texturingEnabled", true); + mat->addBoolUniform("lightingEnabled", false); string fr[]{PATH + "Textures/water.jpg"}; - Texture *t = new Texture(fr, 1); - mat->addVariable("textures[0]", t, true); + Texture *t = new Texture(fr, 1, false); + mat->addTexUniform("textures[0]", t, true); quad->setMaterial(mat); Node *water = new Node(); water->attachMesh(quad); diff --git a/projectile.cpp b/projectile.cpp index 2dbf682..434b3fc 100755 --- a/projectile.cpp +++ b/projectile.cpp @@ -40,10 +40,10 @@ namespace battleship{ */ this->node = new Model((projectileData::meshPath[id][weaponTypeId])); Material *mat = new Material(Root::getSingleton()->getLibPath() + "texture"); - mat->addVariable("lightingEnabled", false); + mat->addBoolUniform("lightingEnabled", false); string f[]{projectileData::diffuseMapTextPath[id][weaponTypeId]}; - Texture *diffuseTexture = new Texture(f, 1); - mat->addVariable("textures[0]", diffuseTexture, true); + Texture *diffuseTexture = new Texture(f, 1, false); + mat->addTexUniform("textures[0]", diffuseTexture, true); this->node->setMaterial(mat); /* diff --git a/unit.cpp b/unit.cpp index 0779c1d..11b1699 100755 --- a/unit.cpp +++ b/unit.cpp @@ -36,7 +36,7 @@ namespace battleship{ tr->drop(); */ string f[]{basePath[id] + "diffuseMap.png"}; - Texture *diffuseTexture = new Texture(f, 1); + Texture *diffuseTexture = new Texture(f, 1, false); /* light = smgr->addLightSceneNode(node, vector3df(0, 2, 0), SColor(255, 255, 255, 255), lineOfSight); diff --git a/vessel.cpp b/vessel.cpp index d7bdf76..9bbc6db 100755 --- a/vessel.cpp +++ b/vessel.cpp @@ -29,7 +29,7 @@ namespace battleship{ turretNode->setMaterialFlag(EMF_LIGHTING, false); */ string fr[]{basePath[unitId] + turretNames[unitId][turretId] + "DiffuseMap.png"}; - Texture *turretDiffuseTexture = new Texture(fr); + Texture *turretDiffuseTexture = new Texture(fr, 1, false); /*