добавил русский язык
This commit is contained in:
parent
f193f212a5
commit
21e81f471d
@ -139,7 +139,6 @@
|
||||
<ClInclude Include="..\include\raymath.h" />
|
||||
<ClInclude Include="..\include\resource_dir.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="resource1.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\main.c" />
|
||||
|
@ -30,9 +30,6 @@
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource1.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\main.c">
|
||||
|
BIN
lab16 with raylib/resources/Inconsolata-LGC-Bold.ttf
Normal file
BIN
lab16 with raylib/resources/Inconsolata-LGC-Bold.ttf
Normal file
Binary file not shown.
BIN
lab16 with raylib/resources/Inconsolata-LGC.ttf
Normal file
BIN
lab16 with raylib/resources/Inconsolata-LGC.ttf
Normal file
Binary file not shown.
@ -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 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 20 5
|
||||
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 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 9 34
|
||||
3 4 2
|
||||
|
22
lab16 with raylib/src/fonts.py
Normal file
22
lab16 with raylib/src/fonts.py
Normal 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)
|
@ -1,4 +1,4 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <stdio.h>
|
||||
#include <iso646.h>
|
||||
#include "raylib.h"
|
||||
@ -14,15 +14,16 @@
|
||||
#define HEIGHT 50
|
||||
#define WIDTH 50
|
||||
#define VOFFSET 50
|
||||
|
||||
#define PUREBLUE (Color) { 0, 0, 255, 255 }
|
||||
#define BLACKGRAY (Color) {30, 30, 30, 255}
|
||||
#define VSGRAY (Color) {78, 201, 176, 255}
|
||||
|
||||
// Ęîäű ˙÷ĺĺę:
|
||||
// 0 - ńâîáîäíŕ
|
||||
// Коды ячеек:
|
||||
// 0 - свободна
|
||||
// 1 -
|
||||
// 2 - ďđĺď˙ňńňâčĺ
|
||||
// 3 - çîëîňî
|
||||
// 2 - препятствие
|
||||
// 3 - золото
|
||||
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, 3, 0, 0, 0, 0, 0},
|
||||
@ -146,11 +147,11 @@ void drawNet() {
|
||||
}
|
||||
|
||||
void drawMap() {
|
||||
// Ęîäű ˙÷ĺĺę:
|
||||
// 0 - ńâîáîäíŕ
|
||||
// Коды ячеек:
|
||||
// 0 - свободна
|
||||
// 1 -
|
||||
// 2 - ďđĺď˙ňńňâčĺ
|
||||
// 3 - çîëîňî
|
||||
// 2 - препятствие
|
||||
// 3 - золото
|
||||
Color colors[4] = { LIGHTGRAY, PUREBLUE, BLACK, YELLOW };
|
||||
|
||||
for (int i = 0; i < M; i++) {
|
||||
@ -194,10 +195,11 @@ void drawBottomBar(Font font, float fontSize) {
|
||||
void save() {
|
||||
FILE* fout = fopen("savefile.txt", "w");
|
||||
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;
|
||||
}
|
||||
|
||||
@ -222,21 +224,21 @@ void save() {
|
||||
void load() {
|
||||
FILE* fin = fopen("savefile.txt", "r");
|
||||
if (fin == NULL) {
|
||||
printf("error");
|
||||
GuiMessageBox((Rectangle) { N* WIDTH / 2 - 50, M* HEIGHT - 50, N* WIDTH / 2 + 50, M* HEIGHT + 50, },
|
||||
"Îřčáęŕ çŕăđóçęč",
|
||||
"Ôŕéë íĺ íŕéäĺí\nĎîďđîáóéňĺ ńíŕ÷ŕëŕ ńîőđŕíčňü čăđó",
|
||||
"Îę;Âűéňč");
|
||||
printf("1) load error\n");
|
||||
/*GuiMessageBox((Rectangle) { N* WIDTH / 2 - 50, M* HEIGHT - 50, N* WIDTH / 2 + 50, M* HEIGHT + 50, },
|
||||
"Ошибка загрузки",
|
||||
"Файл не найден\nПопробуйте сначала сохранить игру",
|
||||
"Ок;Выйти");*/
|
||||
return;
|
||||
}
|
||||
int m, n;
|
||||
fscanf_s(fin, "%d%d", &m, &n);
|
||||
if (m != M || n != N) {
|
||||
printf("error");
|
||||
GuiMessageBox((Rectangle) { N* WIDTH / 2 - 50, M* HEIGHT - 50, N* WIDTH / 2 + 50, M* HEIGHT + 50, },
|
||||
"Îřčáęŕ çŕăđóçęč",
|
||||
"Íĺďđŕâčëüíűé đŕçěĺđ ęŕđňű!\nĎđîâĺđüňĺ öĺëîńňíîńňü ńîőđŕíĺíč˙",
|
||||
"Îę;Âűéňč");
|
||||
printf("2) load error\n");
|
||||
/*GuiMessageBox((Rectangle) { N* WIDTH / 2 - 50, M* HEIGHT - 50, N* WIDTH / 2 + 50, M* HEIGHT + 50, },
|
||||
"Ошибка загрузки",
|
||||
"Неправильный размер карты!\nПроверьте целостность сохранения",
|
||||
"Ок;Выйти");*/
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < m; i++) {
|
||||
@ -255,60 +257,65 @@ void load() {
|
||||
}
|
||||
|
||||
void handleKeys() {
|
||||
switch (GetKeyPressed())
|
||||
{
|
||||
case KEY_F5:
|
||||
save();
|
||||
break;
|
||||
case KEY_F9:
|
||||
load();
|
||||
break;
|
||||
case KEY_SPACE:
|
||||
netToggle = !netToggle;
|
||||
break;
|
||||
case KEY_W:
|
||||
movePlayer(up);
|
||||
break;
|
||||
case KEY_S:
|
||||
movePlayer(down);
|
||||
break;
|
||||
case KEY_D:
|
||||
movePlayer(right);
|
||||
break;
|
||||
case KEY_A:
|
||||
movePlayer(left);
|
||||
break;
|
||||
case KEY_ONE:
|
||||
stomp(1);
|
||||
break;
|
||||
case KEY_TWO:
|
||||
stomp(2);
|
||||
break;
|
||||
case KEY_Z:
|
||||
deathbeam(right);
|
||||
break;
|
||||
case KEY_M:
|
||||
doMidashand();
|
||||
break;
|
||||
case KEY_G:
|
||||
if (selected_element == gold) selected_element = wall;
|
||||
else selected_element = gold;
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
putElement(left, selected_element);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
putElement(right, selected_element);
|
||||
break;
|
||||
case KEY_UP:
|
||||
putElement(up, selected_element);
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
putElement(down, selected_element);
|
||||
break;
|
||||
int key;
|
||||
while (key = GetKeyPressed()) {
|
||||
switch (key)
|
||||
{
|
||||
case KEY_F5:
|
||||
save();
|
||||
break;
|
||||
case KEY_F9:
|
||||
load();
|
||||
break;
|
||||
case KEY_SPACE:
|
||||
netToggle = !netToggle;
|
||||
break;
|
||||
case KEY_W:
|
||||
movePlayer(up);
|
||||
break;
|
||||
case KEY_S:
|
||||
movePlayer(down);
|
||||
break;
|
||||
case KEY_D:
|
||||
movePlayer(right);
|
||||
break;
|
||||
case KEY_A:
|
||||
movePlayer(left);
|
||||
break;
|
||||
case KEY_ONE:
|
||||
stomp(1);
|
||||
break;
|
||||
case KEY_TWO:
|
||||
stomp(2);
|
||||
break;
|
||||
case KEY_Z:
|
||||
deathbeam(right);
|
||||
break;
|
||||
case KEY_M:
|
||||
doMidashand();
|
||||
break;
|
||||
case KEY_G:
|
||||
if (selected_element == gold) selected_element = wall;
|
||||
else selected_element = gold;
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
putElement(left, selected_element);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
putElement(right, selected_element);
|
||||
break;
|
||||
case KEY_UP:
|
||||
putElement(up, selected_element);
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
putElement(down, selected_element);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define CDPSIZE 213
|
||||
int main() {
|
||||
//SetConfigFlags(FLAG_WINDOW_HIGHDPI);
|
||||
|
||||
@ -318,10 +325,16 @@ int main() {
|
||||
|
||||
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 InconsolataSemiBold = LoadFontEx("Inconsolata-SemiBold.ttf", 48, NULL, 0);
|
||||
SetTextureFilter(InconsolataSemiBold.texture, TEXTURE_FILTER_BILINEAR);
|
||||
//Font InconsolataBold = LoadFontEx("Inconsolata-Bold.ttf", 24, NULL, 0);
|
||||
//Font InconsolataSemiBold = LoadFontEx("Inconsolata-SemiBold.ttf", 48, codepoints, 512);
|
||||
Font InconsolataBold = LoadFontEx("Inconsolata-LGC-Bold.ttf", 48, codepoints, CDPSIZE);
|
||||
SetTextureFilter(InconsolataBold.texture, TEXTURE_FILTER_BILINEAR);
|
||||
|
||||
//GuiSetFont(InconsolataBold);
|
||||
|
||||
// game loop
|
||||
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();
|
||||
drawPlayer();
|
||||
drawBottomBar(InconsolataSemiBold, 24);
|
||||
drawBottomBar(InconsolataBold, 24);
|
||||
|
||||
if (netToggle) {
|
||||
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...)
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
//UnloadFont(InconsolataRegular);
|
||||
UnloadFont(InconsolataSemiBold);
|
||||
UnloadFont(InconsolataBold);
|
||||
//UnloadFont(InconsolataBold);
|
||||
|
||||
// destroy the window and cleanup the OpenGL context
|
||||
|
0
lab16 with raylib/src/Вывод-Сборка.txt
Normal file
0
lab16 with raylib/src/Вывод-Сборка.txt
Normal file
BIN
raylib files/InconsolataLGC-1.9.0.tar.xz
Normal file
BIN
raylib files/InconsolataLGC-1.9.0.tar.xz
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user