当前位置: 首页>>代码示例>>C#>>正文


C# Sprite.Initialize方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Sprite.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.Initialize方法的具体用法?C# Sprite.Initialize怎么用?C# Sprite.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Graphics.Sprite的用法示例。


在下文中一共展示了Sprite.Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        /// <summary>
        /// Allows the app to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            IsMouseVisible = true; // easier for debugging not to "lose" mouse
            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the orientation at launch
            currentOrientation = ApplicationServices.InitialOrientation;

            // Subscribe to surface window availability events
            ApplicationServices.WindowInteractive += OnWindowInteractive;
            ApplicationServices.WindowNoninteractive += OnWindowNoninteractive;
            ApplicationServices.WindowUnavailable += OnWindowUnavailable;

            // Setup the UI to transform if the UI is rotated.
            // Create a rotation matrix to orient the screen so it is viewed correctly
            // when the user orientation is 180 degress different.
            Matrix inverted = Matrix.CreateRotationZ(MathHelper.ToRadians(180)) *
                        Matrix.CreateTranslation(graphics.GraphicsDevice.Viewport.Width,
                                                    graphics.GraphicsDevice.Viewport.Height,
                                                    0);

            if (currentOrientation == UserOrientation.Top)
            {
                screenTransform = inverted;
            }

            screenWidth = Program.WindowSize.Width;
            screenHeight = Program.WindowSize.Height;

            manager = new Manager();
            manager.Initialize(this, touchTarget, Manager.SelectionMode.MONO);
            manager.Behaviour = new BehaviourPlane(screenWidth, screenHeight, _serverIP);

            aircraftCarrier = new Sprite("aircraftCarrier", "aircraftCarrier");
            aircraftCarrier.Initialize(touchTarget);
            aircraftCarrier.Touchable = false;
            manager.Register(aircraftCarrier);

            plane1 = new enib.pa.Plane("plane1");
            plane1.Initialize(touchTarget);
            plane1.Scale = 0.13f;
            plane1.Weight = 1;
            plane1.Rotation = -(float)0;
            plane1.ShowBoundingRect = true;
            plane1.Dragable = false;
            manager.Register(plane1);

            plane2 = new enib.pa.Plane("plane2");
            plane2.Initialize(touchTarget);
            plane2.Scale = 0.13f;
            plane2.Weight = 1;
            plane2.Rotation = (float)Math.PI /2;
            plane2.ShowBoundingRect = true;
            plane2.Dragable = false;
            manager.Register(plane2);

            plane3 = new enib.pa.Plane("plane3");
            plane3.Initialize(touchTarget);
            plane3.Scale = 0.13f;
            plane3.Weight = 1;
            plane3.Rotation = (float)Math.PI;
            plane3.ShowBoundingRect = true;
            plane3.Dragable = false;
            manager.Register(plane3);

            plane4 = new enib.pa.Plane("plane4");
            plane4.Initialize(touchTarget);
            plane4.Scale = 0.13f;
            plane4.Weight = 1;
            plane4.Rotation = -(float)Math.PI / 2;
            plane4.ShowBoundingRect = true;
            plane4.Dragable = false;
            manager.Register(plane4);

            menu_pt1 = new Plane_Menu_Elevator("ascenseur1");
            menu_pt1.setPlaneur(plane1);

            menu_pt2 = new Plane_Menu_Catapulte1("catapulte1");
            menu_pt2.setPlaneur(plane1);

            menu_pt3 = new Plane_Menu_Catapulte2("catapulte2");
            menu_pt3.setPlaneur(plane1);

            menu = new Enib.SurfaceLib.Menu(manager, plane1);
            menu.Initialize(touchTarget);
            menu.addMenuEntry(menu_pt1);
            menu.addMenuEntry(menu_pt2);
            menu.addMenuEntry(menu_pt3);
            menu.Hide();

            base.Initialize();
//.........这里部分代码省略.........
开发者ID:PixelSenseEnib,项目名称:PixelSense,代码行数:101,代码来源:App1.cs

示例2: Initialize

        /// <summary>
        /// Allows the app to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            IsMouseVisible = true; // easier for debugging not to "lose" mouse
            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the orientation at launch
            currentOrientation = ApplicationServices.InitialOrientation;

            // Subscribe to surface window availability events
            ApplicationServices.WindowInteractive += OnWindowInteractive;
            ApplicationServices.WindowNoninteractive += OnWindowNoninteractive;
            ApplicationServices.WindowUnavailable += OnWindowUnavailable;

            // Setup the UI to transform if the UI is rotated.
            // Create a rotation matrix to orient the screen so it is viewed correctly
            // when the user orientation is 180 degress different.
            Matrix inverted = Matrix.CreateRotationZ(MathHelper.ToRadians(180)) *
                       Matrix.CreateTranslation(graphics.GraphicsDevice.Viewport.Width,
                                                 graphics.GraphicsDevice.Viewport.Height,
                                                 0);

            if (currentOrientation == UserOrientation.Top)
            {
                screenTransform = inverted;
            }

            screenWidth = Program.WindowSize.Width;
            screenHeight = Program.WindowSize.Height;

            manager = new Manager();
            manager.Behaviour = new Behaviour(screenWidth, screenHeight);
            manager.Initialize(this, touchTarget, Manager.SelectionMode.NONE);

            batLeft = new Sprite("raquette1", "raquette1");
            batLeft.Initialize(touchTarget);
            batLeft.Weight = 1;
            manager.register(batLeft);

            batRight = new Sprite("raquette2", "raquette2");
            batRight.Initialize(touchTarget);
            batRight.Weight = 1;
            batRight.Position = new Vector2(screenWidth - 140, screenHeight - 455);
            manager.register(batRight);

            bignou = new Sprite("bignou", "paletGame");
            bignou.Initialize(touchTarget);
            bignou.Position = new Vector2((screenWidth - 250) / 2, (screenHeight - 250) / 2);
            manager.register(bignou);

            base.Initialize();
        }
开发者ID:PixelSenseEnib,项目名称:PixelSense,代码行数:60,代码来源:App1.cs


注:本文中的Microsoft.Xna.Framework.Graphics.Sprite.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。