I'm back with smaller questions this time:
We've managed to restore tooltips in the OpenDungeons project recently and I wanted to try making tooltips display next to the mouse cursor instead of under it.
I tried to follow the tutorial (and I've started updating where I found relevant in regards to the 0.8 version. :]):
http://cegui.org.uk/wiki/Tooltips
The last part doesn't seem to be willing to work for me, though (The one about How to offset the Tooltip so it doesn't render under the mouse).
We made sure to have a OD/Tooltip widget and we link it to the Core/Tooltip widget in the scheme file. Here is the code:
OpenDungeonsSkin.scheme:
Code: Select all
<GUIScheme name="OpenDungeons" version="5">
...
<LookNFeel filename="OpenDungeons.looknfeel" />
<WindowRendererSet filename="CEGUICoreWindowRendererSet" />
...
<FalagardMapping lookNFeel="OD/Tooltip" renderer="Core/Tooltip" targetType="CEGUI/Tooltip" windowType="OD/Tooltip" />
...
</GUIScheme>
The tooltip widget is also defined in our looknfeel file:
OpenDungeons.looknfeel:
Code: Select all
<WidgetLook name="OD/Tooltip">
<NamedArea name="TextArea">
<Area>
<Dim type="LeftEdge"><ImageDim dimension="Width" name="OpenDungeonsSkin/TooltipLeftEdge" /></Dim>
<Dim type="TopEdge"><ImageDim dimension="Height" name="OpenDungeonsSkin/TooltipTopEdge" /></Dim>
<Dim type="RightEdge">
<OperatorDim op="Subtract">
<UnifiedDim scale="1" type="RightEdge" />
<ImageDim dimension="Width" name="OpenDungeonsSkin/TooltipRightEdge" />
</OperatorDim>
</Dim>
<Dim type="BottomEdge">
<OperatorDim op="Subtract">
<UnifiedDim scale="1" type="BottomEdge" />
<ImageDim dimension="Height" name="OpenDungeonsSkin/TooltipBottomEdge" />
</OperatorDim>
</Dim>
</Area>
</NamedArea>
<ImagerySection name="main">
<FrameComponent>
<Area>
<Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
<Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
<Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
<Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
</Area>
<Image component="TopLeftCorner" name="OpenDungeonsSkin/TooltipTopLeft" />
<Image component="TopRightCorner" name="OpenDungeonsSkin/TooltipTopRight" />
<Image component="BottomLeftCorner" name="OpenDungeonsSkin/TooltipBottomLeft" />
<Image component="BottomRightCorner" name="OpenDungeonsSkin/TooltipBottomRight" />
<Image component="LeftEdge" name="OpenDungeonsSkin/TooltipLeftEdge" />
<Image component="RightEdge" name="OpenDungeonsSkin/TooltipRightEdge" />
<Image component="TopEdge" name="OpenDungeonsSkin/TooltipTopEdge" />
<Image component="BottomEdge" name="OpenDungeonsSkin/TooltipBottomEdge" />
<Image component="Background" name="OpenDungeonsSkin/TooltipMiddle" />
</FrameComponent>
</ImagerySection>
<ImagerySection name="label">
<TextComponent>
<Area>
<Dim type="LeftEdge"><ImageDim dimension="Width" name="OpenDungeonsSkin/TooltipLeftEdge" /></Dim>
<Dim type="TopEdge"><ImageDim dimension="Height" name="OpenDungeonsSkin/TooltipTopEdge" /></Dim>
<Dim type="RightEdge">
<OperatorDim op="Subtract"><UnifiedDim scale="1" type="RightEdge" />
<ImageDim dimension="Width" name="OpenDungeonsSkin/TooltipRightEdge" />
</OperatorDim>
</Dim>
<Dim type="BottomEdge">
<OperatorDim op="Subtract"><UnifiedDim scale="1" type="BottomEdge" />
<ImageDim dimension="Height" name="OpenDungeonsSkin/TooltipBottomEdge" />
</OperatorDim>
</Dim>
</Area>
<Colours bottomLeft="FF000000" bottomRight="FF000000" topLeft="FF000000" topRight="FF000000" />
<VertFormat type="CentreAligned" />
<HorzFormat type="CentreAligned" />
</TextComponent>
</ImagerySection>
<StateImagery name="Enabled">
<Layer>
<Section section="main" />
<Section section="label" />
</Layer>
</StateImagery>
<StateImagery name="Disabled">
<Layer>
<Section section="main" />
<Section section="label" />
</Layer>
</StateImagery>
</WidgetLook>
I tried adding the fadein animation between the <WidgetLook> tags, but it seems not to be taken in account while there is no loading warnings in the CEGUI.log file about it.
No fade in, and not offset of the tooltip noticed.
Code: Select all
<AnimationDefinition name="FadeIn" duration="0.33" replayMode="once">
<Affector property="Position" interpolator="UVector2" applicationMethod="relative">
<KeyFrame position="0" value="{{0,12},{0,0}}" />
</Affector>
</AnimationDefinition>
Any ideas?
Also, it seems the tooltip position is updated only when I hover a widget and then quickly move next to it, making the tooltip appear on the previous mouse position. As long as the mouse is within the tooltip area, it seems its position doesn't get updated. Do you know how I could fix this? (An option to let the parent widget get the event or something like that?)
Best regards,