Exemple #1
0
		private static Vector2f CreateOrigin(LObject o, Origin origin) {
			Vector2f v = new Vector2f(o.X(), o.Y());
			switch (origin) {
			case Origin.CENTER:
				v.Set(o.GetWidth() / 2f, o.GetHeight() / 2f);
				return v;
			case Origin.TOP_LEFT:
				v.Set(0.0f, o.GetHeight());
				return v;
			case Origin.TOP_RIGHT:
				v.Set(o.GetWidth(), o.GetHeight());
				return v;
			case Origin.BOTTOM_LEFT:
				v.Set(0.0f, 0.0f);
				return v;
			case Origin.BOTTOM_RIGHT:
				v.Set(o.GetWidth(), 0.0f);
				return v;
			case Origin.LEFT_CENTER:
				v.Set(0.0f, o.GetHeight() / 2f);
				return v;
			case Origin.TOP_CENTER:
				v.Set(o.GetWidth() / 2f, o.GetHeight());
				return v;
			case Origin.BOTTOM_CENTER:
				v.Set(o.GetWidth() / 2f, 0.0f);
				return v;
			case Origin.RIGHT_CENTER:
				v.Set(o.GetWidth(), o.GetHeight() / 2f);
				return v;
			default:
				return v;
			}
		}
Exemple #2
0
        private static Vector2f CreateOrigin(LObject o, Origin origin)
        {
            Vector2f v = new Vector2f(o.X(), o.Y());

            switch (origin)
            {
            case Origin.CENTER:
                v.Set(o.GetWidth() / 2f, o.GetHeight() / 2f);
                return(v);

            case Origin.TOP_LEFT:
                v.Set(0.0f, o.GetHeight());
                return(v);

            case Origin.TOP_RIGHT:
                v.Set(o.GetWidth(), o.GetHeight());
                return(v);

            case Origin.BOTTOM_LEFT:
                v.Set(0.0f, 0.0f);
                return(v);

            case Origin.BOTTOM_RIGHT:
                v.Set(o.GetWidth(), 0.0f);
                return(v);

            case Origin.LEFT_CENTER:
                v.Set(0.0f, o.GetHeight() / 2f);
                return(v);

            case Origin.TOP_CENTER:
                v.Set(o.GetWidth() / 2f, o.GetHeight());
                return(v);

            case Origin.BOTTOM_CENTER:
                v.Set(o.GetWidth() / 2f, 0.0f);
                return(v);

            case Origin.RIGHT_CENTER:
                v.Set(o.GetWidth(), o.GetHeight() / 2f);
                return(v);

            default:
                return(v);
            }
        }