public static bool SaveAs() { var filter = Resources.GetString("EffekseerParticleFilter"); var result = swig.FileDialog.SaveDialog(filter, System.IO.Directory.GetCurrentDirectory()); if (!string.IsNullOrEmpty(result)) { var filepath = result; if (System.IO.Path.GetExtension(filepath) != ".efkefc") { filepath += ".efkefc"; } Core.SaveTo(filepath); RecentFiles.AddRecentFile(filepath); System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(filepath)); if (Manager.Network.SendOnSave) { Manager.Network.Send(); } return(true); } return(false); }
/// <summary> /// Open a file /// </summary> /// <param name="fullPath">absolute path</param> public static bool Open(string fullPath) { if (System.IO.Path.GetFullPath(fullPath) != fullPath) { throw new Exception(Resources.GetString("NotAbsolutePathError")); } var dialog = new Dialog.SaveOnDisposing( () => { try { if (Core.LoadFrom(fullPath)) { RecentFiles.AddRecentFile(fullPath); } } catch (Exception e) { var messageBox = new Dialog.MessageBox(); messageBox.Show("Error", e.Message); } System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath)); }); return(true); }
/// <summary> /// ファイルを開く /// </summary> /// <param name="fullPath">絶対パス</param> public static bool Open(string fullPath) { if (System.IO.Path.GetFullPath(fullPath) != fullPath) { throw new Exception(Resources.GetString("NotAbsolutePathError")); } if (SaveOnDisposing()) { } else { return(true); } try { if (Core.LoadFrom(fullPath)) { RecentFiles.AddRecentFile(fullPath); } } catch (Exception e) { MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath)); return(true); }
public static bool SaveAs() { SaveFileDialog ofd = new SaveFileDialog(); ofd.InitialDirectory = System.IO.Directory.GetCurrentDirectory(); ofd.Filter = Resources.GetString("ProjectFilter"); ofd.FilterIndex = 2; ofd.OverwritePrompt = true; if (ofd.ShowDialog() == DialogResult.OK) { var filepath = ofd.FileName; Core.SaveTo(filepath); RecentFiles.AddRecentFile(filepath); System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(filepath)); if (Manager.Network.SendOnSave) { Manager.Network.Send(); } } return(true); }
public static void Terminate() { System.IO.Directory.SetCurrentDirectory(GetEntryDirectory()); Manager.NativeManager.SaveDock("config.Dock.config"); SaveWindowConfig("config.Dock.xml"); foreach (var p in panels) { if (p != null) { p.DispatchDisposed(); } } if (effectViewer != null) { effectViewer.DispatchDisposed(); } Shortcuts.SeveShortcuts(); RecentFiles.SaveRecentConfig(); Viewer.HideViewer(); NativeManager.SetCallback(null); NativeManager.Terminate(); Images.Unload(); }
public static void Terminate() { Core.SaveBackup(System.IO.Path.GetTempPath() + "/efk_quit.efkbac"); var entryDirectory = GetEntryDirectory(); System.IO.Directory.SetCurrentDirectory(entryDirectory); SaveWindowConfig(ConfigFilePath); foreach (var p in panels) { if (p != null) { p.DispatchDisposed(); } } if (effectViewer != null) { effectViewer.DispatchDisposed(); } Network.Save(); Shortcuts.SeveShortcuts(); RecentFiles.SaveRecentConfig(); Network.Dispose(); Network = null; Viewer.HideViewer(); Viewer.Dispose(); Viewer = null; if (MainViewImage != null) { MainViewImage.Dispose(); MainViewImage = null; } NativeManager.SetCallback(null); NativeManager.Terminate(); Images.Unload(); if (HardwareDevice != null) { HardwareDevice.Dispose(); HardwareDevice = null; } swig.MainWindow.Terminate(); MainWindow.Dispose(); MainWindow = null; ThumbnailManager.Terminate(); swig.IO.Terminate(); IO.Dispose(); IO = null; }
/// <summary> /// Open a file /// </summary> /// <param name="fullPath">absolute path</param> public static bool Open(string fullPath) { if (!Utils.Misc.IsFullPath(fullPath)) { throw new Exception(Resources.GetString("NotAbsolutePathError")); } fullPath = Utils.Misc.BackSlashToSlash(fullPath); if (Core.IsChanged) { var dialog = new Dialog.SaveOnDisposing( () => { try { if (Core.LoadFrom(fullPath)) { RecentFiles.AddRecentFile(fullPath); System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath)); } else { swig.GUIManager.show(string.Format(Resources.GetString("Error_NotFound"), fullPath), "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); } } catch (Exception e) { HandleExceptionWhileOpenning(e); } }); return(true); } else { try { if (Core.LoadFrom(fullPath)) { RecentFiles.AddRecentFile(fullPath); System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath)); } else { swig.GUIManager.show(string.Format(Resources.GetString("Error_NotFound"), fullPath), "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); } } catch (Exception e) { HandleExceptionWhileOpenning(e); } return(true); } }
public static bool SaveAs() { var filter = Resources.GetString("ProjectFilter"); var result = swig.FileDialog.SaveDialog(filter, System.IO.Directory.GetCurrentDirectory()); if (!string.IsNullOrEmpty(result)) { var filepath = result; if (System.IO.Path.GetExtension(filepath) != ".efkproj") { filepath += ".efkproj"; } Core.SaveTo(filepath); RecentFiles.AddRecentFile(filepath); System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(filepath)); if (Manager.Network.SendOnSave) { Manager.Network.Send(); } return(true); } /* * SaveFileDialog ofd = new SaveFileDialog(); * * ofd.InitialDirectory = System.IO.Directory.GetCurrentDirectory(); * ofd.Filter = Resources.GetString("ProjectFilter"); * ofd.FilterIndex = 2; * ofd.OverwritePrompt = true; * * if (ofd.ShowDialog() == DialogResult.OK) * { * var filepath = ofd.FileName; * Core.SaveTo(filepath); * RecentFiles.AddRecentFile(filepath); * * System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(filepath)); * * if (Manager.Network.SendOnSave) * { * Manager.Network.Send(); * } * } */ return(false); }
/// <summary> /// Open a file /// </summary> /// <param name="fullPath">absolute path</param> public static bool Open(string fullPath) { if (System.IO.Path.GetFullPath(fullPath) != fullPath) { throw new Exception(Resources.GetString("NotAbsolutePathError")); } if (Core.IsChanged) { var dialog = new Dialog.SaveOnDisposing( () => { try { if (Core.LoadFrom(fullPath)) { RecentFiles.AddRecentFile(fullPath); } } catch (Exception e) { swig.GUIManager.show(e.Message, "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); //var messageBox = new Dialog.MessageBox(); //messageBox.Show("Error", e.Message); } System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath)); }); return(true); } else { try { if (Core.LoadFrom(fullPath)) { RecentFiles.AddRecentFile(fullPath); } } catch (Exception e) { swig.GUIManager.show(e.Message, "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); //var messageBox = new Dialog.MessageBox(); //messageBox.Show("Error", e.Message); } System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath)); return(true); } }
public static void Initialize() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); configGuiPath = System.IO.Path.Combine(GetEntryDirectory(), ConfigGuiFileName); configGuiPanelPath = System.IO.Path.Combine(GetEntryDirectory(), ConfigGuiPanelFileName); configNetworkPath = System.IO.Path.Combine(GetEntryDirectory(), ConfigNetworkFileName); Shortcuts.LoadShortcuts(); Commands.Regist(); RecentFiles.LoadRecentConfig(); Network = new Network(new swig.Native()); MainForm = new MainForm(); AboutForm = new AboutForm(); DockViewer = new DockViewer(); DockViewerController = new DockViewerController(); DockViewPoint = new DockViewPoint(); DockRecorder = new GUI.DockRecorder(); DockNodeTreeView = new DockNodeTreeView(); DockNodeCommonValues = new GUI.DockNodeCommonValues(); DockNodeLocationValues = new GUI.DockNodeLocationValues(); DockNodeRotationValues = new GUI.DockNodeRotationValues(); DockNodeScalingValues = new GUI.DockNodeScaleValues(); DockNodeLocationAbsValues = new GUI.DockNodeLocationAbsValues(); DockNodeGenerationLocationValues = new DockNodeGenerationLocationValues(); DockNodeDepthValues = new DockNodeDepthValues(); DockNodeRendererCommonValues = new GUI.DockNodeRendererCommonValues(); DockNodeDrawingValues = new GUI.DockNodeRendererValues(); DockNodeSoundValues = new GUI.DockNodeSoundValues(); DockOption = new GUI.DockOption(); DockGlobal = new GUI.DockGlobal(); DockEffectBehavior = new GUI.DockEffectBehavior(); DockFCurves = new GUI.DockFCurves(); DockCulling = new GUI.DockCulling(); DockNetwork = new GUI.DockNetwork(); DockFileViewer = new GUI.DockFileViewer(); MainForm.Show(); LoadConfig(); DockViewer.ShowViewer(); Core.MainForm = MainForm; }
void ReloadRecentFiles() { recentFiles.DropDownItems.Clear(); var rf = RecentFiles.GetRecentFiles(); foreach (var f in rf) { var item = new ToolStripMenuItem(); var file = f; item.Text = file; item.Click += (object _sender, EventArgs _e) => { Commands.Open(file); }; recentFiles.DropDownItems.Add(item); } }
public static void Terminate() { var entryDirectory = GetEntryDirectory(); System.IO.Directory.SetCurrentDirectory(entryDirectory); Manager.NativeManager.SaveDock(entryDirectory + "/config.Dock.config"); SaveWindowConfig(entryDirectory + "/config.Dock.xml"); foreach (var p in panels) { if (p != null) { p.DispatchDisposed(); } } if (effectViewer != null) { effectViewer.DispatchDisposed(); } Network.Save(); Shortcuts.SeveShortcuts(); RecentFiles.SaveRecentConfig(); Viewer.HideViewer(); NativeManager.SetCallback(null); NativeManager.Terminate(); Images.Unload(); swig.MainWindow.Terminate(); MainWindow.Dispose(); MainWindow = null; ThumbnailManager.Terminate(); swig.IO.Terminate(); IO.Dispose(); IO = null; }
internal static void SaveConfig() { { RecentFiles.SaveRecentConfig(); } { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); System.Xml.XmlElement project_root = doc.CreateElement("GUI"); if (MainForm.WindowState == FormWindowState.Normal) { project_root.AppendChild(doc.CreateTextElement("X", MainForm.Location.X.ToString())); project_root.AppendChild(doc.CreateTextElement("Y", MainForm.Location.Y.ToString())); project_root.AppendChild(doc.CreateTextElement("Width", MainForm.Width.ToString())); project_root.AppendChild(doc.CreateTextElement("Height", MainForm.Height.ToString())); } else // 最小化、最大化中はその前の位置とサイズを保存 { project_root.AppendChild(doc.CreateTextElement("X", MainForm.BeforeResizeLocation.X.ToString())); project_root.AppendChild(doc.CreateTextElement("Y", MainForm.BeforeResizeLocation.Y.ToString())); project_root.AppendChild(doc.CreateTextElement("Width", MainForm.BeforeResizeWidth.ToString())); project_root.AppendChild(doc.CreateTextElement("Height", MainForm.BeforeResizeHeight.ToString())); } doc.AppendChild(project_root); var dec = doc.CreateXmlDeclaration("1.0", "utf-8", null); doc.InsertBefore(dec, project_root); doc.Save(configGuiPath); } MainForm.Panel.SaveAsXml(configGuiPanelPath, Encoding.UTF8); Network.Save(configNetworkPath); }
public static bool Initialize(int width, int height, swig.DeviceType deviceType, Type[] dockTypes_) { dockTypes = dockTypes_; var appDirectory = Manager.GetEntryDirectory(); swig.MainWindowState state = new swig.MainWindowState(); if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) { IsWindowFrameless = true; } // TODO : refactor var windowConfig = new Configs.WindowConfig(); if (windowConfig.Load(ConfigFilePath)) { state.PosX = windowConfig.WindowPosX; state.PosY = windowConfig.WindowPosY; state.Width = windowConfig.WindowWidth; state.Height = windowConfig.WindowHeight; state.IsMaximumMode = windowConfig.WindowIsMaximumMode; } else { state.PosX = -10000; // nodata state.Width = 1280; state.Height = 720; windowConfig = null; } state.IsFrameless = IsWindowFrameless; if (!swig.MainWindow.Initialize("Effekseer", state, false, deviceType == swig.DeviceType.OpenGL)) { return(false); } MainWindow = swig.MainWindow.GetInstance(); swig.IO.Initialize(1000); IO = swig.IO.GetInstance(); ioCallback = new ManagerIOCallback(); IO.AddCallback(ioCallback); Core.OnFileLoaded += (string path) => { #if DEBUG Console.WriteLine("OnFileLoaded : " + path); #endif var f = IO.LoadIPCFile(path); if (f == null) { f = IO.LoadFile(path); } // TODO : refactor it // Permission error if (f != null && f.GetSize() == 0) { var message = MultiLanguageTextProvider.GetText("PermissionError_File"); if (swig.GUIManager.IsMacOSX()) { message += "\n"; message += MultiLanguageTextProvider.GetText("PermissionError_File_Mac"); } message = string.Format(message, System.IO.Path.GetFileName(path)); throw new FileLoadPermissionException(message); } if (f == null) { return(null); } byte[] ret = new byte[f.GetSize()]; System.Runtime.InteropServices.Marshal.Copy(f.GetData(), ret, 0, ret.Length); f.Dispose(); return(ret); }; ThumbnailManager.Initialize(); var mgr = new swig.GUIManager(); if (mgr.Initialize(MainWindow, deviceType)) { } else { mgr.Dispose(); mgr = null; return(false); } Native = new swig.Native(); Viewer = new Viewer(Native); if (!Viewer.ShowViewer(mgr.GetNativeHandle(), state.Width, state.Height, deviceType)) { mgr.Dispose(); mgr = null; return(false); } mgr.InitializeGUI(Native); NativeManager = mgr; Images.Load(GUI.Manager.Native); guiManagerCallback = new GUIManagerCallback(); NativeManager.SetCallback(guiManagerCallback); panels = new Dock.DockPanel[dockTypes.Length]; // Load font UpdateFont(); // Load window icon NativeManager.SetWindowIcon(System.IO.Path.Combine(appDirectory, "resources/icon.png")); // Load config RecentFiles.LoadRecentConfig(); Shortcuts.LoadShortcuts(); Commands.Register(); // Add controls Application.Current.OnCreateMainMenu(); dockManager = new GUI.Dock.DockManager(); GUI.Manager.AddControl(dockManager); // EffectViwer Application.Current.OnCreateEffectViwer(); if (LoadWindowConfig(ConfigFilePath)) { } else { ResetWindow(); } TextOffsetY = (NativeManager.GetTextLineHeightWithSpacing() - NativeManager.GetTextLineHeight()) / 2; Network = new Network(Native); Network.Load(); Command.CommandManager.Changed += OnChanged; Core.EffectBehavior.Location.X.OnChanged += OnChanged; Core.EffectBehavior.Location.Y.OnChanged += OnChanged; Core.EffectBehavior.Location.Z.OnChanged += OnChanged; Core.EffectBehavior.Rotation.X.OnChanged += OnChanged; Core.EffectBehavior.Rotation.Y.OnChanged += OnChanged; Core.EffectBehavior.Rotation.Z.OnChanged += OnChanged; Core.EffectBehavior.Scale.X.OnChanged += OnChanged; Core.EffectBehavior.Scale.Y.OnChanged += OnChanged; Core.EffectBehavior.Scale.Z.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.RemovedTime.Infinite.OnChanged += OnChanged; Core.EffectBehavior.RemovedTime.Value.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.X.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.Y.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.Z.OnChanged += OnChanged; Core.EffectBehavior.CountX.OnChanged += OnChanged; Core.EffectBehavior.CountY.OnChanged += OnChanged; Core.EffectBehavior.CountZ.OnChanged += OnChanged; Core.EffectBehavior.Distance.OnChanged += OnChanged; Core.EffectBehavior.TimeSpan.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.R.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.G.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.B.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.A.OnChanged += OnChanged; Core.EffectBehavior.PlaybackSpeed.OnChanged += OnChanged; Core.Option.Magnification.OnChanged += OnChanged; Core.Option.IsGridShown.OnChanged += OnChanged; Core.Option.GridLength.OnChanged += OnChanged; Core.Option.GridColor.R.OnChanged += OnChanged; Core.Option.GridColor.G.OnChanged += OnChanged; Core.Option.GridColor.B.OnChanged += OnChanged; Core.Option.GridColor.A.OnChanged += OnChanged; Core.Option.FPS.OnChanged += OnChanged; Core.Option.DistortionType.OnChanged += OnChanged; Core.Option.Coordinate.OnChanged += OnChanged; Core.Environment.Background.BackgroundColor.R.OnChanged += OnChanged; Core.Environment.Background.BackgroundColor.G.OnChanged += OnChanged; Core.Environment.Background.BackgroundColor.B.OnChanged += OnChanged; Core.Environment.Background.BackgroundColor.A.OnChanged += OnChanged; Core.Environment.Background.BackgroundImage.OnChanged += OnChanged; Core.Environment.Ground.IsShown.OnChanged += OnChanged; Core.Environment.Ground.Height.OnChanged += OnChanged; Core.Environment.Ground.Extent.OnChanged += OnChanged; Core.Culling.IsShown.OnChanged += OnChanged; Core.Culling.Type.OnChanged += OnChanged; Core.Culling.Sphere.Location.X.OnChanged += OnChanged; Core.Culling.Sphere.Location.Y.OnChanged += OnChanged; Core.Culling.Sphere.Location.Z.OnChanged += OnChanged; Core.Culling.Sphere.Radius.OnChanged += OnChanged; Core.OnAfterLoad += new EventHandler(Core_OnAfterLoad); Core.OnAfterNew += new EventHandler(Core_OnAfterNew); Core.OnReload += new EventHandler(Core_OnReload); // Set imgui path var entryDirectory = GetEntryDirectory(); swig.GUIManager.SetIniFilename(ImGuiIniFilePath); // check files if (!System.IO.File.Exists(System.IO.Path.Combine(appDirectory, "resources/fonts/GenShinGothic-Monospace-Bold.ttf"))) { ErrorUtils.ThrowFileNotfound(); } if (!System.IO.File.Exists(System.IO.Path.Combine(appDirectory, "resources/icons/MenuIcons.png"))) { ErrorUtils.ThrowFileNotfound(); } return(true); }
/// <summary> /// Open a file /// </summary> /// <param name="fullPath">absolute path</param> public static bool Open(string fullPath) { if (System.IO.Path.GetFullPath(fullPath) != fullPath) { throw new Exception(Resources.GetString("NotAbsolutePathError")); } if (Core.IsChanged) { var dialog = new Dialog.SaveOnDisposing( () => { try { if (Core.LoadFrom(fullPath)) { RecentFiles.AddRecentFile(fullPath); System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath)); } else { if (Core.Language == Language.Japanese) { swig.GUIManager.show(fullPath + "が見つかりません。", "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); } else { swig.GUIManager.show(fullPath + " is not found.", "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); } } } catch (Exception e) { swig.GUIManager.show(e.Message, "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); } }); return(true); } else { try { if (Core.LoadFrom(fullPath)) { RecentFiles.AddRecentFile(fullPath); System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath)); } else { if (Core.Language == Language.Japanese) { swig.GUIManager.show(fullPath + "が見つかりません。", "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); } else { swig.GUIManager.show(fullPath + " is not found.", "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); } } } catch (Exception e) { swig.GUIManager.show(e.Message, "Error", swig.DialogStyle.Error, swig.DialogButtons.OK); } return(true); } }
public static bool Initialize(int width, int height) { bool isOpenGLMode = true; var mgr = new swig.GUIManager(); if (mgr.Initialize("Effekseer", 1280, 720, isOpenGLMode, false)) { } else { mgr.Dispose(); mgr = null; return(false); } Native = new swig.Native(); Viewer = new Viewer(Native); if (!Viewer.ShowViewer(mgr.GetNativeHandle(), 1280, 720, isOpenGLMode)) { mgr.Dispose(); mgr = null; return(false); } mgr.InitializeGUI(Native); NativeManager = mgr; Images.Load(GUI.Manager.Native); guiManagerCallback = new GUIManagerCallback(); NativeManager.SetCallback(guiManagerCallback); panels = new Dock.DockPanel[dockTypes.Length]; // Load font NativeManager.AddFontFromFileTTF("resources/GenShinGothic-Monospace-Normal.ttf", 16); // Load config RecentFiles.LoadRecentConfig(); Shortcuts.LoadShortcuts(); Commands.Register(); // Add controls var mainMenu = new GUI.Menu.MainMenu(); GUI.Manager.AddControl(mainMenu); dockManager = new GUI.Dock.DockManager(); GUI.Manager.AddControl(dockManager); // Default effectViewer = new Dock.EffectViwer(); if (dockManager != null) { effectViewer.InitialDockSlot = swig.DockSlot.None; dockManager.Controls.Add(effectViewer); } else { AddControl(effectViewer); } if (LoadWindowConfig("config.Dock.xml")) { Manager.NativeManager.LoadDock("config.Dock.config"); } else { ResetWindowActually(); } Network = new Network(Native); Command.CommandManager.Changed += OnChanged; Core.EffectBehavior.Location.X.OnChanged += OnChanged; Core.EffectBehavior.Location.Y.OnChanged += OnChanged; Core.EffectBehavior.Location.Z.OnChanged += OnChanged; Core.EffectBehavior.Rotation.X.OnChanged += OnChanged; Core.EffectBehavior.Rotation.Y.OnChanged += OnChanged; Core.EffectBehavior.Rotation.Z.OnChanged += OnChanged; Core.EffectBehavior.Scale.X.OnChanged += OnChanged; Core.EffectBehavior.Scale.Y.OnChanged += OnChanged; Core.EffectBehavior.Scale.Z.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.RemovedTime.Infinite.OnChanged += OnChanged; Core.EffectBehavior.RemovedTime.Value.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.X.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.Y.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.Z.OnChanged += OnChanged; Core.EffectBehavior.CountX.OnChanged += OnChanged; Core.EffectBehavior.CountY.OnChanged += OnChanged; Core.EffectBehavior.CountZ.OnChanged += OnChanged; Core.EffectBehavior.Distance.OnChanged += OnChanged; Core.EffectBehavior.TimeSpan.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.R.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.G.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.B.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.A.OnChanged += OnChanged; Core.Option.Magnification.OnChanged += OnChanged; Core.Option.IsGridShown.OnChanged += OnChanged; Core.Option.GridLength.OnChanged += OnChanged; Core.Option.BackgroundColor.R.OnChanged += OnChanged; Core.Option.BackgroundColor.G.OnChanged += OnChanged; Core.Option.BackgroundColor.B.OnChanged += OnChanged; Core.Option.BackgroundColor.A.OnChanged += OnChanged; Core.Option.GridColor.R.OnChanged += OnChanged; Core.Option.GridColor.G.OnChanged += OnChanged; Core.Option.GridColor.B.OnChanged += OnChanged; Core.Option.GridColor.A.OnChanged += OnChanged; Core.Option.FPS.OnChanged += OnChanged; Core.Option.DistortionType.OnChanged += OnChanged; Core.Option.Coordinate.OnChanged += OnChanged; Core.Option.BackgroundImage.OnChanged += OnChanged; Core.Culling.IsShown.OnChanged += OnChanged; Core.Culling.Type.OnChanged += OnChanged; Core.Culling.Sphere.Location.X.OnChanged += OnChanged; Core.Culling.Sphere.Location.Y.OnChanged += OnChanged; Core.Culling.Sphere.Location.Z.OnChanged += OnChanged; Core.Culling.Sphere.Radius.OnChanged += OnChanged; Core.OnAfterLoad += new EventHandler(Core_OnAfterLoad); Core.OnAfterNew += new EventHandler(Core_OnAfterNew); Core.OnReload += new EventHandler(Core_OnReload); return(true); }
public static bool Initialize(int width, int height, swig.DeviceType deviceType) { var mgr = new swig.GUIManager(); if (mgr.Initialize("Effekseer", 1280, 720, deviceType, false)) { } else { mgr.Dispose(); mgr = null; return(false); } Native = new swig.Native(); Viewer = new Viewer(Native); if (!Viewer.ShowViewer(mgr.GetNativeHandle(), 1280, 720, deviceType)) { mgr.Dispose(); mgr = null; return(false); } mgr.InitializeGUI(Native); NativeManager = mgr; Images.Load(GUI.Manager.Native); guiManagerCallback = new GUIManagerCallback(); NativeManager.SetCallback(guiManagerCallback); panels = new Dock.DockPanel[dockTypes.Length]; var appDirectory = Manager.GetEntryDirectory(); // Load font NativeManager.AddFontFromFileTTF(System.IO.Path.Combine(appDirectory, "resources/GenShinGothic-Monospace-Normal.ttf"), 16); // Load window icon NativeManager.SetWindowIcon(System.IO.Path.Combine(appDirectory, "resources/icon.png")); // Load config RecentFiles.LoadRecentConfig(); Shortcuts.LoadShortcuts(); Commands.Register(); // Add controls var mainMenu = new GUI.Menu.MainMenu(); GUI.Manager.AddControl(mainMenu); dockManager = new GUI.Dock.DockManager(); GUI.Manager.AddControl(dockManager); // Default effectViewer = new Dock.EffectViwer(); if (dockManager != null) { effectViewer.InitialDockSlot = swig.DockSlot.None; dockManager.Controls.Add(effectViewer); } else { AddControl(effectViewer); } if (LoadWindowConfig(System.IO.Path.Combine(appDirectory, "config.Dock.xml"))) { Manager.NativeManager.LoadDock(System.IO.Path.Combine(appDirectory, "config.Dock.config")); } else { ResetWindowActually(); } TextOffsetY = (NativeManager.GetTextLineHeightWithSpacing() - NativeManager.GetTextLineHeight()) / 2; Network = new Network(Native); Network.Load(); Command.CommandManager.Changed += OnChanged; Core.EffectBehavior.Location.X.OnChanged += OnChanged; Core.EffectBehavior.Location.Y.OnChanged += OnChanged; Core.EffectBehavior.Location.Z.OnChanged += OnChanged; Core.EffectBehavior.Rotation.X.OnChanged += OnChanged; Core.EffectBehavior.Rotation.Y.OnChanged += OnChanged; Core.EffectBehavior.Rotation.Z.OnChanged += OnChanged; Core.EffectBehavior.Scale.X.OnChanged += OnChanged; Core.EffectBehavior.Scale.Y.OnChanged += OnChanged; Core.EffectBehavior.Scale.Z.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.RemovedTime.Infinite.OnChanged += OnChanged; Core.EffectBehavior.RemovedTime.Value.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.X.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.Y.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.Z.OnChanged += OnChanged; Core.EffectBehavior.CountX.OnChanged += OnChanged; Core.EffectBehavior.CountY.OnChanged += OnChanged; Core.EffectBehavior.CountZ.OnChanged += OnChanged; Core.EffectBehavior.Distance.OnChanged += OnChanged; Core.EffectBehavior.TimeSpan.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.R.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.G.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.B.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.A.OnChanged += OnChanged; Core.Option.Magnification.OnChanged += OnChanged; Core.Option.IsGridShown.OnChanged += OnChanged; Core.Option.GridLength.OnChanged += OnChanged; Core.Option.BackgroundColor.R.OnChanged += OnChanged; Core.Option.BackgroundColor.G.OnChanged += OnChanged; Core.Option.BackgroundColor.B.OnChanged += OnChanged; Core.Option.BackgroundColor.A.OnChanged += OnChanged; Core.Option.GridColor.R.OnChanged += OnChanged; Core.Option.GridColor.G.OnChanged += OnChanged; Core.Option.GridColor.B.OnChanged += OnChanged; Core.Option.GridColor.A.OnChanged += OnChanged; Core.Option.FPS.OnChanged += OnChanged; Core.Option.DistortionType.OnChanged += OnChanged; Core.Option.Coordinate.OnChanged += OnChanged; Core.Option.BackgroundImage.OnChanged += OnChanged; Core.Culling.IsShown.OnChanged += OnChanged; Core.Culling.Type.OnChanged += OnChanged; Core.Culling.Sphere.Location.X.OnChanged += OnChanged; Core.Culling.Sphere.Location.Y.OnChanged += OnChanged; Core.Culling.Sphere.Location.Z.OnChanged += OnChanged; Core.Culling.Sphere.Radius.OnChanged += OnChanged; Core.OnAfterLoad += new EventHandler(Core_OnAfterLoad); Core.OnAfterNew += new EventHandler(Core_OnAfterNew); Core.OnReload += new EventHandler(Core_OnReload); // Set imgui path var entryDirectory = GetEntryDirectory(); swig.GUIManager.SetIniFilename(entryDirectory + "/imgui.ini"); return(true); }
public static bool Initialize(int width, int height, swig.DeviceType deviceType) { var appDirectory = Manager.GetEntryDirectory(); swig.MainWindowState state = new swig.MainWindowState(); // TODO : refactor var windowConfig = new Configs.WindowConfig(); if (windowConfig.Load(System.IO.Path.Combine(appDirectory, "config.Dock.xml"))) { state.PosX = windowConfig.WindowPosX; state.PosY = windowConfig.WindowPosY; state.Width = windowConfig.WindowWidth; state.Height = windowConfig.WindowHeight; state.IsMaximumMode = windowConfig.WindowIsMaximumMode; } else { state.PosX = -10000; // nodata state.Width = 1280; state.Height = 720; windowConfig = null; } if (!swig.MainWindow.Initialize("Effekseer", state, false, deviceType == swig.DeviceType.OpenGL)) { return(false); } MainWindow = swig.MainWindow.GetInstance(); swig.IO.Initialize(1000); IO = swig.IO.GetInstance(); ioCallback = new ManagerIOCallback(); IO.AddCallback(ioCallback); ThumbnailManager.Initialize(); var mgr = new swig.GUIManager(); if (mgr.Initialize(MainWindow, deviceType)) { } else { mgr.Dispose(); mgr = null; return(false); } Native = new swig.Native(); Viewer = new Viewer(Native); if (!Viewer.ShowViewer(mgr.GetNativeHandle(), state.Width, state.Height, deviceType)) { mgr.Dispose(); mgr = null; return(false); } mgr.InitializeGUI(Native); NativeManager = mgr; Images.Load(GUI.Manager.Native); guiManagerCallback = new GUIManagerCallback(); NativeManager.SetCallback(guiManagerCallback); panels = new Dock.DockPanel[dockTypes.Length]; // Load font UpdateFontSize(); // Load window icon NativeManager.SetWindowIcon(System.IO.Path.Combine(appDirectory, "resources/icon.png")); // Load config RecentFiles.LoadRecentConfig(); Shortcuts.LoadShortcuts(); Commands.Register(); // Add controls var mainMenu = new GUI.Menu.MainMenu(); GUI.Manager.AddControl(mainMenu); dockManager = new GUI.Dock.DockManager(); GUI.Manager.AddControl(dockManager); // Default effectViewer = new Dock.EffectViwer(); if (dockManager != null) { effectViewer.InitialDockSlot = swig.DockSlot.None; dockManager.Controls.Add(effectViewer); } else { AddControl(effectViewer); } // TODO : refactor if (LoadWindowConfig(System.IO.Path.Combine(appDirectory, "config.Dock.xml"))) { Manager.NativeManager.LoadDock(System.IO.Path.Combine(appDirectory, "config.Dock.config")); } else { ResetWindowActually(); } TextOffsetY = (NativeManager.GetTextLineHeightWithSpacing() - NativeManager.GetTextLineHeight()) / 2; Network = new Network(Native); Network.Load(); Command.CommandManager.Changed += OnChanged; Core.EffectBehavior.Location.X.OnChanged += OnChanged; Core.EffectBehavior.Location.Y.OnChanged += OnChanged; Core.EffectBehavior.Location.Z.OnChanged += OnChanged; Core.EffectBehavior.Rotation.X.OnChanged += OnChanged; Core.EffectBehavior.Rotation.Y.OnChanged += OnChanged; Core.EffectBehavior.Rotation.Z.OnChanged += OnChanged; Core.EffectBehavior.Scale.X.OnChanged += OnChanged; Core.EffectBehavior.Scale.Y.OnChanged += OnChanged; Core.EffectBehavior.Scale.Z.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.LocationVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.RotationVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.X.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.Y.OnChanged += OnChanged; Core.EffectBehavior.ScaleVelocity.Z.OnChanged += OnChanged; Core.EffectBehavior.RemovedTime.Infinite.OnChanged += OnChanged; Core.EffectBehavior.RemovedTime.Value.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.X.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.Y.OnChanged += OnChanged; Core.EffectBehavior.TargetLocation.Z.OnChanged += OnChanged; Core.EffectBehavior.CountX.OnChanged += OnChanged; Core.EffectBehavior.CountY.OnChanged += OnChanged; Core.EffectBehavior.CountZ.OnChanged += OnChanged; Core.EffectBehavior.Distance.OnChanged += OnChanged; Core.EffectBehavior.TimeSpan.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.R.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.G.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.B.OnChanged += OnChanged; Core.EffectBehavior.ColorAll.A.OnChanged += OnChanged; Core.Option.Magnification.OnChanged += OnChanged; Core.Option.IsGridShown.OnChanged += OnChanged; Core.Option.GridLength.OnChanged += OnChanged; Core.Option.GridColor.R.OnChanged += OnChanged; Core.Option.GridColor.G.OnChanged += OnChanged; Core.Option.GridColor.B.OnChanged += OnChanged; Core.Option.GridColor.A.OnChanged += OnChanged; Core.Option.FPS.OnChanged += OnChanged; Core.Option.DistortionType.OnChanged += OnChanged; Core.Option.Coordinate.OnChanged += OnChanged; Core.Environment.Background.BackgroundColor.R.OnChanged += OnChanged; Core.Environment.Background.BackgroundColor.G.OnChanged += OnChanged; Core.Environment.Background.BackgroundColor.B.OnChanged += OnChanged; Core.Environment.Background.BackgroundColor.A.OnChanged += OnChanged; Core.Environment.Background.BackgroundImage.OnChanged += OnChanged; Core.Culling.IsShown.OnChanged += OnChanged; Core.Culling.Type.OnChanged += OnChanged; Core.Culling.Sphere.Location.X.OnChanged += OnChanged; Core.Culling.Sphere.Location.Y.OnChanged += OnChanged; Core.Culling.Sphere.Location.Z.OnChanged += OnChanged; Core.Culling.Sphere.Radius.OnChanged += OnChanged; Core.OnAfterLoad += new EventHandler(Core_OnAfterLoad); Core.OnAfterNew += new EventHandler(Core_OnAfterNew); Core.OnReload += new EventHandler(Core_OnReload); // Set imgui path var entryDirectory = GetEntryDirectory(); swig.GUIManager.SetIniFilename(entryDirectory + "/imgui.ini"); // check files if (!System.IO.File.Exists(System.IO.Path.Combine(appDirectory, "resources/fonts/GenShinGothic-Monospace-Bold.ttf"))) { ErrorUtils.ThrowFileNotfound(); } return(true); }