예제 #1
0
파일: LObject.cs 프로젝트: vb0067/LGame
 public static void BottomOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(w / 2 - obj0.GetWidth() / 2,
                      h - obj0.GetHeight());
 }
예제 #2
0
파일: LObject.cs 프로젝트: vb0067/LGame
 public static void LeftOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(0, h / 2 - obj0.GetHeight() / 2);
 }
예제 #3
0
파일: LObject.cs 프로젝트: vb0067/LGame
 public static void RightOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(w - obj0.GetWidth(), h / 2 - obj0.GetHeight()
                      / 2);
 }
예제 #4
0
파일: LObject.cs 프로젝트: vb0067/LGame
 public static void CenterOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(w / 2 - obj0.GetWidth() / 2,
                      h / 2 - obj0.GetHeight() / 2);
 }
예제 #5
0
파일: LObject.cs 프로젝트: vb0067/LGame
 public static void TopOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(w / 2 - h / 2, 0);
 }
예제 #6
0
 public static void RightOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(w - obj0.GetWidth(), h / 2 - obj0.GetHeight()
             / 2);
 }
예제 #7
0
 public static void BottomOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(w / 2 - obj0.GetWidth() / 2,
             h - obj0.GetHeight());
 }
예제 #8
0
 public static void LeftOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(0, h / 2 - obj0.GetHeight() / 2);
 }
예제 #9
0
 public static void TopOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(w / 2 - h / 2, 0);
 }
예제 #10
0
 public static void CenterOn(LObject obj0, int w, int h)
 {
     obj0.SetLocation(w / 2 - obj0.GetWidth() / 2,
             h / 2 - obj0.GetHeight() / 2);
 }
예제 #11
0
		private static void SetLocation(LObject objToBePositioned, float atp_W,
				float atp_H, float obj_X, float obj_Y, float obj_XW, float obj_YH,
				Position position) {
			switch (position) {
			case Position.CENTER:
				objToBePositioned.SetX((obj_XW / 2f) - atp_W / 2f);
				objToBePositioned.SetY((obj_YH / 2f) - atp_H / 2f);
				break;
			case Position.SAME:
				objToBePositioned.SetLocation(obj_X, obj_Y);
				break;
			case Position.LEFT:
				objToBePositioned.SetLocation(obj_X, obj_YH / 2f - atp_H / 2f);
				break;
			case Position.TOP_LEFT:
				objToBePositioned.SetLocation(obj_X, obj_YH - atp_H);
				break;
			case Position.TOP_LEFT_CENTER:
				objToBePositioned.SetLocation(obj_X - atp_W / 2f, obj_YH - atp_H
						/ 2f);
				break;
			case Position.TOP_RIGHT:
				objToBePositioned.SetLocation(obj_XW - atp_W, obj_YH - atp_H);
				break;
			case Position.TOP_RIGHT_CENTER:
				objToBePositioned.SetLocation(obj_XW - atp_W / 2f, obj_YH - atp_H
						/ 2f);
				break;
			case Position.TOP_CENTER:
				objToBePositioned.SetLocation(obj_XW / 2f - atp_W / 2f, obj_YH
						- atp_H);
				break;
			case Position.BOTTOM_LEFT:
				objToBePositioned.SetLocation(obj_X, obj_Y);
				break;
			case Position.BOTTOM_LEFT_CENTER:
				objToBePositioned.SetLocation(obj_X - atp_W / 2f, obj_Y - atp_H
						/ 2f);
				break;
			case Position.BOTTOM_RIGHT:
				objToBePositioned.SetLocation(obj_XW - atp_W, obj_Y);
				break;
			case Position.BOTTOM_RIGHT_CENTER:
				objToBePositioned.SetLocation(obj_XW - atp_W / 2f, obj_Y - atp_H
						/ 2f);
				break;
			case Position.BOTTOM_CENTER:
				objToBePositioned.SetLocation(obj_XW / 2f - atp_W / 2f, obj_Y);
				break;
			case Position.RIGHT_CENTER:
				objToBePositioned.SetLocation(obj_XW - atp_W, obj_YH / 2f - atp_H
						/ 2f);
				break;
			default:
				objToBePositioned.SetLocation(objToBePositioned.GetX(),
						objToBePositioned.GetY());
				break;
			}
		}
예제 #12
0
파일: Director.cs 프로젝트: zx8326123/LGame
        private static void SetLocation(LObject objToBePositioned, float atp_W,
                                        float atp_H, float obj_X, float obj_Y, float obj_XW, float obj_YH,
                                        Position position)
        {
            switch (position)
            {
            case Position.CENTER:
                objToBePositioned.SetX((obj_XW / 2f) - atp_W / 2f);
                objToBePositioned.SetY((obj_YH / 2f) - atp_H / 2f);
                break;

            case Position.SAME:
                objToBePositioned.SetLocation(obj_X, obj_Y);
                break;

            case Position.LEFT:
                objToBePositioned.SetLocation(obj_X, obj_YH / 2f - atp_H / 2f);
                break;

            case Position.TOP_LEFT:
                objToBePositioned.SetLocation(obj_X, obj_YH - atp_H);
                break;

            case Position.TOP_LEFT_CENTER:
                objToBePositioned.SetLocation(obj_X - atp_W / 2f, obj_YH - atp_H
                                              / 2f);
                break;

            case Position.TOP_RIGHT:
                objToBePositioned.SetLocation(obj_XW - atp_W, obj_YH - atp_H);
                break;

            case Position.TOP_RIGHT_CENTER:
                objToBePositioned.SetLocation(obj_XW - atp_W / 2f, obj_YH - atp_H
                                              / 2f);
                break;

            case Position.TOP_CENTER:
                objToBePositioned.SetLocation(obj_XW / 2f - atp_W / 2f, obj_YH
                                              - atp_H);
                break;

            case Position.BOTTOM_LEFT:
                objToBePositioned.SetLocation(obj_X, obj_Y);
                break;

            case Position.BOTTOM_LEFT_CENTER:
                objToBePositioned.SetLocation(obj_X - atp_W / 2f, obj_Y - atp_H
                                              / 2f);
                break;

            case Position.BOTTOM_RIGHT:
                objToBePositioned.SetLocation(obj_XW - atp_W, obj_Y);
                break;

            case Position.BOTTOM_RIGHT_CENTER:
                objToBePositioned.SetLocation(obj_XW - atp_W / 2f, obj_Y - atp_H
                                              / 2f);
                break;

            case Position.BOTTOM_CENTER:
                objToBePositioned.SetLocation(obj_XW / 2f - atp_W / 2f, obj_Y);
                break;

            case Position.RIGHT_CENTER:
                objToBePositioned.SetLocation(obj_XW - atp_W, obj_YH / 2f - atp_H
                                              / 2f);
                break;

            default:
                objToBePositioned.SetLocation(objToBePositioned.GetX(),
                                              objToBePositioned.GetY());
                break;
            }
        }