public static VisualController GetSingleton() { if (instance == null) { Debug.Assert(mainWindow != null); instance = new VisualController(mainWindow);; } return instance; }
public MainWindow() { InitializeComponent(); // 测试Visual VisualController.Initialize(this); visualController = VisualController.GetSingleton(); //TextVisualElement vi = new TextVisualElement("F**k", new Point(200, 200), (SolidColorBrush)App.Current.FindResource("TextBlueBrush")); //visualController.AddVisual(vi); //vi.Start(); // 导航立方 CubeNavigator.InitializeInstance(this); cubeNav = CubeNavigator.GetInstance(); // 纸张纹理选择器 PaperSelector.InitializeInstance(this); paperSelector = PaperSelector.GetInstance(); paperSelector.LoadPaperTextures("media/paper"); // IO控制器 IOController.InitializeInstance(this); ioController = IOController.GetInstance(); // 创建工具 ToolFactory tool = new FoldTool(this); tools.Add(tool); ToolFactory.currentTool = tool; tool = new BlendTool(this); tools.Add(tool); tool = new TuckTool(this); tools.Add(tool); // 杂项 utility = Utility.GetInstance(); utility.UpdateWorlCameMat(); // 注册回调函数 CompositionTarget.Rendering += MainLoop; MouseMove += Window_TranslatePaper; stopwatch.Start(); statsTimer = new System.Windows.Threading.DispatcherTimer(TimeSpan.FromSeconds(1), System.Windows.Threading.DispatcherPriority.Normal, new EventHandler(FrameRateDisplay), this.Dispatcher); CompositionTarget.Rendering += FrameCountPlusPlus; }
public ToolFactory(MainWindow mainWindow) { this.mainWindow = mainWindow; visualController = VisualController.GetSingleton(); }