本文整理汇总了C#中UI.AddElement方法的典型用法代码示例。如果您正苦于以下问题:C# UI.AddElement方法的具体用法?C# UI.AddElement怎么用?C# UI.AddElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI
的用法示例。
在下文中一共展示了UI.AddElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Shown
public override void Shown()
{
try
{
root = new RootDisposable();
VideoTypes videoType;
//video = Video.Init(VideoTypes.D3D11 | VideoTypes.D3D9 | VideoTypes.OpenGL | VideoTypes.XNA | VideoTypes.Vita, out videoType, root, this, true);
video = Video.Init(VideoTypes.D3D11, out videoType, root, this, true);
DiffuseTextureMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null);
DiffuseTextureMaterial.ApplyInstanceConstantsCallback = applyInstanceData;
var materialTypes = new Dictionary<string,Type>();
materialTypes.Add("Material", typeof(DiffuseTextureMaterial));
materialTypes.Add("Material.001", typeof(DiffuseTextureMaterial));
var materialFieldTypes = new List<MaterialFieldBinder>();
materialFieldTypes.Add(new MaterialFieldBinder("Material", "Roxy_dds", "Diffuse"));
materialFieldTypes.Add(new MaterialFieldBinder("Material.001", "Wolf_dds", "Diffuse"));
var extOverrides = new Dictionary<string,string>();
#if SILVERLIGHT || VITA || (LINUX && ARM)
extOverrides.Add(".dds", ".png");
#endif
#if iOS
extOverrides.Add(".dds", ".pvr");
#endif
#if ANDROID
if (((Reign.Video.OpenGL.Video)video).Caps.TextureCompression_ATC) extOverrides.Add(".dds", ".atc");
else if (((Reign.Video.OpenGL.Video)video).Caps.TextureCompression_PVR) extOverrides.Add(".dds", ".pvr");
#endif
var emptyBinders = new List<MaterialFieldBinder>();
model = new Model(video, "Data/boxes.rm", "Data/", materialTypes, emptyBinders, emptyBinders, emptyBinders, emptyBinders, materialFieldTypes, extOverrides, 0, null);
var frame = FrameSize;
viewPort = ViewPortAPI.New(video, 0, 0, frame.Width, frame.Height);
camera = new Camera(viewPort, new Vector3(5, 5, 5), new Vector3(), new Vector3(5, 5+1, 5), 1, 50, MathUtilities.DegToRad(45));
rasterizerState = RasterizerStateAPI.New(video, RasterizerStateDescAPI.New(RasterizerStateTypes.Solid_CullCW));
depthStencilState = DepthStencilStateAPI.New(video, DepthStencilStateDescAPI.New(DepthStencilStateTypes.ReadWrite_Less));
blendState = BlendStateAPI.New(video, BlendStateDescAPI.New(BlendStateTypes.None));
samplerState = SamplerStateAPI.New(video, SamplerStateDescAPI.New(SamplerStateTypes.Linear_Wrap));
InputTypes inputType;
input = Input.Init(InputTypes.WinForms, out inputType, root, this);
mouse = MouseAPI.New(input);
keyboard = KeyboardAPI.New(input);
// -----------------------
FontMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null);
var fontTexture = Texture2DAPI.New(video, "Data/WhiteFont.png", null);
font = new Font(video, FontMaterial.Shader, fontTexture, "Data/WhiteFont.font", null);
UISolidColorMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null);
UISolidTextureMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null);
UISolidTexture2Material.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null);
UISolidTexture3Material.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null);
ui = new UI(root, video, UISolidColorMaterial.Shader, UISolidTextureMaterial.Shader, UISolidTexture2Material.Shader, UISolidTexture3Material.Shader, font, 16, mouse);
button = new Reign.UI.Button(ui, "Hello World!", 10, 10, 128, 32);
ui.AddElement(button);
var idleTexture = Texture2DAPI.New(video, "Data/PlayIdle.png", null);
var rolloverTexture = Texture2DAPI.New(video, "Data/PlayRollover.png", null);
var pressedTexture = Texture2DAPI.New(video, "Data/PlayPressed.png", null);
buttonImage = new ButtonImage(ui, idleTexture, rolloverTexture, pressedTexture, 400, 10, 64, 64);
ui.AddElement(buttonImage);
// -----------------------
loaded = true;
}
catch (Exception e)
{
dispose();
Message.Show("Error", e.Message);
}
}