Esempio n. 1
0
 /// <summary>
 /// 原点モードからX軸の反転情報を取得する
 /// 注意:初期原点モードはLeftTopの為、
 ///    値とは通常状態になる
 ///    つまり、Rightの場合が対象となる
 /// </summary>
 /// <param name="om">原点モード</param>
 /// <returns>結果</returns>
 private Cordinate.Reverse GetReverseX(
     OriginMode om
     )
 {
     return(om == OriginMode.RightTop ||
            om == OriginMode.RightButtom
         ? Cordinate.Reverse.Reverse
         : Cordinate.Reverse.Normal);
 }
Esempio n. 2
0
 /// <summary>
 /// 原点モードからY軸の反転情報を取得する
 /// 注意:初期原点モードはLeftTopの為、
 ///       値は通常にある
 ///    つまり、center, bottomの場合が反転対象となる
 /// </summary>
 /// <param name="om">原点モード</param>
 /// <returns>結果</returns>
 private Cordinate.Reverse GetReverseY(
     OriginMode om
     )
 {
     return(om == OriginMode.Center ||
            om == OriginMode.LeftButtom ||
            om == OriginMode.RightButtom
         ? Cordinate.Reverse.Reverse
         : Cordinate.Reverse.Normal);
 }
Esempio n. 3
0
 /// <summary>
 /// 画面サイズから原点モードのオフセット値を取得する
 /// 画面サイズは width または height を設定する
 /// </summary>
 /// <param name="screenSize">画面サイズ(width or height)</param>
 /// <param name="originMode">原点モード</param>
 /// <returns>結果</returns>
 private int GetOffsetForOriginMode(
     int screenSize,
     OriginMode originMode
     )
 {
     // 原点モードが中央の場合
     if (originMode == OriginMode.Center)
     {
         // オフセットを計算する
         return(System.Math.Round(((double)screenSize - 1) / 2).intParse());
     }
     else
     {
         // その他はオフセットを0とする
         return(0);
     }
 }
Esempio n. 4
0
        protected UIElement(Point origin, string textureID, OriginMode mode)
        {
            Position = origin;
            if (textureID == null)
            {
                return;
            }

            MainTexture = Main.Sprites[textureID];

            if (mode == OriginMode.Center)
            {
                originOffset = MainTexture.Bounds.Size.ToVector2() * 0.5f;
            }
            else
            {
                originOffset = Vector2.Zero;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// コンストラクタ
        /// 原点モード       モード番号
        ///   左上(標準)      0
        ///   左下(グラフ)    1
        ///   右上            2
        ///   右下            3
        ///   中心(グラフ)    4
        /// </summary>
        /// <param name="width">画面の幅(ピクセル)</param>
        /// <param name="height">画面の高さ(ピクセル)</param>
        /// <param name="widthMag">幅の倍率(x値/ピクセル)</param>
        /// <param name="heightMag">高さの倍率(y値/ピクセル)</param>
        /// <param name="widthOffsetPixel">幅のオフセット(ピクセル)</param>
        /// <param name="heightOffsetPixel">高さのオフセット(ピクセル)</param>
        /// <param name="widthOffsetValue">幅のオフセット(値)</param>
        /// <param name="heightOffsetValue">高さのオフセット(値)</param>
        /// <param name="om">原点モード</param>
        public WindowCoordinate(
            int width,
            int height,
            double widthMag,
            double heightMag,
            int widthOffsetPixel,
            int heightOffsetPixel,
            double widthOffsetValue,
            double heightOffsetValue,
            OriginMode om
            )
        {
            // 初期値設定
            this._Width      = width;
            this._Height     = height;
            this._OriginMode = om;

            // x軸生成
            this._X = this.MakeCordinate(
                size: width,
                magnification: widthMag,
                offsetPixel: widthOffsetPixel,
                offsetValue: widthOffsetValue,
                om: om,
                func: this.GetReverseX
                );

            // y軸生成
            this._Y = this.MakeCordinate(
                size: height,
                magnification: heightMag,
                offsetPixel: heightOffsetPixel,
                offsetValue: heightOffsetValue,
                om: om,
                func: this.GetReverseY
                );
        }
Esempio n. 6
0
        /// <summary>
        /// Cordinateを生成する
        /// 画面サイズは width または height を設定する
        /// </summary>
        /// <param name="size">画面サイズ</param>
        /// <param name="magnification">倍率</param>
        /// <param name="offsetPixel">オフセット(ピクセル)</param>
        /// <param name="offsetValue">オフセット(値)</param>
        /// <param name="om">原点モード</param>
        /// <param name="func">反転情報取得関数</param>
        /// <returns>結果</returns>
        private Cordinate MakeCordinate(
            int size,
            double magnification,
            int offsetPixel,
            double offsetValue,
            OriginMode om,
            Func <OriginMode, Cordinate.Reverse> func
            )
        {
            // 軸オフセット値取得
            var newOffset = this.GetOffsetForOriginMode(
                screenSize: size,
                originMode: om
                ) + offsetPixel;

            // 軸生成
            return(new Cordinate(
                       size: size,
                       magnefication: magnification,
                       offsetPixel: newOffset,
                       offsetValue: offsetValue,
                       reverse: func(om)
                       ));
        }
Esempio n. 7
0
 public TextControl(string text, BitmapFont font, Point origin, string textureID, OriginMode mode) : base(origin, textureID, mode)
 {
     Text       = text;
     renderFont = font;
 }
Esempio n. 8
0
 protected SizedElement(Point origin, string textureID, OriginMode mode) : base(origin, textureID, mode)
 {
 }
Esempio n. 9
0
 /// <summary>
 /// Constructs the Object containing target bitmap, rectangle and raytracer to use.
 /// </summary>
 /// <param name="rawData">Pointer to the first element of the bitmap raw data.</param>
 /// <param name="startX">The lower bound of the x values in the rectangle.</param>
 /// <param name="endX">The upper bound of the x values in the rectangle.</param>
 /// <param name="startY">The lower bound of the y values in the rectangle.</param>
 /// <param name="endY">The upper bound of the y values in the rectangle.</param>
 /// <param name="raytracer">The raytracer to be used to render the image.</param>
 public RenderSection(byte[] rawData, int startX, int endX, int startY, int endY, Raytracer raytracer, OriginMode origin)
 {
     this.rawData   = rawData;
     this.startX    = startX;
     this.endX      = endX;
     this.startY    = startY;
     this.endY      = endY;
     this.raytracer = raytracer;
 }
Esempio n. 10
0
 internal static extern bool ilOriginFunc(OriginMode Mode);