Ejemplo n.º 1
0
        /// <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
            _manchotsPosition     = Vector2.Zero;
            _manchotsDisplacement = Vector2.One;

            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;
            }

            base.Initialize();
        }
Ejemplo n.º 2
0
        /// <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

            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the current launcher orientation
            currentOrientation = ApplicationLauncher.Orientation;

            // Subscribe to surface application activation events
            ApplicationLauncher.ApplicationActivated   += OnApplicationActivated;
            ApplicationLauncher.ApplicationPreviewed   += OnApplicationPreviewed;
            ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;

            // 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.
            inverted = Matrix.CreateRotationZ(MathHelper.ToRadians(180)) *
                       Matrix.CreateTranslation(graphics.GraphicsDevice.Viewport.Width,
                                                graphics.GraphicsDevice.Viewport.Height,
                                                0);

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

            base.Initialize();
        }
Ejemplo n.º 3
0
        /// <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();
        }
Ejemplo n.º 4
0
        /// <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;

            BignouPosition = Vector2.Zero;
            BignouDep      = Vector2.Zero;

            batLeft = new Bat();
            batLeft.Initialize(touchTarget);
            batRight = new Bat();
            batRight.Initialize(touchTarget);
            batRight.Position = new Vector2(screenWidth - 140, screenHeight - 455);

            /*raquetteGauchePosition = new Vector2(0,0);
             * raquetteGaucheDep = new Vector2(0,1);
             * raquetteGaucheCurrentDep = new Vector2(0, 0);*/

            /*raquetteDroitePosition = new Vector2(screenWidth - 140, screenHeight-455);
             * raquetteDroiteDep = new Vector2(0, 1);
             * raquetteDroiteCurrentDep = new Vector2(0, 0);*/

            //raqetteSpeed = 5;

            base.Initialize();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Reset the application's orientation and transform based on the current launcher orientation.
        /// </summary>
        private void ResetOrientation()
        {
            UserOrientation newOrientation = ApplicationLauncher.Orientation;

            if (newOrientation == currentOrientation)
            {
                return;
            }

            currentOrientation = newOrientation;

            screenTransform = currentOrientation == UserOrientation.Top ? inverted : Matrix.Identity;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ContactDataVisualizer()
        {
            diagrams = new Dictionary<Contact, ContactDiagram>();

            InitializeComponent();
            UpdateStatistics();

            orientation = ApplicationLauncher.Orientation;

            //Event handlers for ContactDown, ContactChanged and LostContactCapture are
            //added in ContactDataVisualizer.xaml.

            sharedController = ContacDataController.Instance;
            serverController = ServerController.Instance;
        }
Ejemplo n.º 7
0
        /// <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

            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the current launcher orientation
            currentOrientation = ApplicationServices.InitialOrientation;

            // Subscribe to surface application activation events
            ApplicationServices.WindowInteractive += OnApplicationActivated;
            //ApplicationLauncher.ApplicationActivated += OnApplicationActivated;

            ApplicationServices.WindowNoninteractive += OnApplicationPreviewed;
            //ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;

            ApplicationServices.WindowUnavailable += OnApplicationPreviewed;
            //ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;

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

            //screenTransform = rotation * translation;
            //}

            base.Initialize();
            //int port = 0;
            //bool parseSucc = int.TryParse(ConfigurationSettings.AppSettings["RemotePort"], out port);
            _OSCSender = new OSCTransmitter(Properties.Settings.Default.RemoteHost, Properties.Settings.Default.RemotePort);
            //_OSCSender = new OSCTransmitter("127.0.0.1", 3333);
            _Frame = 0;
        }
Ejemplo n.º 8
0
        /// <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()
        {
            IsMouseVisible = true; // easier for debugging not to "lose" mouse
            SetWindowOnSurface();
            InitializeSurfaceInput();

            controller = new UIController(touchTarget, HitTestCallback);

            // 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;

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

            PopulateGameWorld();

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

            base.Initialize();
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Allow derived classes to perform additional operations
 /// when orientation changes.  This would be necessary for items not
 /// affected by the SpriteBatch transform.
 /// </summary>
 /// <param name="newOrientation">The new user orientation.</param>
 /// <param name="transform">The transform associated with the new orientation.</param>
 protected virtual void OnOrientationReset(UserOrientation newOrientation, Matrix transform)
 {
     // Empty.
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Updates UIElements when Shell orientation changes.
        /// </summary>
        /// <param name="newOrientation"></param>
        /// <param name="transform"></param>
        public void ResetOrientation(UserOrientation newOrientation, Matrix transform)
        {
            if (newOrientation == currentOrientation) return;

            currentOrientation = newOrientation;
            ScreenTransform = transform;

            OnOrientationReset(newOrientation, transform);

            foreach (UIElement child in children)
            {
                child.ResetOrientation(newOrientation, transform);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Private contructor invoked by overloaded base contructors to build the UIElement.
        /// </summary>
        /// <param name="game"></param>
        /// <param name="controller"></param>
        /// <param name="textureFile"></param>
        /// <param name="texture"></param>
        /// <param name="position">Position of the UIElement (relative or screen coordinates)</param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="parent"></param>
        private UIElement(Game game,
                          UIController controller,
                          string textureFile, Texture2D texture,
                          Vector2? position,
                          int width, int height,
                          UIElement parent)
            : base(game)
        {
            // Should only set one or the other, not both.
            Debug.Assert(textureFile == null || texture == null);

            this.controller = controller;
            this.textureSourceFile = textureFile;
            this.texture = texture;
            this.width = width;
            this.height = height;
            this.parent = parent;

            instanceCount++;
            Name = "UIElement " + instanceCount.ToString(CultureInfo.InvariantCulture);

            if (parent != null)
            {
                // Inherit some properties from the parent (containing) UIElement.
                currentOrientation = parent.currentOrientation;
                screenTransform = parent.ScreenTransform;
                spriteBlendState = parent.SpriteBlendState;
                spriteSortMode = parent.spriteSortMode;

                // Draw children in front of parents.
                layerDepth = parent.layerDepth * 0.9f;

                // Position is a relative to parent's Center.
                if (position != null)
                {
                    relativePosition = Vector2.Clamp(position.Value,
                                                     new Vector2(-0.5f, -0.5f),
                                                     new Vector2(0.5f, 0.5f));
                    Vector2 center = parent.Center;
                    float x = center.X + relativePosition.X * parent.Width;
                    float y = center.Y + relativePosition.Y * parent.Height;
                    Center = new Vector2(x, y);
                }

                // Add this to parent's liest of children.
                parent.AddChild(this);
            }
            else
            {
                // Position is in screen coordinates.
                if (position != null)
                {
                    Center = position.Value;
                }
            }
        }
Ejemplo n.º 12
0
Archivo: App1.cs Proyecto: Ryuzaki/RVTN
        /// <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
            readConfigurationFile();

            Resources.Instance.GraphicsDevice = GraphicsDevice;
            Resources.Instance.Graphics = graphics;
            Resources.Instance.Content = Content;
            Resources.Instance.Game = this;
            TouchPanel.EnabledGestures = GestureType.FreeDrag | GestureType.Tap;
            TouchPanel.WindowHandle = this.Window.Handle;

            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;
            }

            //Custom Initialize
            paseoVirtual = new PaseoVirtual();
            paseoVirtual.Create("PaseoVirtualFast.xml");

            loadingTimerAnimation = new Timer(40); //25 fps
            loadingTimerAnimation.Elapsed += new ElapsedEventHandler(loadingTimerAnimation_Elapsed);
            loadingTimerAnimation.Enabled = true;

            base.Initialize();
        }
Ejemplo n.º 13
0
        /// <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
            Console.WriteLine("Initialisation du jeu");

            loadConfig();

            Background bBackground = new Background(new Vector2(0, 0), Background.Track.Menu);
            DrawableObjects.Add("background", bBackground);

            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;
            }

            base.Initialize();
        }
Ejemplo n.º 14
0
        /// <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

            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the current launcher orientation
            currentOrientation = ApplicationLauncher.Orientation;

            // Subscribe to surface application activation events
            ApplicationLauncher.ApplicationActivated += OnApplicationActivated;
            ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;
            ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;

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

                screenTransform = rotation * translation;
            }
            base.Initialize();
        }
Ejemplo n.º 15
0
    /// <summary>
    /// Reset the application's orientation and transform based on the current launcher orientation.
    /// </summary>
    private void ResetOrientation()
    {
      UserOrientation newOrientation = ApplicationLauncher.Orientation;

      if (newOrientation == currentOrientation) { return; }

      currentOrientation = newOrientation;

      if (currentOrientation == UserOrientation.Top)
      {
        screenTransform = inverted;
      }
      else
      {
        screenTransform = Matrix.Identity;
      }
    }
Ejemplo n.º 16
0
        /// <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()
        {
            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;
            }

            //Setup User and Projectile Managers
            _userManager = new UserManager(this);
            _projectileManager = new ProjectileManager(this);
            _inputManager = new InputManager(this, _userManager, _projectileManager);
            _weaponsManager = new WeaponsManager(this);
            _collisionManager = new CollisionManager(this, _userManager, _projectileManager, _weaponsManager);
            Components.Add(_userManager);
            Components.Add(_projectileManager);
            Components.Add(_inputManager);
            Components.Add(_weaponsManager);
            Components.Add(_collisionManager);

            PubNubObservable.Publish(Constants.SURFACE_CHANNEL, new { start = true });

            base.Initialize();
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Re-orients items not affected by SpriteBatch screenTransform.
 /// </summary>
 /// <remarks>Overrides OnOrientationReset method from UIElement.</remarks>
 /// <param name="newOrientation">The new user orientation.</param>
 /// <param name="transform">The transform associated with the new orientation.</param>
 protected override void OnOrientationReset(UserOrientation newOrientation, Matrix transform)
 {
     // Compute new scissorRectange based on newOrientation.
     if (newOrientation == UserOrientation.Top)
     {
          Vector2 topLeft = new Vector2(scissorRectangle.X, scissorRectangle.Y);
          topLeft = Vector2.Transform(topLeft, transform);
          scissorRectangle = new Rectangle(Convert.ToInt32(topLeft.X) - maxWidth,
                                           Convert.ToInt32(topLeft.Y) - maxHeight,
                                           maxWidth, maxHeight);
     }
     else
     {
          scissorRectangle = new Rectangle(Convert.ToInt32(Left), Convert.ToInt32(Top), maxWidth, maxHeight);
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Resets the application's orientation and screen transform
        /// based on the current launcher orientation.
        /// </summary>
        private void ResetOrientation(UserOrientation newOrientation)
        {
            if (newOrientation == currentOrientation)
            {
                return;
            }

            currentOrientation = newOrientation;

            switch (currentOrientation)
            {
                case UserOrientation.Bottom:
                    screenTransform = Matrix.Identity;
                    break;
                case UserOrientation.Top:
                    screenTransform = inverted;
                    break;
            }

            // Re-orient top-level components.
            textiles.ScreenTransform = screenTransform;
            foreach (GameComponent component in Components)
            {
                UIElement element = component as UIElement;
                if (element != null)
                {
                   if (element == meshCanvas) continue;
                   element.ResetOrientation(newOrientation, screenTransform);
                }
            }
        }
Ejemplo n.º 19
0
        /// <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();
        }
Ejemplo n.º 20
0
        /// <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();
        }
Ejemplo n.º 21
0
        /// <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

            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the current launcher orientation
            currentOrientation = ApplicationServices.InitialOrientation;

            // Subscribe to surface application activation events
            ApplicationServices.WindowInteractive += OnApplicationActivated;
            //ApplicationLauncher.ApplicationActivated += OnApplicationActivated;

            ApplicationServices.WindowNoninteractive += OnApplicationPreviewed;
            //ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;

            ApplicationServices.WindowUnavailable += OnApplicationPreviewed;
            //ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;

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

                //screenTransform = rotation * translation;
            //}

            base.Initialize();
            //int port = 0;
            //bool parseSucc = int.TryParse(ConfigurationSettings.AppSettings["RemotePort"], out port);
            _OSCSender = new OSCTransmitter(Properties.Settings.Default.RemoteHost, Properties.Settings.Default.RemotePort);
            //_OSCSender = new OSCTransmitter("127.0.0.1", 3333);
            _Frame = 0;
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public ContactDiagram(UserOrientation startingOrientation)
 {
     InitializeComponent();
     orientation = startingOrientation;
 }
Ejemplo n.º 23
0
        /// <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();
        }
Ejemplo n.º 24
0
        /// <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;
            }

            graphics.IsFullScreen = true;
            graphics.PreferredBackBufferHeight = GraphicsDevice.Viewport.Height;
            graphics.PreferredBackBufferWidth = GraphicsDevice.Viewport.Width;

            myInitialize();

            base.Initialize();
        }