mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-20 23:09:42 +00:00
Get rid of markers.png and use original MW texture, cleanup
This commit is contained in:
parent
4f0fc79ea4
commit
97df7c9b22
4 changed files with 87 additions and 59 deletions
|
@ -26,15 +26,55 @@ namespace
|
|||
|
||||
const int cellSize = 8192;
|
||||
|
||||
enum WidgetDepth
|
||||
enum LocalMapWidgetDepth
|
||||
{
|
||||
CompassLayer = 0,
|
||||
MarkerAboveFogLayer = 1,
|
||||
FogLayer = 2,
|
||||
MarkerLayer = 3,
|
||||
MapLayer = 4
|
||||
Local_CompassLayer = 0,
|
||||
Local_MarkerAboveFogLayer = 1,
|
||||
Local_FogLayer = 2,
|
||||
Local_MarkerLayer = 3,
|
||||
Local_MapLayer = 4
|
||||
};
|
||||
|
||||
enum GlobalMapWidgetDepth
|
||||
{
|
||||
Global_CompassLayer = 0,
|
||||
Global_MarkerLayer = 1,
|
||||
Global_ExploreOverlayLayer = 2,
|
||||
Global_MapLayer = 3
|
||||
};
|
||||
|
||||
|
||||
/// @brief A widget that changes its color when hovered.
|
||||
class MarkerWidget: public MyGUI::Widget
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(MarkerWidget)
|
||||
|
||||
public:
|
||||
void setNormalColour(const MyGUI::Colour& colour)
|
||||
{
|
||||
mNormalColour = colour;
|
||||
setColour(colour);
|
||||
}
|
||||
|
||||
void setHoverColour(const MyGUI::Colour& colour)
|
||||
{
|
||||
mHoverColour = colour;
|
||||
}
|
||||
|
||||
private:
|
||||
MyGUI::Colour mNormalColour;
|
||||
MyGUI::Colour mHoverColour;
|
||||
|
||||
void onMouseLostFocus(MyGUI::Widget* _new)
|
||||
{
|
||||
setColour(mNormalColour);
|
||||
}
|
||||
|
||||
void onMouseSetFocus(MyGUI::Widget* _old)
|
||||
{
|
||||
setColour(mHoverColour);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
|
@ -140,7 +180,7 @@ namespace MWGui
|
|||
mLocalMap = widget;
|
||||
mCompass = compass;
|
||||
|
||||
mCompass->setDepth(CompassLayer);
|
||||
mCompass->setDepth(Local_CompassLayer);
|
||||
mCompass->setNeedMouseFocus(false);
|
||||
|
||||
// create 3x3 map widgets, 512x512 each, holding a 1024x1024 texture each
|
||||
|
@ -151,12 +191,12 @@ namespace MWGui
|
|||
MyGUI::ImageBox* map = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||
MyGUI::IntCoord(mx*widgetSize, my*widgetSize, widgetSize, widgetSize),
|
||||
MyGUI::Align::Top | MyGUI::Align::Left);
|
||||
map->setDepth(MapLayer);
|
||||
map->setDepth(Local_MapLayer);
|
||||
|
||||
MyGUI::ImageBox* fog = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||
MyGUI::IntCoord(mx*widgetSize, my*widgetSize, widgetSize, widgetSize),
|
||||
MyGUI::Align::Top | MyGUI::Align::Left);
|
||||
fog->setDepth(FogLayer);
|
||||
fog->setDepth(Local_FogLayer);
|
||||
|
||||
map->setNeedMouseFocus(false);
|
||||
fog->setNeedMouseFocus(false);
|
||||
|
@ -273,15 +313,17 @@ namespace MWGui
|
|||
MyGUI::IntCoord widgetCoord(widgetPos.left - 4,
|
||||
widgetPos.top - 4,
|
||||
8, 8);
|
||||
MyGUI::Button* markerWidget = mLocalMap->createWidget<MyGUI::Button>("ButtonImage",
|
||||
MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("MarkerButton",
|
||||
widgetCoord, MyGUI::Align::Default);
|
||||
markerWidget->setDepth(MarkerAboveFogLayer);
|
||||
markerWidget->setImageResource("DoorMarker");
|
||||
markerWidget->setDepth(Local_MarkerAboveFogLayer);
|
||||
markerWidget->setUserString("ToolTipType", "Layout");
|
||||
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
||||
markerWidget->setUserString("Caption_TextOneLine", MyGUI::TextIterator::toTagsString(marker.mNote));
|
||||
markerWidget->setColour(MyGUI::Colour(1.0,0.3,0.3));
|
||||
markerWidget->setNormalColour(MyGUI::Colour(1.0,0.3,0.3));
|
||||
markerWidget->setHoverColour(MyGUI::Colour(1.0,0.5,0.5));
|
||||
markerWidget->setUserData(marker);
|
||||
markerWidget->setNeedMouseFocus(true);
|
||||
markerWidget->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &LocalMapBase::onCustomMarkerDoubleClicked);
|
||||
mCustomMarkerWidgets.push_back(markerWidget);
|
||||
}
|
||||
|
@ -357,10 +399,12 @@ namespace MWGui
|
|||
widgetPos.top - 4,
|
||||
8, 8);
|
||||
++counter;
|
||||
MyGUI::Button* markerWidget = mLocalMap->createWidget<MyGUI::Button>("ButtonImage",
|
||||
MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("MarkerButton",
|
||||
widgetCoord, MyGUI::Align::Default);
|
||||
markerWidget->setDepth(MarkerLayer);
|
||||
markerWidget->setImageResource("DoorMarker");
|
||||
markerWidget->setNormalColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
|
||||
markerWidget->setHoverColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal_over}")));
|
||||
markerWidget->setDepth(Local_MarkerLayer);
|
||||
markerWidget->setNeedMouseFocus(true);
|
||||
markerWidget->setUserString("ToolTipType", "Layout");
|
||||
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
||||
markerWidget->setUserString("Caption_TextOneLine", marker.name);
|
||||
|
@ -458,7 +502,7 @@ namespace MWGui
|
|||
++counter;
|
||||
MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||
widgetCoord, MyGUI::Align::Default);
|
||||
markerWidget->setDepth(MarkerAboveFogLayer);
|
||||
markerWidget->setDepth(Local_MarkerAboveFogLayer);
|
||||
markerWidget->setImageTexture(markerTexture);
|
||||
markerWidget->setUserString("IsMarker", "true");
|
||||
markerWidget->setUserData(markerPos);
|
||||
|
@ -503,7 +547,7 @@ namespace MWGui
|
|||
8, 8);
|
||||
MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||
widgetCoord, MyGUI::Align::Default);
|
||||
markerWidget->setDepth(MarkerAboveFogLayer);
|
||||
markerWidget->setDepth(Local_MarkerAboveFogLayer);
|
||||
markerWidget->setImageTexture("textures\\menu_map_smark.dds");
|
||||
markerWidget->setUserString("IsMarker", "true");
|
||||
markerWidget->setUserData(markerPos);
|
||||
|
@ -523,7 +567,18 @@ namespace MWGui
|
|||
, mGlobalMap(0)
|
||||
, mGlobalMapRender(0)
|
||||
, mEditNoteDialog()
|
||||
, mEventBoxGlobal(NULL)
|
||||
, mEventBoxLocal(NULL)
|
||||
, mGlobalMapImage(NULL)
|
||||
, mGlobalMapOverlay(NULL)
|
||||
{
|
||||
static bool registered = false;
|
||||
if (!registered)
|
||||
{
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<MarkerWidget>("Widget");
|
||||
registered = true;
|
||||
}
|
||||
|
||||
mEditNoteDialog.setVisible(false);
|
||||
mEditNoteDialog.eventOkClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditOk);
|
||||
mEditNoteDialog.eventDeleteClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditDelete);
|
||||
|
@ -537,6 +592,11 @@ namespace MWGui
|
|||
getWidget(mPlayerArrowLocal, "CompassLocal");
|
||||
getWidget(mPlayerArrowGlobal, "CompassGlobal");
|
||||
|
||||
mPlayerArrowGlobal->setDepth(Global_CompassLayer);
|
||||
mPlayerArrowGlobal->setNeedMouseFocus(false);
|
||||
mGlobalMapImage->setDepth(Global_MapLayer);
|
||||
mGlobalMapOverlay->setDepth(Global_ExploreOverlayLayer);
|
||||
|
||||
mLastScrollWindowCoordinates = mLocalMap->getCoord();
|
||||
mLocalMap->eventChangeCoord += MyGUI::newDelegate(this, &MapWindow::onChangeScrollWindowCoord);
|
||||
|
||||
|
@ -549,6 +609,8 @@ namespace MWGui
|
|||
getWidget(mEventBoxGlobal, "EventBoxGlobal");
|
||||
mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
||||
mEventBoxGlobal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
||||
mEventBoxGlobal->setDepth(Global_ExploreOverlayLayer);
|
||||
|
||||
getWidget(mEventBoxLocal, "EventBoxLocal");
|
||||
mEventBoxLocal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
||||
mEventBoxLocal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
||||
|
@ -683,21 +745,16 @@ namespace MWGui
|
|||
markerSize, markerSize);
|
||||
|
||||
static int _counter=0;
|
||||
MyGUI::Button* markerWidget = mGlobalMapOverlay->createWidget<MyGUI::Button>("ButtonImage",
|
||||
MyGUI::Widget* markerWidget = mGlobalMap->createWidget<MyGUI::Widget>("MarkerButton",
|
||||
widgetCoord, MyGUI::Align::Default);
|
||||
markerWidget->setImageResource("DoorMarker");
|
||||
markerWidget->setNeedMouseFocus(true);
|
||||
markerWidget->setColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
|
||||
markerWidget->setUserString("ToolTipType", "Layout");
|
||||
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
||||
markerWidget->setUserString("Caption_TextOneLine", name);
|
||||
markerWidget->setDepth(Global_MarkerLayer);
|
||||
++_counter;
|
||||
|
||||
markerWidget = mEventBoxGlobal->createWidget<MyGUI::Button>("",
|
||||
widgetCoord, MyGUI::Align::Default);
|
||||
markerWidget->setNeedMouseFocus (true);
|
||||
markerWidget->setUserString("ToolTipType", "Layout");
|
||||
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
||||
markerWidget->setUserString("Caption_TextOneLine", name);
|
||||
|
||||
CellId cell;
|
||||
cell.first = x;
|
||||
cell.second = y;
|
||||
|
@ -829,8 +886,6 @@ namespace MWGui
|
|||
|
||||
while (mEventBoxGlobal->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(mEventBoxGlobal->getChildAt(0));
|
||||
while (mGlobalMapOverlay->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(mGlobalMapOverlay->getChildAt(0));
|
||||
}
|
||||
|
||||
void MapWindow::write(ESM::ESMWriter &writer, Loading::Listener& progress)
|
||||
|
|
|
@ -84,7 +84,6 @@ set(MYGUI_FILES
|
|||
openmw_screen_fader.layout
|
||||
openmw_edit_note.layout
|
||||
DejaVuLGCSansMono.ttf
|
||||
markers.png
|
||||
../launcher/images/openmw.png
|
||||
OpenMWResourcePlugin.xml
|
||||
)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 245 B |
|
@ -25,36 +25,10 @@
|
|||
</Group>
|
||||
</Resource>
|
||||
|
||||
<Resource type="ResourceImageSet" name="DoorMarker">
|
||||
<Group name="States" texture="markers.png" size="8 8">
|
||||
<Index name="disabled">
|
||||
<Frame point="8 0"/>
|
||||
</Index>
|
||||
<Index name="normal">
|
||||
<Frame point="8 0"/>
|
||||
</Index>
|
||||
<Index name="highlighted">
|
||||
<Frame point="0 0"/>
|
||||
</Index>
|
||||
<Index name="pushed">
|
||||
<Frame point="0 0"/>
|
||||
</Index>
|
||||
</Group>
|
||||
</Resource>
|
||||
|
||||
|
||||
|
||||
<!-- Skins -->
|
||||
|
||||
<Resource type="ResourceLayout" name="ButtonImage" version="3.2.0">
|
||||
<Widget type="Widget" skin="Default" position="20 20 16 16" name="Root">
|
||||
<Property key="TextAlign" value="Center"/>
|
||||
<Property key="FontName" value="Default"/>
|
||||
<Property key="ModeImage" value="true"/>
|
||||
<Widget type="ImageBox" skin="ImageBox" position="0 0 16 16" align="Stretch" name="Image">
|
||||
<Property key="NeedMouse" value="false"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
<Resource type="ResourceSkin" name="MarkerButton" size="8 8" texture="textures\door_icon.dds">
|
||||
<BasisSkin type="MainSkin" offset="0 0 8 8" align="Stretch">
|
||||
<State name="normal" offset="0 0 8 8"/>
|
||||
</BasisSkin>
|
||||
</Resource>
|
||||
|
||||
<Resource type="ResourceLayout" name="TabControl" version="3.2.0">
|
||||
|
|
Loading…
Reference in a new issue