#include "constants.h"
#include "keycode.h"
#include "strfnd.h"
+#include <IGUICheckBox.h>
+#include <IGUIEditBox.h>
+#include <IGUIButton.h>
+#include <IGUIStaticText.h>
+#include <IGUIFont.h>
+#include "log.h"
void drawInventoryItem(video::IVideoDriver *driver,
gui::IGUIFont *font,
driver->draw2DImage(texture, rect,
core::rect<s32>(core::position2d<s32>(0,0),
core::dimension2di(texture->getOriginalSize())),
- clip, colors, false);
+ clip, colors, true);
}
else
{
if(m_selected_item != NULL && m_selected_item->listname == s.listname
&& m_selected_item->i == i)
{
+ /*s32 border = imgsize.X/12;
+ driver->draw2DRectangle(video::SColor(255,192,192,192),
+ core::rect<s32>(rect.UpperLeftCorner - v2s32(1,1)*border,
+ rect.LowerRightCorner + v2s32(1,1)*border),
+ NULL);
+ driver->draw2DRectangle(video::SColor(255,0,0,0),
+ core::rect<s32>(rect.UpperLeftCorner - v2s32(1,1)*((border+1)/2),
+ rect.LowerRightCorner + v2s32(1,1)*((border+1)/2)),
+ NULL);*/
+ s32 border = 2;
driver->draw2DRectangle(video::SColor(255,255,0,0),
- core::rect<s32>(rect.UpperLeftCorner - v2s32(2,2),
- rect.LowerRightCorner + v2s32(2,2)),
+ core::rect<s32>(rect.UpperLeftCorner - v2s32(1,1)*border,
+ rect.LowerRightCorner + v2s32(1,1)*border),
&AbsoluteClippingRect);
}
+ video::SColor bgcolor(255,128,128,128);
+ driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
+
if(item)
{
drawInventoryItem(driver, font, item,
rect, &AbsoluteClippingRect);
}
- else
- {
- video::SColor bgcolor(255,128,128,128);
- driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
- }
+
}
}
{
if(event.EventType==EET_KEY_INPUT_EVENT)
{
- if(event.KeyInput.Key==KEY_ESCAPE && event.KeyInput.PressedDown)
- {
- quitMenu();
- return true;
- }
- if(event.KeyInput.Key==getKeySetting("keymap_inventory") && event.KeyInput.PressedDown)
+ KeyPress kp(event.KeyInput);
+ if (event.KeyInput.PressedDown && (kp == EscapeKey ||
+ kp == getKeySetting("keymap_inventory")))
{
quitMenu();
return true;
}
if(event.EventType==EET_MOUSE_INPUT_EVENT)
{
- if(event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN
- || event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN)
+ char amount = -1;
+
+ if(event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
+ amount = 0;
+ else if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN)
+ amount = 1;
+ else if(event.MouseInput.Event == EMIE_MMOUSE_PRESSED_DOWN)
+ amount = 10;
+
+ if(amount >= 0)
{
- bool right = (event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN);
v2s32 p(event.MouseInput.X, event.MouseInput.Y);
- //dstream<<"Mouse down at p=("<<p.X<<","<<p.Y<<")"<<std::endl;
+ //infostream<<"Mouse down at p=("<<p.X<<","<<p.Y<<")"<<std::endl;
ItemSpec s = getItemAtPos(p);
if(s.isValid())
{
- dstream<<"Mouse down on "<<s.inventoryname
+ infostream<<"Mouse down on "<<s.inventoryname
<<"/"<<s.listname<<" "<<s.i<<std::endl;
if(m_selected_item)
{
InventoryList *list_to =
inv_to->getList(s.listname);
if(list_from == NULL)
- dstream<<"from list doesn't exist"<<std::endl;
+ infostream<<"from list doesn't exist"<<std::endl;
if(list_to == NULL)
- dstream<<"to list doesn't exist"<<std::endl;
+ infostream<<"to list doesn't exist"<<std::endl;
// Indicates whether source slot completely empties
bool source_empties = false;
if(list_from && list_to
&& list_from->getItem(m_selected_item->i) != NULL)
{
- dstream<<"Handing IACTION_MOVE to manager"<<std::endl;
+ infostream<<"Handing IACTION_MOVE to manager"<<std::endl;
IMoveAction *a = new IMoveAction();
- a->count = right ? 1 : 0;
+ a->count = amount;
a->from_inv = m_selected_item->inventoryname;
a->from_list = m_selected_item->listname;
a->from_i = m_selected_item->i;
}
// Remove selection if target was left-clicked or source
// slot was emptied
- if(right == false || source_empties)
+ if(amount == 0 || source_empties)
{
delete m_selected_item;
m_selected_item = NULL;
{
if(!canTakeFocus(event.GUIEvent.Element))
{
- dstream<<"GUIInventoryMenu: Not allowing focus change."
+ infostream<<"GUIInventoryMenu: Not allowing focus change."
<<std::endl;
// Returning true disables focus change
return true;
while(f.atend() == false)
{
std::string type = trim(f.next("["));
- //dstream<<"type="<<type<<std::endl;
+ //infostream<<"type="<<type<<std::endl;
if(type == "list")
{
std::string name = f.next(";");
s32 pos_y = stoi(f.next(";"));
s32 geom_x = stoi(f.next(","));
s32 geom_y = stoi(f.next(";"));
- dstream<<"list name="<<name<<", subname="<<subname
+ infostream<<"list name="<<name<<", subname="<<subname
<<", pos=("<<pos_x<<","<<pos_y<<")"
<<", geom=("<<geom_x<<","<<geom_y<<")"
<<std::endl;
{
invsize.X = stoi(f.next(","));
invsize.Y = stoi(f.next(";"));
- dstream<<"invsize ("<<invsize.X<<","<<invsize.Y<<")"<<std::endl;
+ infostream<<"invsize ("<<invsize.X<<","<<invsize.Y<<")"<<std::endl;
f.next("]");
}
else
{
// Ignore others
std::string ts = f.next("]");
- dstream<<"Unknown DrawSpec: type="<<type<<", data=\""<<ts<<"\""
+ infostream<<"Unknown DrawSpec: type="<<type<<", data=\""<<ts<<"\""
<<std::endl;
}
}