добавил русский язык

This commit is contained in:
Kaehvaman 2024-12-11 23:44:03 +04:00
parent f193f212a5
commit 21e81f471d
9 changed files with 129 additions and 94 deletions

View File

@ -139,7 +139,6 @@
<ClInclude Include="..\include\raymath.h" /> <ClInclude Include="..\include\raymath.h" />
<ClInclude Include="..\include\resource_dir.h" /> <ClInclude Include="..\include\resource_dir.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="resource1.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\main.c" /> <ClCompile Include="..\src\main.c" />

View File

@ -30,9 +30,6 @@
<ClInclude Include="resource.h"> <ClInclude Include="resource.h">
<Filter>Файлы заголовков</Filter> <Filter>Файлы заголовков</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource1.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\main.c"> <ClCompile Include="..\src\main.c">

Binary file not shown.

Binary file not shown.

View File

@ -1,13 +1,13 @@
10 55 10 25
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 3 0 0 3 0 0 0 0 0
0 0 0 0 0 0 3 0 0 0 0 0 0 0 0
0 0 0 3 0 3 3 3 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 3 0 0 0
0 0 0 0 0 0 3 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 3 0 0 0 0 2 0
0 0 0 0 0 0 0 2 0 0 0 0 0 2 0
0 0 0 0 0 0 2 2 2 2 0 0 0 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 20 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11 6 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 9 34
3 4 2

View File

@ -0,0 +1,22 @@
from itertools import chain
import sys
from fontTools.ttLib import TTFont
from fontTools.unicode import Unicode
with TTFont(
sys.argv[1], 0, allowVID=0, ignoreDecompileErrors=True, fontNumber=-1
) as ttf:
chars = chain.from_iterable(
[y + (Unicode[y[0]],) for y in x.cmap.items()] for x in ttf["cmap"].tables
)
if len(sys.argv) == 2: # print all code points
for c in chars:
print(c)
elif len(sys.argv) >= 3: # search code points / characters
code_points = {c[0] for c in chars}
for i in sys.argv[2:]:
code_point = int(i) # search code point
#code_point = ord(i) # search character
print(Unicode[code_point])
print(code_point in code_points)

View File

@ -1,4 +1,4 @@
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h> #include <stdio.h>
#include <iso646.h> #include <iso646.h>
#include "raylib.h" #include "raylib.h"
@ -14,15 +14,16 @@
#define HEIGHT 50 #define HEIGHT 50
#define WIDTH 50 #define WIDTH 50
#define VOFFSET 50 #define VOFFSET 50
#define PUREBLUE (Color) { 0, 0, 255, 255 } #define PUREBLUE (Color) { 0, 0, 255, 255 }
#define BLACKGRAY (Color) {30, 30, 30, 255} #define BLACKGRAY (Color) {30, 30, 30, 255}
#define VSGRAY (Color) {78, 201, 176, 255} #define VSGRAY (Color) {78, 201, 176, 255}
// Ęîäű ˙÷ĺĺę: // Коды ячеек:
// 0 - ńâîáîäíŕ // 0 - свободна
// 1 - // 1 -
// 2 - ďđĺď˙ňńňâčĺ // 2 - препятствие
// 3 - çîëîňî // 3 - золото
int map[M][N] = { int map[M][N] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
@ -146,11 +147,11 @@ void drawNet() {
} }
void drawMap() { void drawMap() {
// Ęîäű ˙÷ĺĺę: // Коды ячеек:
// 0 - ńâîáîäíŕ // 0 - свободна
// 1 - // 1 -
// 2 - ďđĺď˙ňńňâčĺ // 2 - препятствие
// 3 - çîëîňî // 3 - золото
Color colors[4] = { LIGHTGRAY, PUREBLUE, BLACK, YELLOW }; Color colors[4] = { LIGHTGRAY, PUREBLUE, BLACK, YELLOW };
for (int i = 0; i < M; i++) { for (int i = 0; i < M; i++) {
@ -194,10 +195,11 @@ void drawBottomBar(Font font, float fontSize) {
void save() { void save() {
FILE* fout = fopen("savefile.txt", "w"); FILE* fout = fopen("savefile.txt", "w");
if (fout == NULL) { if (fout == NULL) {
GuiMessageBox((Rectangle) { N * WIDTH / 2 - 50 , M*HEIGHT - 50, N * WIDTH / 2 + 50 , M*HEIGHT + 50,}, /*GuiMessageBox((Rectangle) { N * WIDTH / 2 - 50 , M*HEIGHT - 50, N * WIDTH / 2 + 50 , M*HEIGHT + 50,},
"Îřčáęŕ ńîőđŕíĺíč˙", "Ошибка сохранения",
"Íĺâîçěîćíî ńîçäŕňü ôŕéë", "Невозможно создать файл",
"Îę;Âűéňč"); "Ок;Выйти");*/
printf("save error");
return; return;
} }
@ -222,21 +224,21 @@ void save() {
void load() { void load() {
FILE* fin = fopen("savefile.txt", "r"); FILE* fin = fopen("savefile.txt", "r");
if (fin == NULL) { if (fin == NULL) {
printf("error"); printf("1) load error\n");
GuiMessageBox((Rectangle) { N* WIDTH / 2 - 50, M* HEIGHT - 50, N* WIDTH / 2 + 50, M* HEIGHT + 50, }, /*GuiMessageBox((Rectangle) { N* WIDTH / 2 - 50, M* HEIGHT - 50, N* WIDTH / 2 + 50, M* HEIGHT + 50, },
"Îřčáęŕ çŕăđóçęč", "Ошибка загрузки",
"Ôŕéë íĺ íŕéäĺí\nĎîďđîáóéňĺ ńíŕ÷ŕëŕ ńîőđŕíčňü čăđó", "Файл не найден\nПопробуйте сначала сохранить игру",
"Îę;Âűéňč"); "Ок;Выйти");*/
return; return;
} }
int m, n; int m, n;
fscanf_s(fin, "%d%d", &m, &n); fscanf_s(fin, "%d%d", &m, &n);
if (m != M || n != N) { if (m != M || n != N) {
printf("error"); printf("2) load error\n");
GuiMessageBox((Rectangle) { N* WIDTH / 2 - 50, M* HEIGHT - 50, N* WIDTH / 2 + 50, M* HEIGHT + 50, }, /*GuiMessageBox((Rectangle) { N* WIDTH / 2 - 50, M* HEIGHT - 50, N* WIDTH / 2 + 50, M* HEIGHT + 50, },
"Îřčáęŕ çŕăđóçęč", "Ошибка загрузки",
"Íĺďđŕâčëüíűé đŕçěĺđ ęŕđňű!\nĎđîâĺđüňĺ öĺëîńňíîńňü ńîőđŕíĺíč˙", "Неправильный размер карты!\nПроверьте целостность сохранения",
"Îę;Âűéňč"); "Ок;Выйти");*/
return; return;
} }
for (int i = 0; i < m; i++) { for (int i = 0; i < m; i++) {
@ -255,60 +257,65 @@ void load() {
} }
void handleKeys() { void handleKeys() {
switch (GetKeyPressed()) int key;
{ while (key = GetKeyPressed()) {
case KEY_F5: switch (key)
save(); {
break; case KEY_F5:
case KEY_F9: save();
load(); break;
break; case KEY_F9:
case KEY_SPACE: load();
netToggle = !netToggle; break;
break; case KEY_SPACE:
case KEY_W: netToggle = !netToggle;
movePlayer(up); break;
break; case KEY_W:
case KEY_S: movePlayer(up);
movePlayer(down); break;
break; case KEY_S:
case KEY_D: movePlayer(down);
movePlayer(right); break;
break; case KEY_D:
case KEY_A: movePlayer(right);
movePlayer(left); break;
break; case KEY_A:
case KEY_ONE: movePlayer(left);
stomp(1); break;
break; case KEY_ONE:
case KEY_TWO: stomp(1);
stomp(2); break;
break; case KEY_TWO:
case KEY_Z: stomp(2);
deathbeam(right); break;
break; case KEY_Z:
case KEY_M: deathbeam(right);
doMidashand(); break;
break; case KEY_M:
case KEY_G: doMidashand();
if (selected_element == gold) selected_element = wall; break;
else selected_element = gold; case KEY_G:
break; if (selected_element == gold) selected_element = wall;
case KEY_LEFT: else selected_element = gold;
putElement(left, selected_element); break;
break; case KEY_LEFT:
case KEY_RIGHT: putElement(left, selected_element);
putElement(right, selected_element); break;
break; case KEY_RIGHT:
case KEY_UP: putElement(right, selected_element);
putElement(up, selected_element); break;
break; case KEY_UP:
case KEY_DOWN: putElement(up, selected_element);
putElement(down, selected_element); break;
break; case KEY_DOWN:
putElement(down, selected_element);
break;
}
} }
} }
#define CDPSIZE 213
int main() { int main() {
//SetConfigFlags(FLAG_WINDOW_HIGHDPI); //SetConfigFlags(FLAG_WINDOW_HIGHDPI);
@ -318,10 +325,16 @@ int main() {
SearchAndSetResourceDir("resources"); SearchAndSetResourceDir("resources");
int codepoints[CDPSIZE] = { 0 };
for (int i = 0; i < 127 - 32; i++) codepoints[i] = 32 + i; // Basic ASCII characters
for (int i = 0; i < 118; i++) codepoints[95 + i] = 1024 + i; // Cyrillic characters
//Font InconsolataRegular = LoadFontEx("Inconsolata-Regular.ttf", 24, NULL, 0); //Font InconsolataRegular = LoadFontEx("Inconsolata-Regular.ttf", 24, NULL, 0);
Font InconsolataSemiBold = LoadFontEx("Inconsolata-SemiBold.ttf", 48, NULL, 0); //Font InconsolataSemiBold = LoadFontEx("Inconsolata-SemiBold.ttf", 48, codepoints, 512);
SetTextureFilter(InconsolataSemiBold.texture, TEXTURE_FILTER_BILINEAR); Font InconsolataBold = LoadFontEx("Inconsolata-LGC-Bold.ttf", 48, codepoints, CDPSIZE);
//Font InconsolataBold = LoadFontEx("Inconsolata-Bold.ttf", 24, NULL, 0); SetTextureFilter(InconsolataBold.texture, TEXTURE_FILTER_BILINEAR);
//GuiSetFont(InconsolataBold);
// game loop // game loop
while (!WindowShouldClose()) // run the loop untill the user presses ESCAPE or presses the Close button on the window while (!WindowShouldClose()) // run the loop untill the user presses ESCAPE or presses the Close button on the window
@ -336,18 +349,22 @@ int main() {
drawMap(); drawMap();
drawPlayer(); drawPlayer();
drawBottomBar(InconsolataSemiBold, 24); drawBottomBar(InconsolataBold, 24);
if (netToggle) { if (netToggle) {
drawNet(); drawNet();
} }
// show FPS and frametime
//DrawText(TextFormat("%2d FPS", GetFPS()), 0, 0, 34, ORANGE);
//DrawText(TextFormat("%4f ms", GetFrameTime()), 0, 34, 34, BEIGE);
// end the frame and get ready for the next one (display frame, poll input, etc...) // end the frame and get ready for the next one (display frame, poll input, etc...)
EndDrawing(); EndDrawing();
} }
//UnloadFont(InconsolataRegular); //UnloadFont(InconsolataRegular);
UnloadFont(InconsolataSemiBold); UnloadFont(InconsolataBold);
//UnloadFont(InconsolataBold); //UnloadFont(InconsolataBold);
// destroy the window and cleanup the OpenGL context // destroy the window and cleanup the OpenGL context

Binary file not shown.