Permalink
Browse files

Added Intellisense summaries for most ComponentMapper.cs and Componen…

…tTypeManager.cs (in both XBOX_PHONE7 and XNA_INDPENDENT projects)
  • Loading branch information...
1 parent a0f5620 commit 619aa80bc638d0bcf00148f95692e2d315338385 @capnjosh1 capnjosh1 committed Feb 22, 2012
@@ -5,18 +5,39 @@ public sealed class ComponentMapper<T> where T : Component {
private ComponentType type;
private EntityManager em;
+
+ /// <summary>
+ /// Allows you to interact with components that are mapped to entities
+ /// </summary>
public ComponentMapper() { }
+
+ /// <summary>
+ /// Creates a component mapper within the given Entity World
+ /// </summary>
+ /// <param name="world">EntityWorld</param>
public ComponentMapper(EntityWorld world) {
this.em = world.GetEntityManager();
this.type = ComponentTypeManager.GetTypeFor<T>();
}
+
+
+ /// <summary>
+ /// Sets the entity manager for this component mapper
+ /// </summary>
+ /// <param name="em">Entity Manager that manages the component</param>
public void SetEntityManager(EntityManager em)
{
this.em = em;
}
-
+
+
+ /// <summary>
+ /// Gets the component for the given entity/component type combo
+ /// </summary>
+ /// <param name="e">Entity in which you are interested</param>
+ /// <returns>Component</returns>
public T Get(Entity e) {
return (T)em.GetComponent(e, type);
}
@@ -5,6 +5,11 @@ namespace Artemis
public static class ComponentTypeManager {
private static Dictionary<Type, ComponentType> componentTypes = new Dictionary<Type, ComponentType>();
+ /// <summary>
+ /// Get the component type for the given component instance
+ /// </summary>
+ /// <typeparam name="T">Component for which you want the component type</typeparam>
+ /// <returns>Component Type</returns>
public static ComponentType GetTypeFor<T>() where T : Component
{
ComponentType type = null;
@@ -16,6 +21,14 @@ public static class ComponentTypeManager {
return type;
}
+
+ /// <summary>
+ /// Ensure the given component type [tag] is an "official" component type for your solution
+ /// If it does not already exist, add it to the bag of available component types
+ /// This is a way you can easily add "official" component types to your solution
+ /// </summary>
+ /// <param name="component">The component type label you want to ensure is an "official" component type</param>
+ /// <returns>ComponentType</returns>
public static ComponentType GetTypeFor(Type component)
{
ComponentType type = null;
@@ -26,6 +39,8 @@ public static ComponentType GetTypeFor(Type component)
return type;
}
+
+
public static long GetBit<T>() where T : Component
{
return GetTypeFor<T>().GetBit();
@@ -5,18 +5,34 @@ public sealed class ComponentMapper<T> where T : Component {
private ComponentType type;
private EntityManager em;
+ /// <summary>
+ /// Allows you to interact with components that are mapped to entities
+ /// </summary>
public ComponentMapper() { }
+ /// <summary>
+ /// Creates a component mapper within the given Entity World
+ /// </summary>
+ /// <param name="world">EntityWorld</param>
public ComponentMapper(EntityWorld world) {
this.em = world.GetEntityManager();
this.type = ComponentTypeManager.GetTypeFor<T>();
}
+ /// <summary>
+ /// Sets the entity manager for this component mapper
+ /// </summary>
+ /// <param name="em">Entity Manager that manages the component</param>
public void SetEntityManager(EntityManager em)
{
this.em = em;
}
+ /// <summary>
+ /// Gets the component for the given entity/component type combo
+ /// </summary>
+ /// <param name="e">Entity in which you are interested</param>
+ /// <returns>Component</returns>
public T Get(Entity e) {
return (T)em.GetComponent(e, type);
}
@@ -5,7 +5,14 @@ namespace Artemis
{
public static class ComponentTypeManager {
private static Dictionary<Type, ComponentType> componentTypes = new Dictionary<Type, ComponentType>();
-
+
+
+
+ /// <summary>
+ /// Get the component type for the given component instance
+ /// </summary>
+ /// <typeparam name="T">Component for which you want the component type</typeparam>
+ /// <returns>Component Type</returns>
public static ComponentType GetTypeFor<T>() where T : Component
{
ComponentType type = null;
@@ -16,7 +23,15 @@ public static class ComponentTypeManager {
}
return type;
}
-
+
+
+ /// <summary>
+ /// Ensure the given component type [tag] is an "official" component type for your solution
+ /// If it does not already exist, add it to the bag of available component types
+ /// This is a way you can easily add "official" component types to your solution
+ /// </summary>
+ /// <param name="component">The component type label you want to ensure is an "official" component type</param>
+ /// <returns>ComponentType</returns>
public static ComponentType GetTypeFor(Type component)
{
ComponentType type = null;

0 comments on commit 619aa80

Please sign in to comment.