public GUI(string textureName, string defaultFontName, int defaultFontSize) { PlatformManager = new PlatformManager(CreateWxPlatformManager()); Engine = new Engine(PlatformManager); Engine.Init(); // Search for the location of the main assets folder. string assetsPath; if (!SearchForAssetsDirectory(out assetsPath)) throw new Exception("Editor assets were not found"); Archive = new ArchiveVirtual(); Archive.MountDirectories(assetsPath, Allocator.GetHeap()); ResourceManager = Engine.ResourceManager; ResourceManager.Archive = Archive; WindowManager = Engine.WindowManager; MainWindow = CreateWindow(); var context = MainWindow.CreateContext(new RenderContextSettings()); MainView = MainWindow.CreateView(); MainView.ClearColor = Color.Red; MainWindow.MakeCurrent(); context.Init(); RenderDevice = Engine.RenderDevice; RenderDevice.ActiveView = MainView; var options = new ResourceLoadOptions {Name = textureName, AsynchronousLoad = false}; var imageHandle = ResourceManager.LoadResource<Image>(options); if (imageHandle.Id == 0) return; Renderer = new GwenRenderer(); Skin = new TexturedSkin(Renderer, imageHandle, new Flood.GUI.Font(defaultFontName, defaultFontSize)); if (!Directory.Exists(StoredValuesDirectory)) Directory.CreateDirectory(StoredValuesDirectory); }
public EditorBase() { PlatformManager = new PlatformManager(CreateWxPlatformManager()); Engine = new Engine(PlatformManager); Engine.Init(); // Search for the location of the main assets folder. string assetsPath; if (!SearchForAssetsDirectory(out assetsPath)) throw new Exception("Editor assets were not found"); Archive = new ArchiveVirtual(); Archive.MountDirectories(assetsPath, Allocator.GetHeap()); ResourceManager = Engine.ResourceManager; ResourceManager.Archive = Archive; EditorWindow = new EditorWindow(); WindowManager = Engine.WindowManager; MainWindow = CreateWindow(); var context = MainWindow.CreateContext(new RenderContextSettings()); MainView = MainWindow.CreateView(); MainView.ClearColor = Color.Red; MainWindow.Idle += Update; MainWindow.Render += Render; MainWindow.TargetResize += Resize; MainWindow.Show(true); MainWindow.MakeCurrent(); context.Init(); RenderDevice = Engine.RenderDevice; }
public Application() { PlatformManager = new PlatformManager(CreateWxPlatformManager()); Engine = new Engine(PlatformManager); Engine.Init(); // Search for the location of the main assets folder. string assetsPath; if (!SearchForAssetsDirectory(out assetsPath)) throw new Exception("Editor assets were not found"); Archive = new ArchiveVirtual(); Archive.MountDirectories(assetsPath, Allocator.GetHeap()); ResourceManager = Engine.ResourceManager; ResourceManager.Archive = Archive; NativeWindowManager = Engine.WindowManager; RenderDevice = Engine.RenderDevice; ModuleManager = new ModuleManager(); RemotingManager = new RemotingManager(ModuleManager); ModuleManager.Init(RemotingManager.ServiceManager); //Initiate global services WindowManager = new Windows.WindowManager(this); RemotingManager.ServiceManager.GetCreateImplementation<IWindowManager>(WindowManager); // FIXME: Introduce a better system to get at global objects (dependency injection?) RemotingManager.ServiceManager.Application = this; }