fehaar / FFWD

This is the FFWD framework for XNA, that allows you to port Unity3D games to XNA for use on WP7 or XBox360 (XBLIG)
Microsoft Public License
133 stars 36 forks source link

[WP7] Skybox, Accelerometer & Gestures #71

Closed Eraile closed 12 years ago

Eraile commented 12 years ago

Hi everyone, I've just began to try your toolset, and it's kinda cool! I've just added Accelerometer Handling, will post it soon :)

But, i've some problems which i'd need to get answers to ^^

  1. Is it possible to get Skyboxes? And how? For the moment, i've spawned 6 cubes with the different textures of the cubemap but it kinda sux...
  2. Gestures? I don't think i've succeeded yet :/

Someone has maybe found something? PressPlay, just bought Tentacles to thank you too, it's a great game, hadn't time to play till now ^^ I hope i'll soon!

fehaar commented 12 years ago

Great with Accelerometer handling. I will merge when you post it.

Regarding Skyboxes. In Unity it would be handled by setting the camera to clear to skybox. But that is not implemented in FFWD as we had no use for it. So the way to go would be to implement that.

Gestures should work. But you have to grab them directly with XNA. Be aware that you can only pull them once per frame, so check if they are pulled in Input. If they are, use them from there.

Eraile commented 12 years ago

Hey mate, where can i send you the code package for the accelerometer?

fehaar commented 12 years ago

If you can make a pull request via GitHub it will be easiest for me.

Eraile commented 11 years ago

Hey mate, forgot to post it... :/ All parts of code with "// ERAILE" or something like this shoud be added.

[...]

if WINDOWS_PHONE

using Microsoft.Xna.Framework.Input.Touch; using Microsoft.Devices.Sensors;

endif

[...] namespace PressPlay.FFWD { public static class Input { // Eraile

if WINDOWS_PHONE

    public static Accelerometer _accelerometer;
    public static Vector3 accelReading = new Vector3();
    public static bool accelActive = false;
#endif

[...] internal static void Initialize() { _touches = new Touch[ApplicationSettings.DefaultCapacities.Touches];

if WINDOWS_PHONE

        /// ERAILE  
        TouchPanel.EnabledGestures = GestureType.Hold;
        /// ERAILE
        _accelerometer = new Accelerometer();

        // Add the accelerometer event handler to the accelerometer sensor.
        _accelerometer.CurrentValueChanged += accelerometer_CurrentValueChanged;

        // Start the accelerometer
        try
        {
            _accelerometer.Start();
            accelActive = true;
        }
        catch (AccelerometerFailedException e)
        {
            // the accelerometer couldn't be started.  No fun!
            accelActive = false;
        }
        catch (UnauthorizedAccessException e)
        {
            // This exception is thrown in the emulator-which doesn't support an accelerometer.
            accelActive = false;
        }

endif

[...]

if WINDOWS_PHONE

    public static void EndAccelerometer()
    {
        // ERAILE
            // Stop the accelerometer if it's active.
        if (Input.accelActive)
        {
            try
            {
                _accelerometer.Stop();
            }
            catch (AccelerometerFailedException e)
            {
                // the accelerometer couldn't be stopped now.
            }
        }
    }

endif

[...]

#if WINDOWS_PHONE
    // ERAILE
    public static void accelerometer_CurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> e)
    {
        accelReading = e.SensorReading.Acceleration;            
    }
#endif
}

}

fehaar commented 11 years ago

Hi Eraile, Could you please make these a real pull request so I can merge it easily?