-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented SpriteRenderComponent, sprite-based rendering of an entity
This adds ISpriteRenderComponent interface and its AGSSpriteRenderComponent implementation. SpriteRenderer is supposed to become a rendering "contractor" for 2D sprite-based components, such as ImageComponent or AnimationComponent. SpriteRenderComponent stores a reference to ISpriteProvider, from which it receives "current sprite" to draw. AGSAnimationComponent implements ISpriteProvider. Moved Border and DebugDrawPivot properties from Animation to SpriteRender component. Made GLImageRenderer refer to SpriteRenderComponent for drawing (instead of AnimationComponent). It is assumed, that parts of GLImageRenderer rendering function will be merged into SpriteRenderComponent on later stages.
- Loading branch information
1 parent
1f4ff23
commit 95b565a
Showing
27 changed files
with
527 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.ComponentModel; | ||
|
||
namespace AGS.API | ||
{ | ||
/// <summary> | ||
/// Interface of a single sprite source. | ||
/// </summary> | ||
public interface ISpriteProvider : INotifyPropertyChanged | ||
{ | ||
/// <summary> | ||
/// Gets a sprite to work with. | ||
/// </summary> | ||
/// <value>The sprite.</value> | ||
ISprite Sprite { get; } | ||
} | ||
|
||
/// <summary> | ||
/// A component that renders an entity using 2D sprites. | ||
/// A sprite and other properties may be set either by user or by other components. | ||
/// </summary> | ||
public interface ISpriteRenderComponent : IComponent | ||
{ | ||
/// <summary> | ||
/// Gets sprite to render. | ||
/// </summary> | ||
/// <value>The sprite.</value> | ||
ISprite CurrentSprite { get; } | ||
|
||
/// <summary> | ||
/// Gets or sets sprite provider. | ||
/// </summary> | ||
/// <value>The sprite provider implementation.</value> | ||
ISpriteProvider SpriteProvider { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether the pivot (the pivot point for position/rotate/scale) will | ||
/// be drawn on the screen as a cross. This can be used for debugging the game. | ||
/// </summary> | ||
/// <value><c>true</c> if debug draw pivot; otherwise, <c>false</c>.</value> | ||
bool DebugDrawPivot { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a border that will (optionally) surround the sprite. | ||
/// </summary> | ||
/// <value>The border.</value> | ||
IBorderStyle Border { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.