GBDKライブラリドキュメント
GBDK libraries documentation |
||
---|---|---|
前
Prev |
5章
ライブラリ
Chapter 5.Libraries |
次
Next |
GBDKグラフィックのプリミティブは、プログラマがタイル、BG、ウィンドウとスプライトを管理することを可能にします。
これらのプリミティブのうちのいくつかは、LCDCレジスタの内容(VRAMの中でグラフィックスデータが位置するアドレスを指定する)に依存します。
したがって、これらのプリミティブを使用するに先立ってLCDCレジスタをセットしなければなりません。
GBDK graphic primitives allow the programmer to manage tiles, background, window, and sprites.Some of these primitives depend on the contents of the LCDC register, which specify the addresses in the VRAM at which graphics data are located.Therefore, the LCDC register must be set prior to using these primitives.
デフォルトで、BGとウィンドウTDTは、アドレス0x8800-0x97FF、アドレス0x8000-0x8FFFのスプライトTDT、アドレス0x9800-0x9BFFのBTM、とアドレス0x9C00-0x9FFFのWTMに位置します。
LCDCレジスタを使用して、スプライトTDT以外のこれらのアドレスを変更することができます。
By default, the background and window TDT is located at addresses 0x8800-0x97FF, the sprite TDT at addresses 0x8000-0x8FFF, the BTM at addresses 0x9800-0x9BFF, and the WTM at addresses 0x9C00-0x9FFF.It is possible to modify these addresses (except the sprite TDT) using the LCDC register.
void set_bkg_data(UBYTE first_tile, UBYTE nb_tiles, unsigned char *data); void set_win_data(UBYTE first_tile, UBYTE nb_tiles, unsigned char *data); void set_sprite_data(UBYTE first_tile, UBYTE nb_tiles, unsigned char *data); void set_data(unsigned char *vram_addr, unsigned char *data, UWORD len); void get_bkg_data(UBYTE first_tile, UBYTE nb_tiles, unsigned char *data); void get_win_data(UBYTE first_tile, UBYTE nb_tiles, unsigned char *data); void get_sprite_data(UBYTE first_tile, UBYTE nb_tiles, unsigned char *data); void get_data(unsigned char *data, unsigned char *vram_addr, UWORD len);
set_bkg_data()、set_win_data()とset_sprite_data()関数は、VRAMの中のBG、ウィンドウやスプライトTDTにタイルデータをコピーします。
get_bkg_data()、get_win_data()とget_sprite_data()関数は、VRAMからユーザに指定されたアドレスにデータをコピーします。
VRAMの中のデータのアドレスはLCDCレジスタの内容に依存します。
The set_bkg_data(), set_win_data(), and set_sprite_data() functions copy tile data to the background, window, or sprite TDT in VRAM.The get_bkg_data(), get_win_data(), and get_sprite_data() functions copy data from VRAM to an address specified by the user.The address of data in VRAM depends of the contents of the LCDC register.
set_data()関数は、VRAMの中の任意のアドレスにデータをコピーします。
get_data()関数は、VRAMの中の任意のアドレスからデータをコピーします。
The set_data() function copies data to any address in VRAM.The get_data() function copies data from any address in VRAM.
データを読んだオペレーションはスクリーンの現在の状態を保存するために使用できます(例えばダイアログボックスを表示し、スクリーンを後で回復するために)。
The operations that read data can be used to save the current state of the screen (for instance for displaying a dialog box, and restoring the screen afterwards).
first_tile:VRAMの中の最初タイルの数(0と255の間)。
first_tile: number of the first tile in VRAM (between 0 and 255).
nb_tiles:コピーするタイルの数(0は256枚のタイルをコピーします)。
nb_tiles: number of tiles to copy (0 for copying 256 tiles).
data:ユーザタイルデータへのポインタ。
data: pointer to the user tile data.
vram_addr:VRAMの中のアドレス。
vram_addr: address in VRAM.
len:コピーするバイト数。
len: number of bytes to copy.
無。
Nothing.
void set_bkg_tiles(UBYTE x, UBYTE y, UBYTE w, UBYTE h, unsigned char *tiles); void set_win_tiles(UBYTE x, UBYTE y, UBYTE w, UBYTE h, unsigned char *tiles); void set_tiles(UBYTE x, UBYTE y, UBYTE w, UBYTE h, unsigned char *vram_addr, unsigned char *tiles); set_sprite_tile(UBYTE nb, UBYTE tile); void get_bkg_tiles(UBYTE x, UBYTE y, UBYTE w, UBYTE h, unsigned char *tiles); void get_win_tiles(UBYTE x, UBYTE y, UBYTE w, UBYTE h, unsigned char *tiles); void get_tiles(UBYTE x, UBYTE y, UBYTE w, UBYTE h, unsigned char *tiles, unsigned char *vram_addr); UBYTE get_sprite_tile(UBYTE nb);
set_bkg_tiles()とset_win_tiles()関数は、VRAMの中のBTMにBGまたはウィンドウのタイル番号の長方形のエリアをコピーします。
get_bkg_tiles()とget_win_tiles()関数はVRAMからユーザが指定したアドレスにデータをコピーします。
VRAMの中のタイル番号のアドレスはLCDCレジスタの内容に依存します。
The set_bkg_tiles() and set_win_tiles() functions copy a rectangular area of background or window tile numbers to the BTM in VRAM.The get_bkg_tiles() and get_win_tiles() functions copy data from VRAM to an address specified by the user.The address of tile numbers in VRAM depends of the contents of the LCDC register.
set_tiles()関数は、VRAMの中の任意のアドレスにタイル番号の長方形のエリアをコピーします(このアドレスは一般に0x8000または0x8800になります)。
VRAMからユーザが指定したアドレスへのget_tiles()関数コピーデータ。
The set_tiles() function copies a rectangular area of tile numbers to any address in VRAM (this address will be generally 0x8000 or 0x8800).The get_tiles() function copies data from VRAM to an address specified by the user.
set_sprite_tiles()関数は、特定のスプライトのタイル番号をセットしました。
get_sprite_tiles()関数は、スプライトのタイル番号を返します。
これらの関数は直接VRAMにアクセスしません。
The set_sprite_tiles() function set the tile number of a specific sprite.The get_sprite_tiles() function returns the tile number of a sprite.These functions do not directly access the VRAM.
データを読んだオペレーションはスクリーンの現在の状態を保存するために使用できます(例えばダイアログボックスを表示し、スクリーンを後で回復するために)。
The operations that read data can be used to save the current state of the screen (for instance for displaying a dialog box, and restoring the screen afterwards).
VRAMの中の長方形のエリアの左上の角のx:水平座標。
x: horizontal coordinate of the top-left corner of the rectangular area in VRAM.
垂直のy:、VRAMの中の長方形のエリアの左上の角に調和します。
y: vertical coordinate of the top-left corner of the rectangular area in VRAM.
w:幅、その、VRAMの中の長方形のエリア。
w: width of the the rectangular area in VRAM.
h:高さ、その、VRAMの中の長方形のエリア。
h: height of the the rectangular area in VRAM.
タイル:ユーザタイル番号へのポインタ。
タイル番号のサイズはw*hであったほうがよい。
tiles: pointer to the user tile numbers.The size of the tile numbers should be w*h.
vram_addr:VRAMの中のアドレス。
vram_addr: address in VRAM.
nb:アクセスするスプライトのインデックス(0と39の間)。
nb: index of the sprite to access (between 0 and 39).
タイル:スプライトのタイル番号。
tile: tile number of the sprite.
get_sprite_tiles()関数は、スプライトのタイル番号を返します。
The get_sprite_tiles() function returns the tile number of the sprite.
void move_bkg(UBYTE x, UBYTE y); void move_win(UBYTE x, UBYTE y); void move_sprite(UBYTE nb, UBYTE x, UBYTE y);
move_bkg()とmove_win()関数は、BGやウィンドウーディスプレーの位置を変更します。
これらの関数は、新しい位置の絶対値を予期します。
これらの関数がスクリーン中にむしろ使用されてはならないことに注目する、新しい手形を振り出す。
望まれない視覚的なひずみを回避するために、VBLの上のこれらの関数を呼ぶほうがよい。
The move_bkg() and move_win() functions modify the position of the background or window display.These functions expect the absolute value of the new position.Note that these functions should preferably not be used during screen redraw.To avoid unwanted visual distortions, it is better to call these functions upon VBL.
move_sprite()関数は、特定のスプライトの位置を変更します。
この関数は、新しい位置の絶対値を予期します。
それは直接VRAMにアクセスしません。
The move_sprite() function modifies the position of a specific sprite.This function expects the absolute value of the new position.It does not directly access the VRAM.
新しいディスプレイ位置のx:水平座標。
y:新しいディスプレイ位置の垂直の座標。
nb:アクセスするスプライトのインデックス(0と39の間)。
x: horizontal coordinate of the new display position.y: vertical coordinate of the new display position.nb: index of the sprite to access (between 0 and 39).
無。
Nothing.
void scroll_bkg(BYTE x, BYTE y); void scroll_win(BYTE x, BYTE y); void scroll_sprite(UBYTE nb, BYTE x, BYTE y);
scroll_bkg()とscroll_win()関数は、BGやウィンドウーディスプレーの位置を変更します。
これらの関数は、現在の位置に関する相対的な移動を予期します。
これらの関数がスクリーン中にむしろ使用されてはならないことに注目する、新しい手形を振り出す。
望まれない視覚的なひずみを回避するために、VBLの上のこれらの関数を呼ぶほうがよい。
scroll_sprite()関数は、特定のスプライトの位置を変更します。
この関数は、現在の位置に関する相対的な移動を予期します。
それは直接VRAMにアクセスしません。
The scroll_bkg() and scroll_win() functions modify the position of the background or window display.These functions expect a relative displacement relative to the current position.Note that these functions should preferably not be used during screen redraw.To avoid unwanted visual distortions, it is better to call these functions upon VBL.The scroll_sprite() function modifies the position of a specific sprite.This function expects a relative displacement relative to the current position.It does not directly access the VRAM.
現在のディスプレイ位置に関するx:水平の移動。
x: horizontal displacement relative to the current display position.
現在のディスプレイ位置に関するy:垂直の移動。
y: vertical displacement relative to the current display position.
nb:アクセスするスプライトのインデックス(0と39の間)。
nb: index of the sprite to access (between 0 and 39).
無。
Nothing.
/* Sprite properties bits */ #define S_PALETTE 0x10U #define S_FLIPX 0x20U #define S_FLIPY 0x40U #define S_PRIORITY 0x80U void set_sprite_prop(UBYTE nb, UBYTE prop); UBYTE get_sprite_prop(UBYTE nb);
set_sprite_prop()関数は、特定のスプライトの属性を変更します。
get_sprite_prop()関数は、スプライトの属性を返します。
これらの関数は直接VRAMにアクセスしません。
The set_sprite_prop() function modifies the attributed of a specific sprite.The get_sprite_prop() function returns the attributed of a sprite.These functions do not directly access the VRAM.
nb:アクセスするスプライトのインデックス(0と39の間)。
nb: index of the sprite to access (between 0 and 39).
prop:スプライト属性の新しい値。
prop: new value of the sprite attributes.
get_sprite_prop()は、スプライトの属性を返します。
The get_sprite_prop() returns the attributes of the sprite.
前
Prev |
ホーム
Home |
次
Next |
十分なスクリーングラフィックス-drawing.h
Full screen graphics - drawing.h |
上
Up |
Joypad-gb.h
Joypad - gb.h |