private byte[] GetSprColorsIxs(Sprite x) { var colors = GetSprColors(x); var colorsIxs = colors.Select(c => Palettes.GetColorIx(c, Tic80Config.DEFAULT_PALETTE)); return(colorsIxs.ToArray()); }
private void updateScreenByPalette(Palettes.Palette oldPal, Palettes.Palette pal) { var indexes = screenTexture.GetPixels32().Select(c => Palettes.GetColorIx(c, oldPal)); var newColors = indexes.ToList().Select(ix => Palettes.GetColor(ix, pal)).ToArray(); screenTexture.SetPixels32(newColors); }
/** * Используется для получения значения цвета пикселя на экране. * * https://nesbox.gitbooks.io/tic-80-rus/content/api/draw/pix.html * * The function can be used also to interrogate the color of a pixel in the screen. * https://github.com/nesbox/TIC-80/wiki/pix */ public int pix(float x, float y) { if (IsOffScreen(x, y)) { return(0); } var color = screenTexture.TakePixel(x, y); return(Palettes.GetColorIx(color, tic80Config.Palette)); }