placing minimap icons within the minimap frame

This commit is contained in:
devZoGok
2026-05-13 18:59:32 +03:00
parent 180f00f6c4
commit a2f2367381
5 changed files with 16 additions and 13 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ end
eyeIcon = 'eye.png'
refIcon = 'refineds.png'
minimapSize = {x = 200, y = 200}
minimapPos = {x = 0, y = res.y - minimapSize.y, z = .9}
minimapPos = {x = 0, y = res.y - minimapSize.y, z = .85}
resTextScale = {x = .5, y = .5}
resIconBasePath = 'Icons/Resources/'
+2
View File
@@ -144,6 +144,8 @@ namespace battleship{
SOL_LUA_VIEW["_minimapSize"]["y"] = y;
}
Map::Minimap::getSingleton()->load();
ConcreteGuiManager::getSingleton()->readLuaScreenScript(
"activeGameState.lua",
buttons,
-1
View File
@@ -62,7 +62,6 @@ namespace battleship{
Map *map = Map::getSingleton();
map->load(mapName);
map->loadPlayersGameObjects();
Camera *cam = Root::getSingleton()->getCamera();
cam->setPosition(Map::getSingleton()->getSpawnPoint(playerId) + Vector3(1, 1, 1) * configData::CAMERA_DISTANCE);
+10 -7
View File
@@ -82,9 +82,13 @@ namespace battleship{
mat->addTexUniform("diffuseMap", tex, false);
sol::state_view SOL_LUA_VIEW = generateView();
sol::table posTbl = SOL_LUA_VIEW["minimapPos"], sizeTbl = SOL_LUA_VIEW["minimapSize"];
Vector2 minimapSize = Vector2(sizeTbl["x"], sizeTbl["y"]);
Vector3 minimapPos = Vector3(posTbl["x"], posTbl["y"], posTbl["z"]);
sol::table posTbl = SOL_LUA_VIEW["minimapPos"],
_posTbl = SOL_LUA_VIEW["_minimapPos"],
sizeTbl = SOL_LUA_VIEW["minimapSize"],
_sizeTbl = SOL_LUA_VIEW["_minimapSize"];
Vector2 minimapSize = Vector2((float)_sizeTbl["x"], (float)_sizeTbl["y"]);
Vector3 minimapPos = Vector3((float)_posTbl["x"], (float)posTbl["y"] + (float)_posTbl["y"], (float)posTbl["z"]);
Vector3 mapSize = Map::getSingleton()->getMapSize();
Vector2 iconPos = Vector2(
@@ -95,9 +99,8 @@ namespace battleship{
Quad *quad = new Quad(iconSize, false);
quad->setMaterial(mat);
Node *node = new Node(minimapPos + Vector3(iconPos.x, iconPos.y, .1) - .5 * iconSize);
Node *node = new Node(minimapPos + Vector3(iconPos.x, iconPos.y, .05) - .5 * iconSize);
node->attachMesh(quad);
node->setVisible(false);
root->getGuiNode()->attachChild(node);
return node;
@@ -187,7 +190,7 @@ namespace battleship{
minimapSize.y * (camPos.z + .5 * mapSize.z) / mapSize.z
);
camIcon->setPosition(minimapButton->getPos() + Vector3(iconPos.x, iconPos.y, .1));
camIcon->setPosition(minimapButton->getPos() + Vector3(iconPos.x, iconPos.y, .06));
}
void Map::Minimap::update(){
@@ -677,7 +680,7 @@ namespace battleship{
for(int i = 0; i < numWaterbodies; i++)
loadTerrainObject(i);
Minimap::getSingleton()->load();
loadPlayersGameObjects();
}
void Map::create(string mapName, Vector3 mapSize){
+3 -4
View File
@@ -63,13 +63,12 @@ namespace battleship{
generatePlane(size);
}
else{
map->load(name);
int numPlayers = map->getNumSpawnPoints();
int numPlayers = Map::getSingleton()->getNumMapSpawnPoints(name);
for(int i = 0; i < numPlayers; i++)
game->addPlayer(new Player(0, 0, 0, Vector3(1, 1, 1)));
game->addPlayer(new Player(0, 0, 0, Vector3(1, float(i > 0), float(i > 1)), false, i));
map->loadPlayersGameObjects();
map->load(name);
MeshData meshData = map->getNodeParent()->getChild(0)->getMesh(0)->getMeshBase();
int minId = 0, numVerts = 3 * meshData.numTris;