yes - window is created within .NET control Load event, then shaders are loaded when scene is opened in editor.
.NET class constructor:
public RendererSurfaceControl
(){ Load
+= new EventHandler
(RendererSurfaceControl_Load
);} .NET Load event handle:
private void RendererSurfaceControl_Load(object sender, EventArgs e)
{
PtakopyskInterface.Instance.Initialize(Handle.ToInt32());
PtakopyskInterface.Instance.SetVerticalSyncEnabled(false);
}
.NET PtakopyskInterface.Initialize()
public bool Initialize(int windowHandle, bool editMode = true)
{
try
{
bool status = _Initialize(windowHandle, editMode);
Console.Write(_PopErrors());
return status;
}
catch (Exception ex) { LogException(ex); return false; }
}
.NET native dll import
[DllImport(DLL, CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.U1)]
private static extern bool _Initialize(int windowHandle, bool editMode);
Native bridge initialization:
bool DLL_EXPORT _Initialize( int windowHandle, bool editMode )
{
return PtakopyskInterface::use().initialize( windowHandle, editMode );
}
Native implementation initialization:
bool PtakopyskInterface::initialize( int windowHandle, bool editMode )
{
if( !windowHandle )
{
m_errors << "Cannot initialize PtakopyskInterface: windowHandle cannot be null!\n";
return false;
}
release();
LOG_SETUP( "PtakopyskInterface.log" );
GameManager::initialize();
GameManager::setEditMode( editMode );
m_renderWindow = xnew sf::RenderWindow( (sf::WindowHandle)windowHandle );
m_gameManager = xnew GameManager();
m_gameManager->RenderWindow = m_renderWindow;
return true;
}