index to char

This commit is contained in:
ethan merchant 2024-02-27 14:53:42 -05:00
parent 60cb6e0977
commit 6cd1e20666
2 changed files with 53 additions and 53 deletions

View file

@ -28,159 +28,159 @@ public class Mono {
}
}
// key:(string) value:(int[] dots)
Dictionary<string, int[]> char_cell = new Dictionary<string, int[]> {
{ "a", new int[] {
// key:(char) value:(int[] dots)
Dictionary<char, int[]> char_cell = new Dictionary<char, int[]> {
{ ' ', new int[] {
0, 0,
0, 0,
0, 0
} },
{ 'a', new int[] {
1, 0,
0, 0,
0, 0
} },
{ "b", new int[] {
{ 'b', new int[] {
1, 0,
1, 0,
0, 0
} },
{ "c", new int[] {
{ 'c', new int[] {
1, 1,
0, 0,
0, 0
} },
{ "d", new int[] {
{ 'd', new int[] {
1, 1,
0, 1,
0, 0
} },
{ "e", new int[] {
{ 'e', new int[] {
1, 0,
0, 1,
0, 0
} },
{ "f", new int[] {
{ 'f', new int[] {
1, 1,
1, 0,
0, 0
} },
{ "g", new int[] {
{ 'g', new int[] {
1, 1,
1, 1,
0, 0
} },
{ "h", new int[] {
{ 'h', new int[] {
1, 0,
1, 1,
0, 0
} },
{ "i", new int[] {
{ 'i', new int[] {
0, 1,
1, 0,
0, 0
} },
{ "j", new int[] {
{ 'j', new int[] {
0, 1,
1, 1,
0, 0
} },
{ "k", new int[] {
{ 'k', new int[] {
1, 0,
0, 0,
1, 0
} },
{ "l", new int[] {
{ 'l', new int[] {
1, 0,
1, 0,
1, 0
} },
{ "m", new int[] {
{ 'm', new int[] {
1, 1,
0, 0,
1, 0
} },
{ "n", new int[] {
{ 'n', new int[] {
1, 1,
0, 1,
1, 0
} },
{ "o", new int[] {
{ 'o', new int[] {
1, 0,
0, 1,
1, 0
} },
{ "p", new int[] {
{ 'p', new int[] {
1, 1,
1, 0,
1, 0
} },
{ "q", new int[] {
{ 'q', new int[] {
1, 1,
1, 1,
1, 0
} },
{ "r", new int[] {
{ 'r', new int[] {
1, 0,
1, 1,
1, 0
} },
{ "s", new int[] {
{ 's', new int[] {
0, 1,
1, 0,
1, 0
} },
{ "t", new int[] {
{ 't', new int[] {
0, 1,
1, 1,
1, 0
} },
{ "u", new int[] {
{ 'u', new int[] {
1, 0,
0, 0,
1, 1
} },
{ "v", new int[] {
{ 'v', new int[] {
1, 0,
1, 0,
1, 1
} },
{ "w", new int[] {
{ 'w', new int[] {
0, 1,
1, 1,
0, 1
} },
{ "x", new int[] {
{ 'x', new int[] {
1, 1,
0, 0,
1, 1
} },
{ "y", new int[] {
{ 'y', new int[] {
1, 1,
0, 1,
1, 1
} },
{ "z", new int[] {
{ 'z', new int[] {
1, 0,
0, 1,
1, 1
} },
{ " ", new int[] {
0, 0,
0, 0,
0, 0
} },
{ ",", new int[] {
{ ',', new int[] {
0, 0,
1, 0,
0, 0
} },
{ ".", new int[] {
{ '.', new int[] {
0, 0,
1, 1,
0, 1
} },
{ "/", new int[] {
{ '/', new int[] {
0, 1,
0, 0,
1, 0
} },
{ ";", new int[] {
{ ';', new int[] {
0, 0,
1, 0,
1, 0
@ -193,20 +193,20 @@ public class Mono {
Colemak
}
Dictionary<Layout, string[]> layouts = new Dictionary<Layout, string[]> {
{ Layout.Colemak, new string[] {
"q", "w", "f", "p", "g", "j", "l", "u", "y", ";",
"a", "r", "s", "t", "d", "h", "n", "e", "i", "o",
"z", "x", "c", "v", "b", "k", "m", ",", ".", "/",
Dictionary<Layout, char[]> layouts = new Dictionary<Layout, char[]> {
{ Layout.Colemak, new char[] {
'q', 'w', 'f', 'p', 'g', 'j', 'l', 'u', 'y', ';',
'a', 'r', 's', 't', 'd', 'h', 'n', 'e', 'i', 'o',
'z', 'x', 'c', 'v', 'b', 'k', 'm', ',', '.', '/',
} },
{ Layout.Qwerty, new string[] {
"q", "w", "e", "r", "t", "y", "u", "i", "o", "p",
"a", "s", "d", "f", "g", "h", "j", "k", "l", ";",
"z", "x", "c", "v", "b", "n", "m", ",", ".", "/",
{ Layout.Qwerty, new char[] {
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p',
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
} },
};
public string KeyToChar(int index) {
public char KeyToChar(int index) {
return layouts[Layout.Colemak][index];
}
@ -248,7 +248,7 @@ public class Mono {
// xi = 0;
// }
if (Input.Key(Key.Down).IsJustActive()) {
monoNet.value = 0;
monoNet.value = ' ';
monoNet.send = true;
}
@ -267,7 +267,7 @@ public class Mono {
if (index_i != last_index_i) {
last_index_i = index_i;
// Log.Info($"index_i: {index_i}");
monoNet.value = index_i;
monoNet.value = KeyToChar(index_i);
monoNet.send = true;
}
}
@ -295,10 +295,10 @@ public class Mono {
int index = y * 10 + x;
// string text = characters[index].character;
string keychar = KeyToChar(index);
char keychar = KeyToChar(index);
Text.Add(
keychar,
keychar.ToString(),
Matrix.TS(
pos + V.XYZ(-0.3f, -0.3f, 0),
V.XYZ(-1, -1, 0) * 8.0f

View file

@ -9,13 +9,13 @@ public class MonoNet {
byte[] wData; int wHead;
public bool send = true;
public int value = 0;
public char value = ' ';
public MonoNet() {
socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
string ip = "192.168.1.81";
string ip = "192.168.0.23";
EndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(ip), 1234);
socket.Connect(serverEndPoint);