Skip to content
CShift0.32

Screen

Struct · namespace Amiga · AmigaOS only · Since 0.20

struct Screen

A low resolution PAL screen: a bitmap (two with double buffering) shown by a copper list that also sets the palette and the sprites. With Bitmap, Blitter, Sprite, CopperList and SystemFont it is the graphics on the Amiga’s custom chips (only for amigaos targets, after Hardware.TakeOver).

using Amiga;
Hardware.TakeOver();
if (Screen.Open(320, 256, 4, true) is Screen screen)
{
screen.SetColor(1, 0xFFF);
screen.Show();
while (!Hardware.LeftMouseButton())
{
screen.Back.Clear(); // the blitter
screen.Back.FillRect(10, 10, 100, 50, 2);
screen.Back.DrawText(20, 100, "Hello", 1); // Topaz, from the ROM
screen.Swap(); // shows Back, waits for the vertical blank
}
Hardware.Restore();
screen.Close();
}

Coordinates are pixels, (0, 0) is the top left corner; drawing is clipped to the bitmap. Colors are numbers of the palette (0 .. 2^depth - 1); the palette has 12-bit colors (0xRGB).

Name Description
Front The bitmap that is shown.
Back The bitmap to draw into; the same as Front without double buffering.
Copper The copper list of the screen.
Width The width in pixels.
Height The height in pixels.
Depth The number of bitplanes.
Bitmap Front

The bitmap that is shown.

Bitmap Back

The bitmap to draw into; the same as Front without double buffering.

CopperList Copper

The copper list of the screen. After the setup it takes your own instructions (Copper.Wait(y), Copper.Color(0, 0xF00), …; Copper.Reset() removes them again).

int Width

The width in pixels.

int Height

The height in pixels.

int Depth

The number of bitplanes.

Name Description
Open Opens a low resolution PAL screen: a bitmap (two with doubleBuffer) shown by a copper list that also sets the palette and the sprites.
static Optional<Screen> Open(int width, int height, int depth, bool doubleBuffer)

Opens a low resolution PAL screen: a bitmap (two with doubleBuffer) shown by a copper list that also sets the palette and the sprites.

Parameters

  • width: a multiple of 16, 128 to 320.
  • height: 1 to 256.
  • depth: 1 to 5 (2 to 32 colors).
  • doubleBuffer: draw into Back while Front is shown, and swap them with Screen.Swap.

Returns nothing (null) if there is not enough chip memory.

Panics when a size is out of range.

Name Description
SetColor color 0..31 as 0xRGB (from the next frame on)
Show Shows the screen: starts its copper list and the DMA for bitplanes, copper, blitter and sprites (after Hardware.TakeOver).
Swap Shows Back from the next frame on (Front and Back swap) and waits for the vertical blank: then the new Back is no longer on the screen.
ShowSprite sprite ‘number’ (0..7) shows sprite (from the next frame on)
HideSprite Hides sprite number (0 to 7) from the next frame on.
Close frees the bitmaps and the copper list (after Hardware.Restore, when the screen is no longer shown)
void SetColor(int index, int rgb)

color 0..31 as 0xRGB (from the next frame on)

void Show()

Shows the screen: starts its copper list and the DMA for bitplanes, copper, blitter and sprites (after Hardware.TakeOver).

void Swap()

Shows Back from the next frame on (Front and Back swap) and waits for the vertical blank: then the new Back is no longer on the screen. Without double buffering it only waits.

void ShowSprite(int number, Sprite sprite)

sprite ‘number’ (0..7) shows sprite (from the next frame on)

void HideSprite(int number)

Hides sprite number (0 to 7) from the next frame on.

void Close()

frees the bitmaps and the copper list (after Hardware.Restore, when the screen is no longer shown)