local app = sf.core.g_Application

s4.g_MainLua.LoadScript(_T("scripts/bge/mainwindow.lua"))

local window = s4.bge.CBackgroundEditorMainWindow()
window.Load(app.GetSettings().GetChild(_T("GUI"), false).GetChildByAttribute(_T("window"), _T("id"), _T("bg_editor_main"), true), 
			app.GetSettings().GetChild(_T("GUITemplates"), false))
window.UpdateLayout()
window.LoadBackgrounds() -- only for CBackgroundEditorMainWindow
local window_ptr = sf.gui.CBaseWindowPtrT(window)
app.SetMainWindow(window_ptr)