Table of Contents

Class Window

Namespace
GB
Assembly
GBSharp.Framework.dll

The window layer: a second tile map drawn on top of the background.

public static class Window
Inheritance
Window
Inherited Members

Remarks

The window does not scroll with the background, which is what makes it the right place for a status bar or a dialogue box. It has no tile data of its own: it draws from the same VRAM the background uses, so load through LoadBackground(byte, byte, byte[]) and both layers see the result.

Fields

MinX

The X position that puts the window's left edge at the left of the screen.

public const byte MinX = 7

Field Value

byte

Remarks

The window's X register is offset by 7. Values below this push it off the left edge, and 7 is the usual setting for a full-width window.

Properties

X

The window's X register, offset by 7. See MinX.

public static byte X { get; set; }

Property Value

byte

Y

The window's Y register, in screen pixels from the top.

public static byte Y { get; set; }

Property Value

byte

Methods

GetTile(byte, byte)

Reads one window map cell.

[Native("get_win_tile_xy")]
public static byte GetTile(byte x, byte y)

Parameters

x byte
y byte

Returns

byte

Load(TileMap)

Loads a converted image: its tiles, its map, and on Game Boy Color its attributes and palettes, onto the window layer instead of the background. See Load(TileMap).

[Native("gbs_window_load")]
public static void Load(TileMap map)

Parameters

map TileMap

LoadAttributes(byte, byte, byte, byte, byte[])

Writes a rectangle of Game Boy Color attributes into the window map.

[Native("gbs_win_load_attributes")]
public static void LoadAttributes(byte x, byte y, byte width, byte height, byte[] attributes)

Parameters

x byte
y byte
width byte
height byte
attributes byte[]

Remarks

One byte per cell: the low three bits pick a palette, bit 5 flips the tile horizontally and bit 6 vertically. Does nothing on an original Game Boy, so guard with IsColorHardware if the game runs on both.

LoadMap(byte, byte, byte, byte, byte[])

Writes a rectangle of tile indices into the window map.

[Native("gbs_win_load_map")]
public static void LoadMap(byte x, byte y, byte width, byte height, byte[] map)

Parameters

x byte
y byte
width byte
height byte
map byte[]

Move(byte, byte)

Positions the window. See MinX for the X offset.

[Native("move_win")]
public static void Move(byte x, byte y)

Parameters

x byte
y byte

Scroll(sbyte, sbyte)

Moves the window by a relative amount.

[Native("scroll_win")]
public static void Scroll(sbyte dx, sbyte dy)

Parameters

dx sbyte
dy sbyte

SetTile(byte, byte, byte)

Sets one window map cell.

[Native("gbs_win_set_tile")]
public static void SetTile(byte x, byte y, byte tile)

Parameters

x byte
y byte
tile byte