draw cubes
This commit is contained in:
parent
c39eac4241
commit
e8e4dc9b28
@ -8,10 +8,10 @@
|
||||
namespace ZL {
|
||||
|
||||
const float GameObjectManager::INVENTORY_ICON_SIZE = 44.0f;
|
||||
const float GameObjectManager::INVENTORY_MARGIN = 20.0f;
|
||||
const float GameObjectManager::INVENTORY_MARGIN = 44.0f;
|
||||
|
||||
const float GameObjectManager::SELECTED_CUBE_ICON_SIZE = 44.0f;
|
||||
const float GameObjectManager::SELECTED_CUBE_MARGIN = 20.0f;
|
||||
const float GameObjectManager::SELECTED_CUBE_ICON_SIZE = 244.0f;
|
||||
const float GameObjectManager::SELECTED_CUBE_MARGIN = 50.0f;
|
||||
|
||||
void GameObjectManager::initializeLoadingScreen()
|
||||
{
|
||||
|
||||
@ -66,6 +66,8 @@ public:
|
||||
|
||||
static const float INVENTORY_ICON_SIZE;
|
||||
static const float INVENTORY_MARGIN;
|
||||
static const float SELECTED_CUBE_ICON_SIZE;
|
||||
static const float SELECTED_CUBE_MARGIN;
|
||||
ActiveObjectManager aoMgr;
|
||||
int objects_in_inventory;
|
||||
void addRectangle(int x, int y, int width, int height, int r, int g, int b, int borderWidth, int borderR, int borderG, int borderB);
|
||||
@ -80,12 +82,12 @@ public:
|
||||
std::list<std::function<bool()>> loadingFunctions;
|
||||
std::thread loadingThread;
|
||||
bool sideThreadLoadingCompleted = false;
|
||||
int current_room_index;
|
||||
|
||||
private:
|
||||
//int animationCounter = 0;
|
||||
int lastMouseX = 0; // Добавляем переменные для хранения позиции мыши
|
||||
int lastMouseY = 0;
|
||||
int current_room_index;
|
||||
bool isPointInObject(int screenX, int screenY, int objectScreenX, int objectScreenY) const;
|
||||
void worldToScreenCoordinates(Vector3f objectPos, // Добавляем метод
|
||||
Matrix4f projectionModelView,
|
||||
|
||||
@ -11,7 +11,7 @@ namespace ZL
|
||||
return [](GameObjectManager& gom, size_t ms)
|
||||
{
|
||||
if (gom.bearName.compare("TOM") == 0) {
|
||||
std::cout << gom.bearName << std::endl;
|
||||
gInventoryMap.clear();
|
||||
gom.switch_room(1);
|
||||
}
|
||||
};
|
||||
|
||||
@ -263,6 +263,29 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) {
|
||||
i++;
|
||||
}
|
||||
|
||||
// Отрисовка кубиков
|
||||
if (gameObjects.current_room_index == 0){
|
||||
for (const auto& cube : gameObjects.selectedCubes) {
|
||||
renderer.PushMatrix();
|
||||
|
||||
// Смещаем по оси x: начиная с левой стороны и двигаясь вправо
|
||||
float xPos = gameObjects.SELECTED_CUBE_MARGIN
|
||||
+ i * (gameObjects.SELECTED_CUBE_ICON_SIZE + gameObjects.SELECTED_CUBE_MARGIN);
|
||||
// Оставляем y константным
|
||||
float yPos = Environment::height - gameObjects.SELECTED_CUBE_MARGIN - (gameObjects.SELECTED_CUBE_ICON_SIZE * 3.0f);
|
||||
|
||||
renderer.TranslateMatrix(Vector3f{xPos, yPos, 0.0f});
|
||||
renderer.ScaleMatrix(Vector3f{2.8f, 2.8f, 1.0f});
|
||||
glBindTexture(GL_TEXTURE_2D, cube.texture->getTexID());
|
||||
|
||||
renderer.DrawVertexRenderStruct(gameObjects.inventoryIconMeshMutable);
|
||||
|
||||
renderer.PopMatrix();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ namespace ZL {
|
||||
class RenderSystem {
|
||||
public:
|
||||
RenderSystem() = default;
|
||||
Renderer renderer;
|
||||
void initialize();
|
||||
void drawScene(GameObjectManager& gameObjects);
|
||||
Renderer& getRenderer() { return renderer; }
|
||||
@ -26,7 +27,6 @@ private:
|
||||
|
||||
void drawLoadingScreen(const GameObjectManager& gameObjects);
|
||||
|
||||
Renderer renderer;
|
||||
ShaderManager shaderManager;
|
||||
Matrix4f currentProjectionModelView; // Добавлено для хранения матрицы между drawWorld и drawUI
|
||||
int lastMouseX = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user