Frame field "Layer" controls render order and prevents event bubbling.
Reworked GUI events.
This commit is contained in:
@@ -139,16 +139,48 @@
|
||||
<Compile Include="scripts\gui.lua">
|
||||
<Name>gui</Name>
|
||||
<Importer>LuaImporter</Importer>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Include="scripts\test.lua">
|
||||
<Name>test</Name>
|
||||
<Importer>LuaImporter</Importer>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="scripts\tooltip.lua">
|
||||
<Name>tooltip</Name>
|
||||
<Importer>LuaImporter</Importer>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="images\GUI\bar_solid.png">
|
||||
<Name>bar_solid</Name>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
</Compile>
|
||||
<Compile Include="images\GUI\bar_transparent.png">
|
||||
<Name>bar_transparent</Name>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
</Compile>
|
||||
<Compile Include="images\GUI\health_background.png">
|
||||
<Name>health_background</Name>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
</Compile>
|
||||
<Compile Include="images\GUI\unit_background.png">
|
||||
<Name>unit_background</Name>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="fonts\UnitName.spritefont">
|
||||
<Name>UnitName</Name>
|
||||
<Importer>FontDescriptionImporter</Importer>
|
||||
<Processor>FontDescriptionProcessor</Processor>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file contains an xml description of a font, and will be read by the XNA
|
||||
Framework Content Pipeline. Follow the comments to customize the appearance
|
||||
of the font in your game, and to change the characters which are available to draw
|
||||
with.
|
||||
-->
|
||||
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
|
||||
<Asset Type="Graphics:FontDescription">
|
||||
|
||||
<!--
|
||||
Modify this string to change the font that will be imported.
|
||||
-->
|
||||
<FontName>Arial</FontName>
|
||||
|
||||
<!--
|
||||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>10</Size>
|
||||
|
||||
<!--
|
||||
Spacing is a float value, measured in pixels. Modify this value to change
|
||||
the amount of spacing in between characters.
|
||||
-->
|
||||
<Spacing>0</Spacing>
|
||||
|
||||
<!--
|
||||
UseKerning controls the layout of the font. If this value is true, kerning information
|
||||
will be used when placing characters.
|
||||
-->
|
||||
<UseKerning>true</UseKerning>
|
||||
|
||||
<!--
|
||||
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
|
||||
and "Bold, Italic", and are case sensitive.
|
||||
-->
|
||||
<Style>Regular</Style>
|
||||
|
||||
<!--
|
||||
If you uncomment this line, the default character will be substituted if you draw
|
||||
or measure text that contains characters which were not included in the font.
|
||||
-->
|
||||
<!-- <DefaultCharacter>*</DefaultCharacter> -->
|
||||
|
||||
<!--
|
||||
CharacterRegions control what letters are available in the font. Every
|
||||
character from Start to End will be built and made available for drawing. The
|
||||
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
|
||||
character set. The characters are ordered according to the Unicode standard.
|
||||
See the documentation for more information.
|
||||
-->
|
||||
<CharacterRegions>
|
||||
<CharacterRegion>
|
||||
<Start> </Start>
|
||||
<End>~</End>
|
||||
</CharacterRegion>
|
||||
</CharacterRegions>
|
||||
</Asset>
|
||||
</XnaContent>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 977 B |
Binary file not shown.
|
After Width: | Height: | Size: 983 B |
Binary file not shown.
|
After Width: | Height: | Size: 1008 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -1,3 +1,6 @@
|
||||
luanet.load_assembly("Microsoft.Xna.Framework")
|
||||
Color = luanet.import_type("Microsoft.Xna.Framework.Color")
|
||||
|
||||
local frame = CreateFrame('Frame');
|
||||
frame.X = 100;
|
||||
|
||||
@@ -9,3 +12,70 @@ button.OnClick = function(clickPos)
|
||||
Console.WriteLine(clickPos.X .. ' ' .. clickPos.Y)
|
||||
end
|
||||
|
||||
|
||||
function CreatePanicFrame(x, y)
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:SetTexture("images/GUI/unit_background")
|
||||
frame.Width = 154
|
||||
frame.Height = 19
|
||||
frame.X = x
|
||||
frame.Y = y
|
||||
|
||||
local healthBg = CreateFrame("Frame", frame)
|
||||
healthBg:SetTexture("images/GUI/health_background")
|
||||
healthBg.Width = 136
|
||||
healthBg.Height = 13
|
||||
healthBg.X = 3
|
||||
healthBg.Y = 3
|
||||
|
||||
local healthBar = CreateFrame("Frame", healthBg)
|
||||
healthBar:SetTexture("images/GUI/bar_solid")
|
||||
healthBar.Color = Color(87, 55, 253)
|
||||
healthBar.Width = healthBg.Width * 0.5
|
||||
healthBar.Height = 11
|
||||
healthBar.X = 1
|
||||
healthBar.Y = 1
|
||||
|
||||
return frame
|
||||
end
|
||||
|
||||
function CreateUnitFrame(name, x, y)
|
||||
-- Frames for one unit
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:SetTexture("images/GUI/unit_background")
|
||||
frame.Width = 164;
|
||||
frame.Height = 35;
|
||||
frame.X = x
|
||||
frame.Y = y
|
||||
|
||||
local nameText = CreateFrame("Text", frame)
|
||||
nameText:SetFont("fonts/UnitName")
|
||||
nameText.Value = name
|
||||
nameText.X = 4
|
||||
nameText.Y = 1
|
||||
|
||||
local healthBg = CreateFrame("Frame", frame)
|
||||
healthBg:SetTexture("images/GUI/health_background")
|
||||
healthBg.Width = 136
|
||||
healthBg.Height = 13
|
||||
healthBg.X = 3
|
||||
healthBg.Y = 19
|
||||
|
||||
local healthBar = CreateFrame("Frame", healthBg)
|
||||
healthBar:SetTexture("images/GUI/bar_solid")
|
||||
healthBar.Color = Color.Red
|
||||
healthBar.Width = healthBg.Width * 0.5
|
||||
healthBar.Height = 11
|
||||
healthBar.X = 1
|
||||
healthBar.Y = 1
|
||||
|
||||
return frame
|
||||
end
|
||||
|
||||
--[[local frame;
|
||||
frame = CreatePanicFrame(0, 0)
|
||||
frame = CreateUnitFrame("Flight captain Rainbow Dash", frame.X, frame.Y + frame.Height)
|
||||
CreateUnitFrame("Mr. Sparkle", frame.X, frame.Y + frame.Height)]]--
|
||||
|
||||
local testFrame = CreateTestFrame()
|
||||
testFrame:SetWidth(1337)
|
||||
Reference in New Issue
Block a user