コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: zhhwww12/cocos2d-x
        private void DrawingSurface_Loaded(object sender, RoutedEventArgs e)
        {
            if (m_d3dInterop == null)
            {
                m_d3dInterop = new Direct3DInterop();

                // Set window bounds in dips
                m_d3dInterop.WindowBounds = new Windows.Foundation.Size(
                    (float)DrawingSurface.ActualWidth,
                    (float)DrawingSurface.ActualHeight
                    );

                // Set native resolution in pixels
                m_d3dInterop.NativeResolution = new Windows.Foundation.Size(
                    (float)Math.Floor(DrawingSurface.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                    (float)Math.Floor(DrawingSurface.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                    );

                // Set render resolution to the full native resolution
                m_d3dInterop.RenderResolution = m_d3dInterop.NativeResolution;

                // Hook-up native component to DrawingSurfaceBackgroundGrid
                DrawingSurface.SetContentProvider(m_d3dInterop.CreateContentProvider());
                DrawingSurface.SetManipulationHandler(m_d3dInterop);

                m_d3dInterop.SetCocos2dEventDelegate(OnCocos2dEvent);

                EditBoxDelegate editBoxDelegate = new EditBoxDelegate();
                EditBoxImpl     editBoxImpl     = new EditBoxImpl();
                editBoxImpl.setMainPage(this);
                editBoxImpl.setD3dInterop(m_d3dInterop);
                editBoxDelegate.SetCallback(editBoxImpl);
            }
        }
コード例 #2
0
ファイル: EditBox.xaml.cs プロジェクト: namkazt/cocos2d-x
 public EditBox(EditBoxImpl editboxImpl, String strPlaceholder, String strText, int maxLen, int inputMode, int inputFlag)
 {
     m_editBoxImpl = editboxImpl;
     InitializeComponent();
     m_strText = strText;
     m_strPlaceholder = strPlaceholder;
     m_inputFlag = inputFlag;
     initTextinput(maxLen, inputMode);
     this.Loaded += EditBox_Loaded;
 }
コード例 #3
0
 public EditBox(EditBoxImpl editboxImpl, String strPlaceholder, String strText, int maxLen, int inputMode, int inputFlag)
 {
     m_editBoxImpl = editboxImpl;
     InitializeComponent();
     m_strText        = strText;
     m_strPlaceholder = strPlaceholder;
     m_inputFlag      = inputFlag;
     initTextinput(maxLen, inputMode);
     this.Loaded += EditBox_Loaded;
 }
コード例 #4
0
ファイル: MainPage.xaml.cs プロジェクト: namkazt/cocos2d-x
        private void DrawingSurface_Loaded(object sender, RoutedEventArgs e)
        {
            if (m_d3dInterop == null)
            {
                m_d3dInterop = new Direct3DInterop();

                // Set window bounds in dips
                m_d3dInterop.WindowBounds = new Windows.Foundation.Size(
                    (float)DrawingSurface.ActualWidth,
                    (float)DrawingSurface.ActualHeight
                    );

                // Set native resolution in pixels
                m_d3dInterop.NativeResolution = new Windows.Foundation.Size(
                    (float)Math.Floor(DrawingSurface.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                    (float)Math.Floor(DrawingSurface.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                    );

                // Set render resolution to the full native resolution
                m_d3dInterop.RenderResolution = m_d3dInterop.NativeResolution;

                // Hook-up native component to DrawingSurfaceBackgroundGrid
                DrawingSurface.SetContentProvider(m_d3dInterop.CreateContentProvider());
                DrawingSurface.SetManipulationHandler(m_d3dInterop);

                m_d3dInterop.SetCocos2dEventDelegate(OnCocos2dEvent);

                EditBoxDelegate editBoxDelegate = new EditBoxDelegate();
                EditBoxImpl editBoxImpl = new EditBoxImpl();
                editBoxImpl.setMainPage(this);
                editBoxImpl.setD3dInterop(m_d3dInterop);
                editBoxDelegate.SetCallback(editBoxImpl);
            }
        }