void Init(Platform platform, Engine engine) { Console.WriteLine (fntUvData); s = new SpritePrimitive (engine.PrimitiveRenderer, fntTex); s.SetBlendMode (BlendMode.Default); }
public override void Start() { //var meshAsset = Engine.Assets.Load <MeshAsset> (); //var vb = Platform.Graphics.CreateVertexBuffer (meshAsset.VertexDeclaration, meshAsset.VertexCount); //vb.SetData <REFLECTION> () var ta = Engine.Assets.Load <TextureAsset> ("assets/cvan01.bba"); tex1 = Platform.Graphics.CreateTexture (ta); var tb = Engine.Assets.Load <TextureAsset> ("assets/bg2.bba"); tex2 = Platform.Graphics.CreateTexture (tb); q = new Triple (); q.blend = BlendMode.Default; q.tex = tex1; q.v [0].Colour = Rgba32.Blue; q.v [0].Position.X = 0.0f; q.v [0].Position.Y = 0.0f; q.v [0].UV = new Vector2 (0, 0); q.v [1].Colour = Rgba32.Green; q.v [1].Position.X = 0.5f; q.v [1].Position.Y = 0.5f; q.v [1].UV = new Vector2 (1f, 1f); q.v [2].Colour = Rgba32.Red; q.v [2].Position.X = 0f; q.v [2].Position.Y = 0.5f; q.v [2].UV = new Vector2 (0, 1f); returnScene = this; s = new SpritePrimitive (this.Engine.PrimitiveRenderer, tex2, 64, 64, 256, 256); s.SetBlendMode (BlendMode.Default); var psi = new PrimitiveParticleSystemInfo (); psi.sprite = s; psi.fLifetime = 3f; psi.colColourStart = Rgba32.Red; psi.colColourEnd = Rgba32.Yellow; psi.nEmission = 10; psi.fSpinStart = 0.3f; psi.fRadialAccel = 0.1f; psi.fSpeed = 3f; psi.fSizeVar = 0.1f; ps = new PrimitiveParticleSystem (psi); }
public override void Start() { ShaderAsset unlitShaderAsset = this.Engine.Assets.Load<ShaderAsset> ("assets/unlit.bba"); SpriteTrait.SpriteShader = this.Platform.Graphics.CreateShader (unlitShaderAsset); AppWidth = this.Platform.Status.Width; AppHeight = this.Platform.Status.Height; var ta_za = this.Engine.Assets.Load<TextureAsset> ("assets/zazaka.bba"); texZa = this.Platform.Graphics.CreateTexture (ta_za); // Create the background. var ta_bg = this.Engine.Assets.Load<TextureAsset> ("assets/bg2.bba"); texBg = this.Platform.Graphics.CreateTexture (ta_bg); /* var soBG = this.SceneGraph.CreateSceneObject ("bg"); var spr = soBG.AddTrait <SpriteTrait> (); spr.Width = 64f; spr.Height = 64f; spr.Texture = texBg; spr.Depth = 1f; //spr.Material.Offset = new Vector2 (0.5f, 0.5f); spr.Material.SetColour ("MaterialColour", Rgba32.Yellow); */ bgSprite = new SpritePrimitive ( this.Engine.PrimitiveRenderer, texBg, 64, 64, this.Platform.Host.ScreenSpecification.ScreenResolutionWidth, this.Platform.Host.ScreenSpecification.ScreenResolutionHeight); Single pi = 0; Maths.Pi (out pi); var newCamSo = this.SceneGraph.CreateSceneObject ("ortho"); newCamSo.Transform.LocalPosition = new Vector3 (0, 0, 1); var orthoCam = newCamSo.AddTrait<CameraTrait>(); orthoCam.NearPlaneDistance = 0; orthoCam.FarPlaneDistance = 2; orthoCam.Projection = CameraProjectionType.Orthographic; orthoCam.TempWORKOUTANICERWAY = true; this.RuntimeConfiguration.SetRenderPassCameraTo ("Debug", newCamSo); this.RuntimeConfiguration.SetRenderPassCameraTo ("Default", newCamSo); this.Configuration.BackgroundColour = Rgba32.Aquamarine; while (hares.Count != Settings.MaxHares) { var so = this.SceneGraph.CreateSceneObject ("hare #" + hares.Count); var hareTrait = so.AddTrait<Hare>(); hares.Add (hareTrait); } for (Int32 i = 0; i < hares.Count; ++i) { var hareTrait = hares[i]; hareTrait.Parent.Enabled = (i < currentNumHares); } this.Engine.InputEventSystem.Tap += this.HandleTap; }
/// <summary> /// Creates a new sprite object by cloning an existing sprite object. /// </summary> public SpritePrimitive(PrimitiveRenderer zPrimitiveRenderer, SpritePrimitive zFrom) { primitiveRenderer = zPrimitiveRenderer; quad = new Quad(quad); texX = zFrom.texX; texY = zFrom.texY; sprWidth = zFrom.sprWidth; sprHeight = zFrom.sprHeight; textureWidth = zFrom.textureWidth; textureHeight = zFrom.textureHeight; hotX = zFrom.hotX; hotY = zFrom.hotY; bXFlip = zFrom.bXFlip; bYFlip = zFrom.bYFlip; bHSFlip = zFrom.bHSFlip; }