minor bugfixes

This commit is contained in:
devZoGok
2022-06-24 17:23:03 +03:00
parent 2ab8b583e2
commit cbf3d41e01
3 changed files with 38 additions and 25 deletions
+2
View File
@@ -5,6 +5,8 @@
#include <stateManager.h>
#include <inputManager.h>
#include <assetManager.h>
#include "gameManager.h"
#include "guiAppState.h"
+34 -25
View File
@@ -2,6 +2,7 @@
#include <quad.h>
#include <node.h>
#include <material.h>
#include <assetManager.h>
#include "map.h"
#include "gameManager.h"
@@ -24,34 +25,42 @@ namespace battleship{
}
void Map::load() {
string path[]{
PATH + "Textures/left.jpg",
PATH + "Textures/right.jpg",
PATH + "Textures/top.jpg",
PATH + "Textures/bottom.jpg",
PATH + "Textures/front.jpg",
PATH + "Textures/back.jpg"
};
int numPaths = 6;
string path[] = {
PATH + "Textures/left.jpg",
PATH + "Textures/right.jpg",
PATH + "Textures/top.jpg",
PATH + "Textures/bottom.jpg",
PATH + "Textures/front.jpg",
PATH + "Textures/back.jpg"
};
Root *root = Root::getSingleton();
root->createSkybox(path);
for(int i = 0; i < numPaths; i++)
AssetManager::getSingleton()->load(path[i]);
Quad *quad = new Quad(Vector3(size.x, size.y, 1) * 1, true);
Material *mat = new Material(root->getLibPath() + "texture");
mat->addBoolUniform("texturingEnabled", true);
mat->addBoolUniform("lightingEnabled", false);
string fr[]{PATH + "Textures/water.jpg"};
Texture *t = new Texture(fr, 1, false);
mat->addTexUniform("textures[0]", t, true);
quad->setMaterial(mat);
waterNode = new Node();
waterNode->attachMesh(quad);
root->getRootNode()->attachChild(waterNode);
waterNode->setOrientation(Quaternion(-1.57, Vector3::VEC_I));
Root *root = Root::getSingleton();
root->createSkybox(path);
Camera *cam = root->getCamera();
cam->setPosition(Vector3(1, 1, 1) * 10);
cam->lookAt(Vector3(-1, -1, -1).norm(), Vector3(-1, 1, -1).norm());
Quad *quad = new Quad(Vector3(size.x, size.y, 1) * 1, true);
Material *mat = new Material(root->getLibPath() + "texture");
mat->addBoolUniform("texturingEnabled", true);
mat->addBoolUniform("lightingEnabled", false);
string fr[]{PATH + "Textures/water.jpg"};
AssetManager::getSingleton()->load(fr[0]);
Texture *t = new Texture(fr, 1, false);
mat->addTexUniform("textures[0]", t, true);
quad->setMaterial(mat);
waterNode = new Node();
waterNode->attachMesh(quad);
root->getRootNode()->attachChild(waterNode);
waterNode->setOrientation(Quaternion(-1.57, Vector3::VEC_I));
Camera *cam = root->getCamera();
cam->setPosition(Vector3(1, 1, 1) * 10);
cam->lookAt(Vector3(-1, -1, -1).norm(), Vector3(-1, 1, -1).norm());
}
void Map::unload() {}
+2
View File
@@ -4,6 +4,7 @@
#include <root.h>
#include <vector.h>
#include <util.h>
#include <assetManager.h>
#include <stateManager.h>
@@ -191,6 +192,7 @@ namespace battleship{
GameManager *gm = GameManager::getSingleton();
string font = PATH + "Fonts/batang.ttf";
AssetManager::getSingleton()->load(font);
SpButton *spButton = new SpButton(state, Vector2(gm->getWidth() / 16, gm->getHeight() / 12), Vector2(150, 40), "Singleplayer", true);
MainMenuOptionsButton *optionsButton = new MainMenuOptionsButton(state, Vector2(gm->getWidth() / 16, gm->getHeight() / 12 * 2), Vector2(150, 40), "Options", true);
ExitButton *exitButton = new ExitButton(Vector2(gm->getWidth() / 16, gm->getHeight() / 12 * 3), Vector2(150, 40), "Exit", true);