mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
inventory screen
This commit is contained in:
parent
46fcfa6d4f
commit
05069de8c7
|
|
@ -33,7 +33,7 @@ void AbstractContainerScreen::init()
|
|||
void AbstractContainerScreen::render(int xm, int ym, float a)
|
||||
{
|
||||
// 4J Stu - Not used
|
||||
#if 0
|
||||
//#if 0
|
||||
renderBackground();
|
||||
int xo = (width - imageWidth) / 2;
|
||||
int yo = (height - imageHeight) / 2;
|
||||
|
|
@ -53,8 +53,8 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
|||
|
||||
Slot *hoveredSlot = NULL;
|
||||
|
||||
AUTO_VAR(itEnd, menu->slots->end());
|
||||
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
|
||||
AUTO_VAR(itEnd, menu->slots.end());
|
||||
for (AUTO_VAR(it, menu->slots.begin()); it != itEnd; it++)
|
||||
{
|
||||
Slot *slot = *it; //menu->slots->at(i);
|
||||
|
||||
|
|
@ -96,17 +96,17 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
|||
if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem())
|
||||
{
|
||||
|
||||
wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
|
||||
|
||||
if (elementName.length() > 0)
|
||||
{
|
||||
int x = xm - xo + 12;
|
||||
int y = ym - yo - 12;
|
||||
int width = font->width(elementName);
|
||||
fillGradient(x - 3, y - 3, x + width + 3, y + 8 + 3, 0xc0000000, 0xc0000000);
|
||||
|
||||
font->drawShadow(elementName, x, y, 0xffffffff);
|
||||
}
|
||||
//wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
|
||||
//
|
||||
//if (elementName.length() > 0)
|
||||
//{
|
||||
// int x = xm - xo + 12;
|
||||
// int y = ym - yo - 12;
|
||||
// int width = font->width(elementName);
|
||||
// fillGradient(x - 3, y - 3, x + width + 3, y + 8 + 3, 0xc0000000, 0xc0000000);
|
||||
//
|
||||
// font->drawShadow(elementName, x, y, 0xffffffff);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
|||
Screen::render(xm, ym, a);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::renderLabels()
|
||||
|
|
@ -125,33 +125,33 @@ void AbstractContainerScreen::renderLabels()
|
|||
void AbstractContainerScreen::renderSlot(Slot *slot)
|
||||
{
|
||||
// 4J Unused
|
||||
#if 0
|
||||
//#if 0
|
||||
int x = slot->x;
|
||||
int y = slot->y;
|
||||
shared_ptr<ItemInstance> item = slot->getItem();
|
||||
|
||||
if (item == NULL)
|
||||
{
|
||||
int icon = slot->getNoItemIcon();
|
||||
if (icon >= 0)
|
||||
{
|
||||
glDisable(GL_LIGHTING);
|
||||
minecraft->textures->bind(minecraft->textures->loadTexture(TN_GUI_ITEMS));//L"/gui/items.png"));
|
||||
blit(x, y, icon % 16 * 16, icon / 16 * 16, 16, 16);
|
||||
glEnable(GL_LIGHTING);
|
||||
return;
|
||||
}
|
||||
//int icon = slot->getNoItemIcon();
|
||||
//if (icon >= 0)
|
||||
//{
|
||||
// glDisable(GL_LIGHTING);
|
||||
// minecraft->textures->bind(minecraft->textures->loadTexture(TN_GUI_ITEMS));//L"/gui/items.png"));
|
||||
// blit(x, y, icon % 16 * 16, icon / 16 * 16, 16, 16);
|
||||
// glEnable(GL_LIGHTING);
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
|
||||
itemRenderer->renderGuiItem(font, minecraft->textures, item, x, y);
|
||||
itemRenderer->renderGuiItemDecorations(font, minecraft->textures, item, x, y);
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
Slot *AbstractContainerScreen::findSlot(int x, int y)
|
||||
{
|
||||
AUTO_VAR(itEnd, menu->slots->end());
|
||||
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
|
||||
AUTO_VAR(itEnd, menu->slots.end());
|
||||
for (AUTO_VAR(it, menu->slots.begin()); it != itEnd; it++)
|
||||
{
|
||||
Slot *slot = *it; //menu->slots->at(i);
|
||||
if (isHovering(slot, x, y)) return slot;
|
||||
|
|
@ -186,12 +186,12 @@ void AbstractContainerScreen::mouseClicked(int x, int y, int buttonNum)
|
|||
|
||||
if (clickedOutside)
|
||||
{
|
||||
slotId = AbstractContainerMenu::CLICKED_OUTSIDE;
|
||||
slotId = AbstractContainerMenu::SLOT_CLICKED_OUTSIDE;
|
||||
}
|
||||
|
||||
if (slotId != -1)
|
||||
{
|
||||
bool quickKey = slotId != AbstractContainerMenu::CLICKED_OUTSIDE && (Keyboard::isKeyDown(Keyboard::KEY_LSHIFT) || Keyboard::isKeyDown(Keyboard::KEY_RSHIFT));
|
||||
bool quickKey = slotId != AbstractContainerMenu::SLOT_CLICKED_OUTSIDE && (Keyboard::isKeyDown(Keyboard::KEY_LSHIFT) || Keyboard::isKeyDown(Keyboard::KEY_RSHIFT));
|
||||
minecraft->gameMode->handleInventoryMouseClick(menu->containerId, slotId, buttonNum, quickKey, minecraft->player);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ void InventoryScreen::render(int xm, int ym, float a)
|
|||
void InventoryScreen::renderBg(float a)
|
||||
{
|
||||
// 4J Unused
|
||||
#if 0
|
||||
int tex = minecraft->textures->loadTexture(L"/gui/inventory.png");
|
||||
//#if 0
|
||||
int tex = minecraft->textures->loadTexture(TN_GUI_INVENTORY);
|
||||
glColor4f(1, 1, 1, 1);
|
||||
minecraft->textures->bind(tex);
|
||||
int xo = (width - imageWidth) / 2;
|
||||
|
|
@ -80,7 +80,7 @@ void InventoryScreen::renderBg(float a)
|
|||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
void InventoryScreen::buttonClicked(Button *button)
|
||||
|
|
|
|||
|
|
@ -351,6 +351,9 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr<Item
|
|||
// 4J - this used to take x and y as ints, and no scale and alpha - but this interface is now implemented as a wrapper round this more fully featured one
|
||||
void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr<ItemInstance> item, float x, float y, float fScaleX,float fScaleY, float fAlpha, bool useCompiled)
|
||||
{
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
int itemId = item->id;
|
||||
int itemAuxValue = item->getAuxValue();
|
||||
Icon *itemIcon = item->getIcon();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -501,6 +501,7 @@ void Minecraft::setScreen(Screen *screen)
|
|||
if (this->screen != NULL)
|
||||
{
|
||||
this->screen->removed();
|
||||
delete this->screen;
|
||||
}
|
||||
|
||||
//4J Gordon: Do not force a stats save here
|
||||
|
|
@ -2293,7 +2294,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
}
|
||||
}
|
||||
|
||||
if (screen == NULL && (player && !ui.GetMenuDisplayed(iPad)) )
|
||||
if ((screen == NULL || screen->passEvents) && (player && !ui.GetMenuDisplayed(iPad)) )
|
||||
{
|
||||
// 4J-PB - add some tooltips if required
|
||||
int iA=-1, iB=-1, iX, iY=IDS_CONTROLS_INVENTORY, iLT=-1, iRT=-1, iLB=-1, iRB=-1, iLS=-1, iRS=-1;
|
||||
|
|
@ -3688,7 +3689,18 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
}
|
||||
else
|
||||
{
|
||||
app.LoadInventoryMenu(iPad,player);
|
||||
static bool inventoryOpen = false;
|
||||
//app.LoadInventoryMenu(iPad,player);
|
||||
if (!inventoryOpen)
|
||||
{
|
||||
setScreen(new InventoryScreen(player));
|
||||
inventoryOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
setScreen(NULL);
|
||||
inventoryOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3776,8 +3788,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
}
|
||||
else
|
||||
{
|
||||
InputManager.SetMenuDisplayed(iPad, false);
|
||||
// 4J-PB
|
||||
if (gameMode && InputManager.GetValue(iPad, ACTION_MENU_CANCEL) > 0 && gameMode->isInputAllowed(ACTION_MENU_CANCEL))
|
||||
if (InputManager.GetValue(iPad, ACTION_MENU_CANCEL) > 0)// && gameMode->isInputAllowed(ACTION_MENU_CANCEL))
|
||||
{
|
||||
setScreen(NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ wchar_t *Textures::preLoaded[TN_COUNT] =
|
|||
L"gui/gui",
|
||||
L"gui/background",
|
||||
L"gui/icons",
|
||||
L"gui/inventory",
|
||||
L"title/mclogo",
|
||||
L"item/arrows",
|
||||
L"item/boat",
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ typedef enum _TEXTURE_NAME
|
|||
TN_GUI_GUI,
|
||||
TN_GUI_BACKGROUND,
|
||||
TN_GUI_ICONS,
|
||||
TN_GUI_INVENTORY,
|
||||
TN_TITLE_MCLOGO,
|
||||
TN_ITEM_ARROWS,
|
||||
TN_ITEM_BOAT,
|
||||
|
|
|
|||
Loading…
Reference in a new issue