コード例 #1
0
ファイル: Calc.cs プロジェクト: patilsameer/csharp
    public static void Main(string[] args)
    {
        Console.WriteLine("The Calc Program is loaded .");
        Math1 obj    = new Math1();
        int   i1     = 10;
        int   i2     = 5;
        int   result = obj.add(i1, i2);

        Console.WriteLine(result);
    }
コード例 #2
0
        public override void Update(GameTime gameTime)
        {
            var components = Registery.GetComponentsOf <TransformComponent>();

            foreach (var c in components)
            {
                c.Position += c.Velocity * (float)gameTime;
                var transform = Math1.Translate(Matrix4.Identity(), c.Position);
                var scale     = Math1.Scale(Matrix4.Identity(), new Vector3(c.Scale));

                c.Transform = transform * scale;
            }
        }
コード例 #3
0
        public override void Update(GameTime gameTime)
        {
            var camera    = Registery.GetComponentsOf <CameraComponent>().FirstOrDefault();
            var transfrom = camera.Record.GetComponent <TransformComponent>();

            switch (camera.CameraType)
            {
            case CameraType.Orthographic:

                camera.ProjectionMatrix = Math1.Ortho(camera.Left, camera.Right, camera.Bottom, camera.Top, -1.0f, 1.0f);
                var transform = Math1.Translate(Matrix4.Identity(), transfrom.Position + transfrom.Velocity * (float)gameTime)
                                * Math1.Rotate(Matrix4.Identity(), Math1.Radians(transfrom.Rotation), new Vector3(0, 0, 1));

                camera.ViewMatrix           = transform.Inverse();
                camera.ViewProjectionMatrix = camera.ProjectionMatrix * camera.ViewMatrix;
                break;
            }

            base.Update(gameTime);
        }
コード例 #4
0
 public OrthographicCamera(float left, float right, float bottom, float top)
 {
     ProjectionMatrix     = Math1.Ortho(left, right, bottom, top, -1.0f, 1.0f);
     ViewMatrix           = Matrix4.Identity();
     ViewProjectionMatrix = ProjectionMatrix * ViewMatrix;
 }