New dialog type for tooltips etc
This commit is contained in:
@@ -22,6 +22,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
class BackgroundWidget : Widget
|
||||
{
|
||||
public readonly string Background = "dialog";
|
||||
public override void Draw(World world)
|
||||
{
|
||||
if (!Visible)
|
||||
@@ -30,7 +31,7 @@ namespace OpenRA.Widgets
|
||||
return;
|
||||
}
|
||||
|
||||
WidgetUtils.DrawPanel("dialog", Bounds, null);
|
||||
WidgetUtils.DrawPanel(Background, Bounds, null);
|
||||
base.Draw(world);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace OpenRA.Widgets
|
||||
void DrawSupportPowerTooltip(World world, SupportPower sp, int2 pos)
|
||||
{
|
||||
var tooltipBounds = new Rectangle(pos.X,pos.Y,400,100);
|
||||
WidgetUtils.DrawPanel("dialog", tooltipBounds, null);
|
||||
WidgetUtils.DrawPanel("dialog4", tooltipBounds, null);
|
||||
|
||||
pos += new int2(5, 5);
|
||||
Game.chrome.renderer.BoldFont.DrawText(Game.chrome.rgbaRenderer, sp.Info.Description, pos, Color.White);
|
||||
|
||||
@@ -48,14 +48,18 @@ namespace OpenRA.Widgets
|
||||
var r = Game.chrome.renderer;
|
||||
var sr = Game.chrome.rgbaRenderer;
|
||||
|
||||
r.Device.EnableScissor(Bounds.Left, Bounds.Top, Bounds.Width, Bounds.Height);
|
||||
|
||||
var images = new[] { "border-t", "border-b", "border-l", "border-r", "corner-tl", "corner-tr", "corner-bl", "corner-br", "background" };
|
||||
var ss = images.Select(i => ChromeProvider.GetImage(Game.chrome.renderer, collection, i)).ToArray();
|
||||
|
||||
|
||||
// Don't draw the background below the bottom/right borders
|
||||
r.Device.EnableScissor(Bounds.Left, Bounds.Top, Bounds.Width - (int)ss[3].size.X, Bounds.Height - (int)ss[1].size.Y);
|
||||
for (var x = Bounds.Left + (int)ss[2].size.X; x < Bounds.Right - (int)ss[3].size.X; x += (int)ss[8].size.X)
|
||||
for (var y = Bounds.Top + (int)ss[0].size.Y; y < Bounds.Bottom - (int)ss[1].size.Y; y += (int)ss[8].size.Y)
|
||||
sr.DrawSprite(ss[8], new float2(x, y), "chrome");
|
||||
|
||||
sr.Flush(); // because the scissor is changing
|
||||
r.Device.EnableScissor(Bounds.Left, Bounds.Top, Bounds.Width, Bounds.Height - (int)ss[1].size.Y);
|
||||
|
||||
//draw borders
|
||||
for (var y = Bounds.Top + (int)ss[0].size.Y; y < Bounds.Bottom - (int)ss[1].size.Y; y += (int)ss[2].size.Y)
|
||||
@@ -64,12 +68,18 @@ namespace OpenRA.Widgets
|
||||
sr.DrawSprite(ss[3], new float2(Bounds.Right - ss[3].size.X, y), "chrome");
|
||||
}
|
||||
|
||||
sr.Flush(); // because the scissor is changing
|
||||
r.Device.EnableScissor(Bounds.Left, Bounds.Top, Bounds.Width - (int)ss[3].size.X, Bounds.Height);
|
||||
|
||||
for (var x = Bounds.Left + (int)ss[2].size.X; x < Bounds.Right - (int)ss[3].size.X; x += (int)ss[0].size.X)
|
||||
{
|
||||
sr.DrawSprite(ss[0], new float2(x, Bounds.Top), "chrome");
|
||||
sr.DrawSprite(ss[1], new float2(x, Bounds.Bottom - ss[1].size.Y), "chrome");
|
||||
}
|
||||
|
||||
sr.Flush(); // because the scissor is changing
|
||||
r.Device.EnableScissor(Bounds.Left, Bounds.Top, Bounds.Width, Bounds.Height);
|
||||
|
||||
sr.DrawSprite(ss[4], new float2(Bounds.Left, Bounds.Top), "chrome");
|
||||
sr.DrawSprite(ss[5], new float2(Bounds.Right - ss[5].size.X, Bounds.Top), "chrome");
|
||||
sr.DrawSprite(ss[6], new float2(Bounds.Left, Bounds.Bottom - ss[6].size.Y), "chrome");
|
||||
|
||||
93
artsrc/ra/dialog4.svg
Normal file
93
artsrc/ra/dialog4.svg
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="64"
|
||||
height="64"
|
||||
id="svg2816"
|
||||
version="1.1"
|
||||
inkscape:version="0.47 r22583"
|
||||
sodipodi:docname="dialog4.svg">
|
||||
<defs
|
||||
id="defs2818">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 526.18109 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||
id="perspective2824" />
|
||||
<inkscape:perspective
|
||||
id="perspective3673"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="3.959798"
|
||||
inkscape:cx="19.463854"
|
||||
inkscape:cy="45.527359"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1244"
|
||||
inkscape:window-height="882"
|
||||
inkscape:window-x="254"
|
||||
inkscape:window-y="40"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata2821">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-988.36218)">
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.75102042;stroke:none"
|
||||
id="rect2826"
|
||||
width="64"
|
||||
height="64"
|
||||
x="0"
|
||||
y="988.36218"
|
||||
rx="5"
|
||||
ry="5"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
<rect
|
||||
inkscape:export-ydpi="90"
|
||||
inkscape:export-xdpi="90"
|
||||
ry="5"
|
||||
rx="5"
|
||||
y="988.36218"
|
||||
x="0"
|
||||
height="64"
|
||||
width="64"
|
||||
id="rect3679"
|
||||
style="fill:none;fill-opacity:0.75102042999999985;stroke:#ffffff;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
@@ -143,6 +143,17 @@
|
||||
<image name="corner-br" x="252" y="252" width="4" height="4" />
|
||||
<image name="background" x="4" y="4" width="248" height="248" />
|
||||
</collection>
|
||||
<collection name="dialog4" src="dialog4.png">
|
||||
<image name="border-t" x="5" y="0" width="52" height="6" />
|
||||
<image name="border-b" x="5" y="59" width="52" height="6" />
|
||||
<image name="border-l" x="0" y="5" width="6" height="54" />
|
||||
<image name="border-r" x="59" y="5" width="6" height="54" />
|
||||
<image name="corner-tl" x="0" y="0" width="6" height="6" />
|
||||
<image name="corner-tr" x="59" y="0" width="6" height="6" />
|
||||
<image name="corner-bl" x="0" y="59" width="6" height="6" />
|
||||
<image name="corner-br" x="59" y="59" width="6" height="6" />
|
||||
<image name="background" x="5" y="5" width="52" height="52" />
|
||||
</collection>
|
||||
<collection name="dialog" src="dialog.png">
|
||||
<image name="background" x="0" y="0" width="624" height="384" />
|
||||
<image name="border-r" x="624" y="0" width="14" height="200" />
|
||||
|
||||
BIN
mods/ra/dialog4.png
Normal file
BIN
mods/ra/dialog4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 584 B |
Reference in New Issue
Block a user