html5-img
1 / 6

SDL 座標系

SDL 座標系. 座標値は整数 最小値は 0 、最大値は SDL_X_SIZE,SDL_Y_SIZE (0,0)-(SDL_X_SIZE,SDL_Y_SIZE). SDL 座標系. (0,0). SDL_Y_SIZE. ・ (X_ORIGIN,Y_ORIGIN). SDL_X_SIZE. (SDL_X_SIZE,SDL_Y_SIZE). 描画座標系. 座標値は実数でも OK 最小値、最大値はユーザーが設定 X_SIZE,Y_SIZE で範囲を設定 最小値を x_min,y_min とすると、 (x_min,y_min) -

hong
Download Presentation

SDL 座標系

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SDL座標系 • 座標値は整数 • 最小値は0、最大値は SDL_X_SIZE,SDL_Y_SIZE (0,0)-(SDL_X_SIZE,SDL_Y_SIZE)

  2. SDL座標系 (0,0) SDL_Y_SIZE ・ (X_ORIGIN,Y_ORIGIN) SDL_X_SIZE (SDL_X_SIZE,SDL_Y_SIZE)

  3. 描画座標系 • 座標値は実数でもOK • 最小値、最大値はユーザーが設定 X_SIZE,Y_SIZEで範囲を設定 最小値をx_min,y_minとすると、 (x_min,y_min) - (x_min+X_SIZE,y_min+Y_SIZE)

  4. 描画座標系 (x_min,y_min+Y_SIZE) Y_SIZE ・ (0,0) X_SIZE (x_min+X_SIZE,y_min)

  5. SDL座標系と描座標系 実際に描画するのはSDL座標系: 描画座標系での座標値をSDL座標系での座標値に変換する。 1.描画座標系でのサイズをSDL座標系でのサイズに丸める。 2.Y軸の値を反転させる。 3.SDL座標系における描画座標系の原点オフセットを加える。 4.SDL座標系の範囲を越えたら、範囲内に丸める。

  6. (X,Y) (x,y) X = (SDL_X_SIZE/X_SIZE)*x + X_ORIGINY = - (SDL_Y_SIZE/Y_SIZE)*y + Y_ORIGIN 写像 SDL座標系 描画座標系 (0,0) (-1/2X_SIZE,1/2Y_SIZE) (0,0) (X_ORIGIN,Y_ORIOGIN) (SDL_X_SIZE,SDL_Y_SIZE) (1/2X_SIZE,-1/2Y_SIZE)

More Related