public Form1() { InitializeComponent(); var timer = new Timer(); timer.Tick += new EventHandler(timer_Tick); timer.Interval = 10; timer.Start(); panel1.MouseMove += panel1_MouseMove; panel1.MouseDown += panel1_MouseDown; panel1.MouseUp += panel1_MouseUp; /* Create a new DirectCanvasFactory. This is the root class * where almost all resources are created */ m_directCanvasFactory = new DirectCanvasFactory(); /* Create a new WindowsFromsPresenter, passing it our factory * and our Winforms control that we want to render to */ m_presenter = new WindowsFormsPresenter(m_directCanvasFactory, panel1); m_geometryScene = new GeometryScene(m_presenter); m_shaderScene = new PixelShaderScene(m_presenter); m_compositorScene = new CompositorScene(m_presenter); m_superblurScene = new SuperBlur(m_presenter); m_transitionScene = new TransitionEffectScene(m_presenter); m_gpgpuScene = new GPGPUScene(m_presenter); m_currentScene = m_gpgpuScene; _touchHandler = Factory.CreateHandler<Windows7.Multitouch.TouchHandler>(panel1); _touchHandler.TouchDown += OnTouchDownHandler; _touchHandler.TouchMove += OnTouchMoveHandler; _touchHandler.TouchUp += OnTouchUpHandler; }
private void InitDirectCanvas() { m_directCanvasFactory = new DirectCanvasFactory(); /* Create a new WindowsFromsPresenter, passing it our factory * and our Winforms control that we want to render to */ m_presenter = new WPFPresenter(m_directCanvasFactory, (int)Width /* Pixel width of our presenter */, (int)Height /* Pixel height of our presenter */, wpfImage /* The WPF Image to render to */); m_presenter.CurrentScene = m_scene; m_presenter.StartRendering(); m_shaderScene = new PixelShaderScene(m_presenter); m_geometryScene = new GeometryScene(m_presenter); m_compositorScene = new CompositorScene(m_presenter); m_superBlurScene = new SuperBlur(m_presenter); m_transitionScene = new TransitionEffectScene(m_presenter); m_scene = m_geometryScene; }