1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 14:23:53 +00:00

Merge branch 'inventoryGUI' of https://github.com/pchan3/openmw.git into inventoryGUI

Conflicts:
	apps/openmw/mwgui/container.cpp
This commit is contained in:
gugus 2012-04-21 11:08:10 +02:00
commit 93ba773d2e
3 changed files with 20 additions and 19 deletions

View file

@ -28,7 +28,11 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Enviro
mEnvironment(environment) mEnvironment(environment)
{ {
setText("_Main", "Name of Container"); setText("_Main", "Name of Container");
center();
int w = MyGUI::RenderManager::getInstance().getViewSize().width;
int h = MyGUI::RenderManager::getInstance().getViewSize().height;
setCoord(w-600,h-300,600,300);
//center();
adjustWindowCaption(); adjustWindowCaption();
getWidget(containerWidget, "Items"); getWidget(containerWidget, "Items");
@ -109,7 +113,6 @@ void ContainerWindow::open(MWWorld::Ptr& container)
containerStore.add(goldRef.getPtr());*/ containerStore.add(goldRef.getPtr());*/
// ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref = iter->get<ESM::Armor>(); // ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref = iter->get<ESM::Armor>();
@ -120,39 +123,35 @@ void ContainerWindow::open(MWWorld::Ptr& container)
for (MWWorld::ContainerStoreIterator iter (containerStore.begin()); iter!=containerStore.end(); ++iter) for (MWWorld::ContainerStoreIterator iter (containerStore.begin()); iter!=containerStore.end(); ++iter)
{ {
std::string path = std::string("icons\\"); std::string path = std::string("icons\\");
path+=MWWorld::Class::get(*iter).getInventoryIcon(*iter); path+=MWWorld::Class::get(*iter).getInventoryIcon(*iter);
count++; count++;
if(count % 8 == 0) MyGUI::ImageBox* image = containerWidget->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default);
MyGUI::TextBox* text = containerWidget->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(x, y, 18, 18), MyGUI::Align::Default, std::string("Label"));
x += 36;
if(count % 20 == 0)
{ {
y += 36; y += 36;
x = 4; x = 4;
count = 0; count = 0;
} }
x += 36;
MyGUI::ImageBox* image = containerWidget->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default);
MyGUI::TextBox* text = containerWidget->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(x, y, 18, 18), MyGUI::Align::Default, std::string("Label"));
if(iter->getRefData().getCount() > 1) if(iter->getRefData().getCount() > 1)
text->setCaption(boost::lexical_cast<std::string>(iter->getRefData().getCount())); text->setCaption(boost::lexical_cast<std::string>(iter->getRefData().getCount()));
containerWidgets.push_back(image); containerWidgets.push_back(image);
int pos = path.rfind("."); int pos = path.rfind(".");
path.erase(pos); path.erase(pos);
path.append(".dds"); path.append(".dds");
//std::cout << path << std::endl; //std::cout << path << std::endl;
image->setImageTexture(path); image->setImageTexture(path);
} }
setVisible(true); setVisible(true);
} }
@ -163,6 +162,8 @@ void ContainerWindow::Update()
void ContainerWindow::onByeClicked(MyGUI::Widget* _sender) void ContainerWindow::onByeClicked(MyGUI::Widget* _sender)
{ {
mEnvironment.mWindowManager->setGuiMode(MWGui::GuiMode::GM_Game); mEnvironment.mWindowManager->setGuiMode(GM_Game);
setVisible(false);
} }

View file

@ -16,7 +16,7 @@ namespace MWWorld
void ActionOpen::execute (Environment& environment) void ActionOpen::execute (Environment& environment)
{ {
environment.mWindowManager->setGuiMode(MWGui::GuiMode::GM_Container); environment.mWindowManager->setGuiMode(MWGui::GM_Container);
environment.mWindowManager->getContainerWindow()->open(mContainer); environment.mWindowManager->getContainerWindow()->open(mContainer);
} }
} }

View file

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout"> <MyGUI type="Layout">
<Widget type="Window" skin="MW_Window" layer="Windows" position="900 500 600 300" name="_Main"> <Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 600 300" align="Left Bottom" name="_Main">
<!-- HEADER <!-- HEADER -->
<Widget type="TextBox" skin="HeaderText" position="0 0 588 18" name="ContainerName" align="ALIGN_LEFT ALIGN_TOP"> <Widget type="TextBox" skin="HeaderText" position="0 0 588 18" name="ContainerName" align="ALIGN_LEFT ALIGN_TOP">
<Property key="Caption" value="Name"/> <Property key="Caption" value=""/>
<Property key="TextAlign" value="ALIGN_CENTER"/> <Property key="TextAlign" value="ALIGN_CENTER"/>
</Widget>--> </Widget>