예제 #1
0
파일: Box.cs 프로젝트: CaptBrick/Playground
 public static Box Create(
         World world, float positionX, float positionY, float width, float height, float density, float friction)
 {
     var result = new Box();
     result.Width = width;
     result.Height = height;
     result.Density = density;
     result.Color = System.Drawing.Color.White;
     result.CreatePhysics(world, positionX, positionY, friction);
     return result;
 }
예제 #2
0
        private void Draw(Box box)
        {
            Gl.glLoadIdentity();
            Gl.glTranslatef(box.Position.X, box.Position.Y, -6f);

            var color = box.Color;
            if (box.IsHot)
            {
                color = System.Drawing.Color.Red;
            }
            this.SetGlColor(color);

            Gl.glRotatef(box.Rotation, 0.0f, 0.0f, 1.0f);
            Gl.glBegin(Gl.GL_QUADS);
            var z = 0.0f;
            var width = box.Width;
            var height = box.Height;
            Gl.glVertex3f(-width, height, z);
            Gl.glVertex3f(width, height, z);
            Gl.glVertex3f(width, -height, z);
            Gl.glVertex3f(-width, -height, z);
            Gl.glEnd();
        }