Awperative Beta 1.0 Complete!
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<dictionary name="project">
|
||||
<words>
|
||||
<w>awlf</w>
|
||||
<w>awperative's</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
@@ -20,6 +20,13 @@ public abstract partial class Component : ComponentDocker
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If the component receives time events or not.
|
||||
/// </summary>
|
||||
public bool Enabled;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Order for when Components are called on. Only applies between Components on the same Docker.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Awperative Components
|
||||
|
||||
### Code and Documentation by Avery Norris
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -15,7 +17,7 @@ an Entity Component system involves 2/3 types of data.
|
||||
|
||||
- **Components** are what we actually care about, shockingly, they are the
|
||||
"Component" in Entity Component System, and you can think about them as the actual
|
||||
scripts or program in your Game, but a little more object oriented.
|
||||
scripts or program in your Game, but a little more object-oriented.
|
||||
|
||||
|
||||
- **GameObjects** are the parents components are glued to, in most Game Libraries and Engines
|
||||
@@ -45,7 +47,7 @@ As of this current version, Awperative's **ECS** has taken on a different form t
|
||||
One of the main **Awperative Principles** is **Generalization**; and during development it became clear
|
||||
GameObjects are unnecessary, which caused them to be replaced by: the **Component**.
|
||||
|
||||
**Components** are a combination of the **GameObjects** and **Components** we discussed earlier. Awperative
|
||||
While they are still called **Components**, Awperative's Components are actually a combination of the **GameObjects** and **Components** we discussed earlier. Awperative
|
||||
does not implement many fancy features out of the box; because of that the traditionally useful GameObjects became
|
||||
obsolete. Objects are also not built to be flexible like Components, leaving empty, nearly static objects floating in
|
||||
our Scenes.
|
||||
@@ -93,7 +95,7 @@ For any further documentation, please refer to the API section of our glorious w
|
||||
|
||||
## Examples and Good Practice
|
||||
|
||||
First let's see how we can recreate typical GameObject Component. I would most recommend using **Nested Components** to acheive this.
|
||||
First let's see how we can recreate typical GameObject Component. I would most recommend using **Nested Components** to achieve this.
|
||||
If we pretend we have implemented a few modules for basic transform profiles and sprite management, then we can easily make a basic movable sprite object.
|
||||
Like so :
|
||||
|
||||
@@ -232,4 +234,4 @@ will cause logged errors, and possibly a runtime error/halt.
|
||||
|
||||
---
|
||||
# End Of Documentation
|
||||
### Written By Avery Norris
|
||||
### Code and Documentation by Avery Norris
|
||||
@@ -11,7 +11,7 @@ namespace Awperative;
|
||||
/// </summary>
|
||||
/// <remarks> Please don't inherit this. I don't know why you would</remarks>
|
||||
/// <author> Avery Norris </author>
|
||||
public abstract partial class ComponentDocker
|
||||
public abstract class ComponentDocker
|
||||
{
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ public abstract partial class ComponentDocker
|
||||
|
||||
|
||||
|
||||
private readonly static Comparer<Component> _componentSorter = Comparer<Component>.Create((a, b) => {
|
||||
int result = b.Priority.CompareTo(a.Priority);
|
||||
return (result != 0) ? result : a.GetHashCode().CompareTo(b.GetHashCode());
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Core of Docker, contains all of our precious Components. Sorts them by their priorities with highest going first.
|
||||
/// If they are equal it defaults to hash codes to ensure consistent Behavior
|
||||
@@ -46,6 +38,16 @@ public abstract partial class ComponentDocker
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// How Priority is sorted.
|
||||
/// </summary>
|
||||
private readonly static Comparer<Component> _componentSorter = Comparer<Component>.Create((a, b) => {
|
||||
int result = b.Priority.CompareTo(a.Priority);
|
||||
return (result != 0) ? result : a.GetHashCode().CompareTo(b.GetHashCode());
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -78,38 +80,38 @@ public abstract partial class ComponentDocker
|
||||
/// Called by Awperative when the game is Closed, sends the event to all children; and they send it to their children.
|
||||
/// </summary>
|
||||
/// <remarks> Will not always trigger if the program is force closed </remarks>
|
||||
internal virtual void ChainUnload() { foreach (Component component in (Component[])[.._Components]) { component.Unload(); component.ChainUnload(); } }
|
||||
internal virtual void ChainUnload() { foreach (Component component in (Component[])[.._Components]) { if(component.Enabled) { component.Unload(); component.ChainUnload(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Called by Awperative when the game is Opened, sends the event to all children; and they send it to their children.
|
||||
/// </summary>
|
||||
internal virtual void ChainLoad() { foreach (Component component in (Component[])[.._Components]) { component.Load(); component.ChainLoad(); } }
|
||||
internal virtual void ChainLoad() { foreach (Component component in (Component[])[.._Components]) { if(component.Enabled) { component.Load(); component.ChainLoad(); } } }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called by Awperative when the game is Updated sends the event to all children; and they send it to their children.
|
||||
/// </summary>
|
||||
internal virtual void ChainUpdate() { foreach (Component component in (Component[])[.._Components]) { component.Update(); component.ChainUpdate(); } }
|
||||
internal virtual void ChainUpdate() { foreach (Component component in (Component[])[.._Components]) { if(component.Enabled) { component.Update(); component.ChainUpdate(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Called by Awperative when the game is Drawn, sends the event to all children; and they send it to their children.
|
||||
/// </summary>
|
||||
/// <remarks> Only use this method for drawing methods</remarks>
|
||||
internal virtual void ChainDraw() { foreach (Component component in (Component[])[.._Components]) { component.Draw(); component.ChainDraw(); } }
|
||||
internal virtual void ChainDraw() { foreach (Component component in (Component[])[.._Components]) { if(component.Enabled) { component.Draw(); component.ChainDraw(); } } }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called by Awperative when this is Created, sends the event to all children; and they send it to their children.
|
||||
/// </summary>
|
||||
internal virtual void ChainCreate() { foreach (Component component in (Component[])[.._Components]) { if(component.Enabled) { component.Create(); component.ChainCreate(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Called by Awperative when this Component is destroyed, sends the event to all children; since they will be Destroyed too. And they send it to their children.
|
||||
/// </summary>
|
||||
/// <remarks> Not called when the game is closed</remarks>
|
||||
internal virtual void ChainDestroy() { foreach(Component component in (Component[])[.._Components]) { component.Destroy(); component.ChainDestroy(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Called by Awperative when this is Created, sends the event to all children; and they send it to their children.
|
||||
/// </summary>
|
||||
internal virtual void ChainCreate() { foreach (Component component in (Component[])[.._Components]) { component.Create(); component.ChainCreate(); } }
|
||||
internal virtual void ChainDestroy() { foreach(Component component in (Component[])[.._Components]) { if(component.Enabled) { component.Destroy(); component.ChainDestroy(); } } }
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user