コード例 #1
0
ファイル: Sprite.cs プロジェクト: iq110/csharpgameprogramming
        private void InitVertexPositions(Vector position, double width, double height)
        {
            double halfWidth = width / 2;
            double halfHeight = height / 2;
            // Clockwise creation of two triangles to make a quad.

            // TopLeft, TopRight, BottomLeft
            _vertexPositions[0] = new Vector(position.X - halfWidth, position.Y + halfHeight, position.Z);
            _vertexPositions[1] = new Vector(position.X + halfWidth, position.Y + halfHeight, position.Z);
            _vertexPositions[2] = new Vector(position.X - halfWidth, position.Y - halfHeight, position.Z);

            // TopRight, BottomRight, BottomLeft
            _vertexPositions[3] = new Vector(position.X + halfWidth, position.Y + halfHeight, position.Z);
            _vertexPositions[4] = new Vector(position.X + halfWidth, position.Y - halfHeight, position.Z);
            _vertexPositions[5] = new Vector(position.X - halfWidth, position.Y - halfHeight, position.Z);
        }
コード例 #2
0
ファイル: Sprite.cs プロジェクト: iq110/csharpgameprogramming
 public void SetPosition(Vector position)
 {
     InitVertexPositions(position, GetWidth(), GetHeight());
 }
コード例 #3
0
 public void DrawImmediateModeVertex(Vector position, Color color, Point uvs)
 {
     Gl.glColor4f(color.Red, color.Green, color.Blue, color.Alpha);
     Gl.glTexCoord2f(uvs.X, uvs.Y);
     Gl.glVertex3d(position.X, position.Y, position.Z);
 }