public override void Update() { base.Update(); if ((Frame & 3) == 0) { plasma.Update(); } if (scrollStart == int.MinValue) { scrollStart = Width - 20; } int i = scrollStart, j = 0; // where to draw scrollStart--; // while (i < 0) // { // i += Width; // } Fill(0, 0, 0); var seen = false; var mono = false; var alpha = true; var startLocations = Font1.ColorFontStartLocations; var fontData = Font1.ColorFontData; alpha = false; //startLocations = Font1.Consolas16StartLocations; //fontData = Font1.Consolas16Data; //startLocations = Font1.GunnStartLocations; //fontData = Font1.GunnData; //alpha = true; foreach (var c in text) { var index = startLocations[c - 32]; var dx = fontData[index++]; // size var dy = fontData[index++]; var sx = fontData[index++]; // start offset var sy = fontData[index++]; for (var y = 0; y < dy; ++y) { for (var x = 0; x < dx; ++x) { int colorR, colorG, colorB, colorA = 0; if (mono) { colorR = colorG = colorB = fontData[index++]; } else { colorR = fontData[index++]; colorG = fontData[index++]; colorB = fontData[index++]; if (alpha) { colorA = fontData[index++]; } else { colorA = 255; } } if (colorR != 0 || colorG != 0 || colorB != 0 || colorA != 0) { int r, g, b; var xx = x + i + sx; var yy = y + j + sy; plasma.GetPixel(xx, yy, out r, out g, out b); //r = (r + colorR) / 2; //g = (g + colorG) / 2; //b = (b + colorB) / 2; //r = colorR; //g = colorG; //b = colorB; r = r * colorR / 256; g = g * colorG / 256; b = b * colorB / 256; seen |= SetPixel(xx, yy, r, g, b); } } } if (c != ' ') { i += dx + 1; } else { i += 16; // todo - font width } } if (!seen) { scrollStart = Width - 20; } }
public override void Update() { base.Update(); if (resetCount == 0) { Reset(); // need at least one reset } if (true) { //if ((frame & 3) == 0) plasma.Update(); for (var j = 0; j < Height; ++j) { for (var i = 0; i < Width; ++i) { int r, g, b; plasma.GetPixel(i, j, out r, out g, out b); SetPixel(i, j, r, g, b); } } } else { Fill(0, 0, 0); } var xpos = curPos; var ypos = Height / 2 - font.Font.LineHeight / 2; var gap = (Height - font.Font.LineHeight) * 0.6; curPos -= 2; font.Render(ref xpos, ref ypos, text, Width, Height, (i, j, r, g, b, a) => { if (a != 0) { int r1, g1, b1; var j2 = (int)(j + Math.Sin(Frame / 8.0 + i * 4.0 / Width) * gap); GetPixel(i, j2, out r1, out g1, out b1); //j2 = j; r1 = a * r / 255 + (255 - a) * r1 / 255; g1 = a * g / 255 + (255 - a) * g1 / 255; b1 = a * b / 255 + (255 - a) * b1 / 255; SetPixel(i, j2, r1, g1, b1); } } ); if (xpos < 0) { curPos = Width; } #if false if (scrollStart == int.MinValue) { scrollStart = Width - 20; } int i = scrollStart, j = 0; // where to draw scrollStart--; // while (i < 0) // { // i += Width; // } Fill(0, 0, 0); var seen = false; var mono = false; var alpha = true; var startLocations = Font1.ColorFontStartLocations; var fontData = Font1.ColorFontData; alpha = false; //startLocations = Font1.Consolas16StartLocations; //fontData = Font1.Consolas16Data; //startLocations = Font1.GunnStartLocations; //fontData = Font1.GunnData; //alpha = true; foreach (var c in text) { var index = startLocations[c - 32]; var dx = fontData[index++]; // size var dy = fontData[index++]; var sx = fontData[index++]; // start offset var sy = fontData[index++]; for (var y = 0; y < dy; ++y) { for (var x = 0; x < dx; ++x) { int colorR, colorG, colorB, colorA = 0; if (mono) { colorR = colorG = colorB = fontData[index++]; } else { colorR = fontData[index++]; colorG = fontData[index++]; colorB = fontData[index++]; if (alpha) { colorA = fontData[index++]; } else { colorA = 255; } } if (colorR != 0 || colorG != 0 || colorB != 0 || colorA != 0) { int r, g, b; var xx = x + i + sx; var yy = y + j + sy; plasma.GetPixel(xx, yy, out r, out g, out b); //r = (r + colorR) / 2; //g = (g + colorG) / 2; //b = (b + colorB) / 2; //r = colorR; //g = colorG; //b = colorB; r = r * colorR / 256; g = g * colorG / 256; b = b * colorB / 256; seen |= SetPixel(xx, yy, r, g, b); } } } if (c != ' ') { i += dx + 1; } else { i += 16; // todo - font width } } if (!seen) { scrollStart = Width - 20; } #endif }