Hallo liebe Leute,
ich bin kein Experte in Byte/Bit Manipulationen, gebe ich gern zu, darum erbitte ich Hilfe.
Das Ziel ist es, ein Zeichen einer Fontdatei, die als C-Header vorliegt, in die Konsole zu malen.
Es geht um diese Zeichensätze hier: github.com/greiman/SSD1306Ascii/tree/master/src/fonts
Wenn ich das richtig verstanden habe, werden die Bits des Bytes pro Spalte nach unten geschrieben .
Ich habe mir mal den einfachen 8x8 Font geschnappt und das Zeichen "A" als ByteArray rauskopiert und lasse es in der Konsole "malen".
Das geht auch gut und es kommt das Gewünschte:
Nun interessiert mich ein gößerer Zeichensatz aus dieser Sammlung, z.B. "lcdnums14x24.h".
Und da bin ich raus mit meiner Logik. Ich schaffe es einfach nicht, so zu denken, dass ich es umsetzen könnte .
Für den 8x8 Font habe ich es so gemacht:
Könnt ihr mir bitte ein wenig helfen?
ich bin kein Experte in Byte/Bit Manipulationen, gebe ich gern zu, darum erbitte ich Hilfe.
Das Ziel ist es, ein Zeichen einer Fontdatei, die als C-Header vorliegt, in die Konsole zu malen.
Es geht um diese Zeichensätze hier: github.com/greiman/SSD1306Ascii/tree/master/src/fonts
Wenn ich das richtig verstanden habe, werden die Bits des Bytes pro Spalte nach unten geschrieben .
Ich habe mir mal den einfachen 8x8 Font geschnappt und das Zeichen "A" als ByteArray rauskopiert und lasse es in der Konsole "malen".
Das geht auch gut und es kommt das Gewünschte:
Nun interessiert mich ein gößerer Zeichensatz aus dieser Sammlung, z.B. "lcdnums14x24.h".
Und da bin ich raus mit meiner Logik. Ich schaffe es einfach nicht, so zu denken, dass ich es umsetzen könnte .
Für den 8x8 Font habe ich es so gemacht:
C#-Quellcode
- using System;
- using System.Collections;
- namespace ConsoleGLCD {
- class Program {
- static byte[] b = { 0x7C, 0x12, 0x12, 0x12, 0x12, 0x7C, 0x00, 0x00 };
- static void Main(string[] args) {
- PrintValues(b);
- Console.ReadKey();
- }
- private static void PrintValues(byte[] fontChar) {
- for (int x = 0; x < 8; x++) {
- BitArray bits = new BitArray(new byte[] { fontChar[x] });
- for (int y = 0; y < 8; y++) {
- Console.SetCursorPosition(x, y);
- Console.WriteLine("{0}", bits[y] ? "█" : "·");
- }
- }
- }
- }
- }
Könnt ihr mir bitte ein wenig helfen?