public void Draw() { _screen.ColumnOrderSprite(); //_screen.RowOrderSprite(); // KEYS byte[] keyShape = new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 }; foreach (var key in _data.RoomKeys) { if (key.Attr == 255) { continue; } int attr = _data.Attributes[key.Position.Y * 32 + key.Position.X]; attr &= 0xF8; // 11111000 attr |= key.Attr; //screen.SetAttribute(key.Position.X, key.Position.Y, key.Attr, 0, true, false); Com.SloanKelly.ZXSpectrum.ZXAttribute attribute = new Com.SloanKelly.ZXSpectrum.ZXAttribute((byte)attr); _screen.SetAttribute(key.Position.X, key.Position.Y, attribute); //screen.DrawSprite(key.Position.X, key.Position.Y, 1, 1, keyShape); _screen.DrawSprite(key.Position.X, key.Position.Y, 1, 1, _data.KeyShape); } // /KEYS }
public Portal(byte colour, byte[] shape, int x, int y) { X = x; Y = y; Shape = shape; Attr = new Com.SloanKelly.ZXSpectrum.ZXAttribute(colour); }
/// <summary> /// The late update is used because at this point everything has been drawn on the screen. /// </summary> void LateUpdate() { // Get the current state of the screen Color[] pixels = _tex.GetPixels(); for (int x = 0; x < 256; x++) { for (int y = 0; y < 192; y++) { // Determine the origin of the attributes, they are always at the top. Origin only // affects the drawing of pixels. int attrY = /* _origin == Origin.Top ? */ (191 - y) / 8 /* : y / 8 */; // Get the attriute at this position ZXAttribute attr = _attrs [x / 8, attrY]; // Determing if the attribute block is flashing bool flashing = attr.Flashing && inverse; // Set the colours for ink and paper Color paper = ZXColour.Get(flashing ? attr.Ink : attr.Paper, attr.Bright); Color ink = ZXColour.Get(flashing ? attr.Paper : attr.Ink, attr.Bright); // Output the pixel pixels[y * 256 + x] = _pixels [x, y] ? ink : paper; } } // Apply the pixel changes _tex.SetPixels(pixels); _tex.Apply(); }
/// <summary> /// Clear the screen. /// </summary> /// <param name="ink">Ink.</param> /// <param name="paper">Paper.</param> /// <param name="bright">If set to <c>true</c> bright.</param> /// <param name="flashing">If set to <c>true</c> flashing.</param> public void Clear(int ink, int paper, bool bright, bool flashing = false) { for (int y = 0; y < 24; y++) { for (int x = 0; x < 32; x++) { _attrs [x, y] = new ZXAttribute(ink, paper, bright, flashing); } } for (int y = 0; y < 192; y++) { for (int x = 0; x < 256; x++) { _pixels [x, y] = false; } } }
public void Draw() { //throw new NotImplementedException(); _screen.RowOrderSprite(); byte[] graphic = _player.Frames[_player.Frame]; int attr = _data.Attributes[_player.Y * 32 + _player.X]; attr &= 0xF8; // 11111000 //attr |= _player.Attribute.GetInk(); attr |= 7; // always white //screen.SetAttribute(key.Position.X, key.Position.Y, key.Attr, 0, true, false); Com.SloanKelly.ZXSpectrum.ZXAttribute attribute = new Com.SloanKelly.ZXSpectrum.ZXAttribute((byte)attr); _screen.FillAttribute(_player.X, _player.Y, 2, 2, attribute); _screen.DrawSprite(_player.X, _player.Y, 2, 2, graphic); }
internal void FillAttribute(int x, int y, int width, int height, ZXAttribute attr) { FillAttribute(x, y, width, height, attr.Ink, attr.Paper, attr.Bright, attr.Flashing); }
public void SetAttribute(int x, int y, ZXAttribute attr) { SetAttribute(x, y, attr.Ink, attr.Paper, attr.Bright, attr.Flashing); }
public void SetAttribute(int x, int y, ZXAttribute attr) { //throw new NotImplementedException(); SetAttribute(x, y, attr.Ink, attr.Paper, attr.Bright, attr.Flashing); }