本文整理汇总了C#中IRenderer.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderer.Initialize方法的具体用法?C# IRenderer.Initialize怎么用?C# IRenderer.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderer
的用法示例。
在下文中一共展示了IRenderer.Initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpriteBatch
/// <summary>
/// Initializes a new SpriteBatch class.
/// </summary>
/// <param name="graphicsManager">The GraphicsManager.</param>
public SpriteBatch(GraphicsManager graphicsManager)
{
if (!graphicsManager.IsSupported)
throw new NotSupportedException("The specified GraphicsManager is not supported.");
Renderer = graphicsManager.Create();
Renderer.Initialize();
}
示例2: Init
public static void Init(GlobalState state)
{
if (state != null) {
_state = state;
BaseRenderer.UpdateState((BaseRenderer)BackgroundRenderer, state);
BaseRenderer.UpdateState((BaseRenderer)MagicRenderer, state);
}
if (IsInitialized) return;
_deviceManager1 = new CommonDX.DeviceManager();
_deviceManager2 = new CommonDX.DeviceManager();
_renderer1 = new DxRenderer.BackgroundComposer() { State = _state };
_renderer2 = new DxRenderer.MagicComposer() { State = _state };
BackgroundSIS = new SumoNinjaMonkey.Framework.Controls.DrawingSurfaceSIS(
(gt) => { _renderer1.Update(gt); },
(tb) => { _renderer1.Render(tb); },
(dm) => { _renderer1.Initialize(dm); },
(e1, e2) => { _renderer1.InitializeUI(e1, e2); },
(uri) => { _renderer1.LoadLocalAsset(uri); },
() => { _renderer1.Unload(); },
_deviceManager1);
//_renderer1, _deviceManager1);
MagicSIS = new SumoNinjaMonkey.Framework.Controls.DrawingSurfaceSIS(
(gt) => { _renderer2.Update(gt); },
(tb) => { _renderer2.Render(tb); },
(dm) => { _renderer2.Initialize(dm); },
(e1, e2) => { _renderer2.InitializeUI(e1, e2); },
(uri) => { _renderer2.LoadLocalAsset(uri); },
() => { _renderer2.Unload(); },
_deviceManager2);
//_renderer2, _deviceManager2);
IsInitialized = true;
}
示例3: updatePreview
private void updatePreview()
{
Image img = PreviewImage;
if (ir0 != null)
{
ir0.Destroy();
img.Source = null;
ir0 = null;
}
//
if (!FilesManager.Instance.ActiveFile.ActiveState.IsComplete)
return;
FileState altState = new FileState(FilesManager.Instance.ActiveFile.ActiveState, false);
// Find output
Node outputNode = null;
foreach (Node node in altState.Nodes)
{
if (node.inode.IsOutputNode())
{
outputNode = node;
break;
}
}
// Find selected node
oldSelectedVariable = parent.InputVariable;
Node selectedNode = altState.dictionaryOldToNew[oldSelectedVariable.Node];
int oldIndex = oldSelectedVariable.Node.Variables.IndexOf(oldSelectedVariable);
Variable selectedVariable = selectedNode.Variables[oldIndex];
// Remove output input if it was linked
if (outputNode.Variables[0].InputType == Variable.InputTypes.Link)
{
outputNode.Variables[0].GetLinks()[0].removeConnection();
}
// Find var output if it was linked
if (selectedVariable.GetLinks().Count > 0 && FilesManager.Instance.ActiveFile.ActiveState.Renderer != null)
{
Variable outputVariable = selectedVariable.GetLinks()[0].OutputVariable;
// Create a new connection
Connection c = new Connection();
c.OutputVariable = outputVariable;
c.InputVariable = outputNode.Variables[0];
// Compile source
HLSLCompiler comp = new HLSLCompiler(altState);
comp.Compile();
ir0 = FilesManager.Instance.ActiveFile.ActiveState.Renderer.Create();
ImageSource images = ir0.Initialize();
ir0.SetSourceCode(comp.SourceCode);
img.Source = images;
}
}