Created
October 11, 2014 05:50
-
-
Save chaosddp/d04060ace2dbe5e249bf to your computer and use it in GitHub Desktop.
Load Image using WaveEngine, image resource is from examples of PhaserJS
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
#region Using Statements | |
using System; | |
using WaveEngine.Common; | |
using WaveEngine.Common.Graphics; | |
using WaveEngine.Common.Math; | |
using WaveEngine.Components.Cameras; | |
using WaveEngine.Components.Graphics2D; | |
using WaveEngine.Components.Graphics3D; | |
using WaveEngine.Framework; | |
using WaveEngine.Framework.Graphics; | |
using WaveEngine.Framework.Resources; | |
using WaveEngine.Framework.Services; | |
#endregion | |
namespace LoadImageProject | |
{ | |
public class MyScene : Scene | |
{ | |
protected override void CreateScene() | |
{ | |
// 首先需要先创建一个Camera | |
// WaveEngine如果添加Camera的话屏幕不会清除,也不会渲染 | |
// 显示图片创建一个2d的就可以了 | |
var camera2d = new FixedCamera2D("Camera2D") { | |
ClearFlags = ClearFlags.DepthAndStencil | |
}; | |
// 加到Manager里,使之生效 | |
EntityManager.Add(camera2d); | |
var img = new Entity() | |
.AddComponent(new Transform2D()) // 2D的坐标, 默认是原点(0, 0) | |
.AddComponent(new Sprite("Content/ein")) // 精灵的纹理是Content文件夹下的ein.wpk,默认名可以省略 | |
.AddComponent(new SpriteRenderer(DefaultLayers.Opaque)); // 精灵的渲染方法,这里不需要透明效果 | |
this.EntityManager.Add(img); | |
} | |
protected override void Start() | |
{ | |
base.Start(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment