fixed cubs sorting
This commit is contained in:
parent
6d38a9e914
commit
650927498c
@ -158,11 +158,11 @@ void GameObjectManager::initialize() {
|
||||
|
||||
//roomTexturePtr = rooms[current_room_index].roomTexture;
|
||||
|
||||
AddItemToInventory("cube_T", std::make_shared<Texture>(CreateTextureDataFromBmp24("./Kitchen_ceramics.bmp")), objects_in_inventory + 1);
|
||||
AddItemToInventory("cube_T", std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_T_icon.bmp32")), objects_in_inventory + 1);
|
||||
objects_in_inventory++;
|
||||
AddItemToInventory("cube_O", std::make_shared<Texture>(CreateTextureDataFromBmp24("./Kitchen_ceramics.bmp")), objects_in_inventory + 1);
|
||||
AddItemToInventory("cube_O", std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_O_icon.bmp32")), objects_in_inventory + 1);
|
||||
objects_in_inventory++;
|
||||
AddItemToInventory("cube_M", std::make_shared<Texture>(CreateTextureDataFromBmp24("./Kitchen_ceramics.bmp")), objects_in_inventory + 1);
|
||||
AddItemToInventory("cube_M", std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_O_icon.bmp32")), objects_in_inventory + 1);
|
||||
objects_in_inventory++;
|
||||
|
||||
|
||||
@ -218,17 +218,19 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
||||
bearName += "T";
|
||||
selectedCubes.push_back(*item);
|
||||
gInventoryMap.erase(item->name);
|
||||
objects_in_inventory--;
|
||||
}
|
||||
else if (item->name == "cube_O"){
|
||||
bearName += "O";
|
||||
selectedCubes.push_back(*item);
|
||||
gInventoryMap.erase(item->name);
|
||||
objects_in_inventory--;
|
||||
}
|
||||
else if (item->name == "cube_M"){
|
||||
bearName += "M";
|
||||
selectedCubes.push_back(*item);
|
||||
gInventoryMap.erase(item->name);
|
||||
|
||||
objects_in_inventory--;
|
||||
}
|
||||
}
|
||||
else if (bearName.length() >= 3 && !(bearName.compare("TOM") == 0)) {
|
||||
|
||||
@ -15,6 +15,7 @@ namespace ZL
|
||||
{
|
||||
if (gom.bearName.compare("TOM") == 0) {
|
||||
gInventoryMap.clear();
|
||||
gom.objects_in_inventory = 0;
|
||||
// std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
gom.switch_room(1);
|
||||
}
|
||||
|
||||
@ -263,14 +263,13 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) {
|
||||
}
|
||||
|
||||
// Отрисовка кубиков
|
||||
if (gameObjects.current_room_index == 0){
|
||||
for (const auto& cube : gameObjects.selectedCubes) {
|
||||
if (gameObjects.current_room_index == 0) {
|
||||
for (int j = gameObjects.selectedCubes.size() - 1; j >= 0; j--) {
|
||||
auto& cube = gameObjects.selectedCubes[j];
|
||||
renderer.PushMatrix();
|
||||
|
||||
// Смещаем по оси x: начиная с левой стороны и двигаясь вправо
|
||||
float xPos = gameObjects.SELECTED_CUBE_MARGIN
|
||||
+ i * (gameObjects.SELECTED_CUBE_ICON_SIZE + gameObjects.SELECTED_CUBE_MARGIN) + 300.0f;
|
||||
// Оставляем y константным
|
||||
float xPos = (gameObjects.SELECTED_CUBE_MARGIN + 300.0f)
|
||||
+ j * (gameObjects.SELECTED_CUBE_ICON_SIZE + gameObjects.SELECTED_CUBE_MARGIN);
|
||||
float yPos = 500.0f;
|
||||
|
||||
renderer.TranslateMatrix(Vector3f{xPos, yPos, 0.0f});
|
||||
@ -278,13 +277,12 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) {
|
||||
glBindTexture(GL_TEXTURE_2D, cube.texture->getTexID());
|
||||
|
||||
renderer.DrawVertexRenderStruct(gameObjects.inventoryIconMeshMutable);
|
||||
|
||||
renderer.PopMatrix();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
|
||||
|
||||
BIN
textures/inventory_objects/cubic_O_icon.bmp32
Normal file
BIN
textures/inventory_objects/cubic_O_icon.bmp32
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 449 KiB |
BIN
textures/inventory_objects/cubic_T_icon.bmp32
Normal file
BIN
textures/inventory_objects/cubic_T_icon.bmp32
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 449 KiB |
Loading…
Reference in New Issue
Block a user