diff --git a/Minecraft.Client/UI/Gui.h b/Minecraft.Client/UI/Gui.h index 2ced840c3..4077c9c40 100644 --- a/Minecraft.Client/UI/Gui.h +++ b/Minecraft.Client/UI/Gui.h @@ -2,9 +2,9 @@ #include #include "GuiComponent.h" #include "GuiMessage.h" +#include "../../../Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h" class Random; class Minecraft; -class ItemRenderer; class Gui : public GuiComponent { private: diff --git a/Minecraft.Client/UI/Screens/CreativeInventoryScreen.cpp b/Minecraft.Client/UI/Screens/CreativeInventoryScreen.cpp index f2773df8f..ac8481673 100644 --- a/Minecraft.Client/UI/Screens/CreativeInventoryScreen.cpp +++ b/Minecraft.Client/UI/Screens/CreativeInventoryScreen.cpp @@ -70,7 +70,7 @@ CreativeInventoryScreen::ContainerCreative::ContainerCreative( } // Add hotbar slots (9 slots at bottom) - for (int k = 0; k < 9; k++) { + for (int k = 0; k < 9; ++k) { addSlot(new Slot(inventoryplayer, k, 9 + k * 18, 112)); } @@ -181,8 +181,8 @@ void CreativeInventoryScreen::ContainerCreative::scrollTo(float pos) { j = 0; } - for (int k = 0; k < ROWS; k++) { - for (int l = 0; l < COLUMNS; l++) { + for (int k = 0; k < ROWS; ++k) { + for (int l = 0; l < COLUMNS; ++l) { int i1 = l + (k + j) * COLUMNS; if (i1 >= 0 && i1 < (int)itemList.size()) { @@ -484,7 +484,7 @@ void CreativeInventoryScreen::setCurrentCreativeTab(int tab) { IUIScene_CreativeMenu::specs[tab]; // Add items from static groups - for (int i = 0; i < spec->m_staticGroupsCount; i++) { + for (int i = 0; i < spec->m_staticGroupsCount; ++i) { int groupIdx = spec->m_staticGroupsA[i]; if (groupIdx >= 0 && groupIdx < diff --git a/Minecraft.Client/UI/Screens/CreativeInventoryScreen.h b/Minecraft.Client/UI/Screens/CreativeInventoryScreen.h index f4f6004fa..e8fd36877 100644 --- a/Minecraft.Client/UI/Screens/CreativeInventoryScreen.h +++ b/Minecraft.Client/UI/Screens/CreativeInventoryScreen.h @@ -20,7 +20,8 @@ private: static int selectedTabIndex; // Array of item ids for the tab icons - static int tabIconIds[IUIScene_CreativeMenu::eCreativeInventoryTab_COUNT]; + static const int + tabIconIds[IUIScene_CreativeMenu::eCreativeInventoryTab_COUNT]; // Temporary inventory for creative mode items static std::shared_ptr basicInventory; @@ -60,23 +61,29 @@ public: }; public: - CreativeInventoryScreen(std::shared_ptr player); - virtual void removed() override; - virtual void init() override; - virtual void containerTick(); - virtual void tick() override; - virtual void updateEvents() override; - virtual void keyPressed(wchar_t eventCharacter, int eventKey) override; - virtual void mouseClicked(int x, int y, int buttonNum) override; - virtual void mouseReleased(int x, int y, int buttonNum) override; - virtual void render(int xm, int ym, float a) override; + CreativeInventoryScreen(std::shared_ptr player); + virtual void removed() override; + virtual void init() override; + virtual void containerTick(); + virtual void tick() override; + virtual void updateEvents() override; + virtual void keyPressed(wchar_t eventCharacter, int eventKey) override; + virtual void mouseClicked(int x, int y, int buttonNum) override; + virtual void mouseReleased(int x, int y, int buttonNum) override; + virtual void render(int xm, int ym, float a) override; + protected: - virtual void renderLabels() override; - virtual void renderBg(float a) override; + virtual void renderLabels() override; + virtual void renderBg(float a) override; + virtual bool isMouseOverInternal(int tab, int mouseX, int mouseY, int xo, + int yo, int w, int h); + private: void setCurrentCreativeTab(int tab); void selectTab(int tab); bool needsScrollBars(); bool isMouseOverTab(int tab, int mouseX, int mouseY); - void drawTab(int tab); -}; + bool isMouseOverIcon(int tab, int mouseX, int mouseY); + void renderTab(int tab); + bool renderIconTooltip(int tab, int mouseX, int mouseY); +}; \ No newline at end of file