source: 2014/24/EemeliK/Zombieland/Jypeli/Physics2DDotNet/Interfaces.cs @ 5974

Revision 5974, 3.5 KB checked in by empaheik, 4 years ago (diff)
Line 
1#region MIT License
2/*
3 * Copyright (c) 2005-2008 Jonathan Mark Porter. http://physics2d.googlepages.com/
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22#endregion
23
24
25
26#if UseDouble
27using Scalar = System.Double;
28#else
29using Scalar = System.Single;
30#endif
31using System;
32using System.Collections.ObjectModel;
33
34using AdvanceMath;
35using AdvanceMath.Geometry2D;
36using Physics2DDotNet.Shapes;
37
38namespace Physics2DDotNet
39{
40    public interface IDuplicateable<T>
41#if !(WINDOWS_PHONE || XBOX)
42        : ICloneable
43#endif
44 where T : IDuplicateable<T>
45    {
46        T Duplicate();
47    }
48    public interface IPendable
49    {
50        event EventHandler Pending;
51        event EventHandler Added;
52        event EventHandler<RemovedEventArgs> Removed;
53        event EventHandler LifetimeChanged;
54        bool IsPending { get;}
55        bool IsAdded { get;}
56        Lifespan Lifetime { get; set;}
57        object Tag { get; set;}
58    }
59    public interface IPhysicsEntity : IPendable
60    {
61        PhysicsEngine Engine { get;}
62    }
63    public interface IJoint : IPhysicsEntity
64    {
65        void CheckFrozen();
66        ReadOnlyCollection<Body> Bodies { get;}
67    }
68    /// <summary>
69    /// Describes a Contact in a collision.
70    /// </summary>
71    public interface IContactPointInfo
72    {
73        /// <summary>
74        /// Gets The world coordinates of the contact.
75        /// </summary>
76        Vector2D Position { get;}
77        /// <summary>
78        /// Gets a Direction Vector Pointing away from the Edge.
79        /// </summary>
80        Vector2D Normal { get;}
81        /// <summary>
82        /// Gets The distance the contact is inside the other object.
83        /// </summary>
84        Scalar Distance { get;}
85    }
86
87    public enum ContactState
88    {
89        New,
90        Old,
91        Ended
92    }
93
94    public interface IContact
95    {
96         event EventHandler Updated;
97         event EventHandler Ended;
98
99        /// <summary>
100        /// Gets The First Body that is part of the Contact.
101        /// (The Normal belongs to this Body.)
102        /// </summary>
103        Body Body1 { get;}
104        /// <summary>
105        /// Gets The Second Body that is part of the Contact.
106        /// (The Position of the Vertex belongs to this Body.)
107        /// </summary>
108        Body Body2 { get;}
109        bool IgnoresCollisionResponse { get;}
110        ContactState State { get;}
111        ReadOnlyCollection<IContactPointInfo> Points { get;}
112    }
113}
Note: See TracBrowser for help on using the repository browser.