2024-12-11 23:44:03 +04:00
|
|
|
|
#define _CRT_SECURE_NO_WARNINGS
|
2024-12-11 21:01:00 +04:00
|
|
|
|
#include <stdio.h>
|
2024-12-14 00:32:50 +04:00
|
|
|
|
#include <stdlib.h>
|
2024-12-11 21:01:00 +04:00
|
|
|
|
#include <iso646.h>
|
|
|
|
|
#include "raylib.h"
|
|
|
|
|
#include "raymath.h"
|
2024-12-12 15:02:30 +04:00
|
|
|
|
#include "resource_dir.h"
|
2024-12-12 23:41:46 +04:00
|
|
|
|
#include "windows_functions.h"
|
2024-12-20 21:27:27 +04:00
|
|
|
|
#include "tinyfiledialogs.h"
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
|
|
|
|
#define RAYGUI_IMPLEMENTATION
|
2024-12-12 23:41:46 +04:00
|
|
|
|
//#define RAYGUI_PANEL_BORDER_WIDTH 2
|
|
|
|
|
#define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT 32
|
|
|
|
|
#define RAYGUI_MESSAGEBOX_BUTTON_HEIGHT 36
|
2024-12-11 21:01:00 +04:00
|
|
|
|
#include "raygui.h"
|
|
|
|
|
|
2024-12-14 00:32:50 +04:00
|
|
|
|
#define RAYLIB_NUKLEAR_IMPLEMENTATION
|
|
|
|
|
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
|
2024-12-20 21:27:27 +04:00
|
|
|
|
//#define RAYLIB_NUKLEAR_DEFAULT_ARC_SEGMENTS 1
|
2024-12-14 00:32:50 +04:00
|
|
|
|
#pragma warning(disable: 4116)
|
|
|
|
|
#include "raylib-nuklear.h"
|
2024-12-12 21:35:04 +04:00
|
|
|
|
|
2024-12-11 21:01:00 +04:00
|
|
|
|
#define M 10
|
|
|
|
|
#define N 15
|
|
|
|
|
#define HEIGHT 50
|
|
|
|
|
#define WIDTH 50
|
2024-12-27 10:57:48 +04:00
|
|
|
|
#define VOFFSET 52
|
2024-12-11 23:44:03 +04:00
|
|
|
|
|
2024-12-12 15:02:30 +04:00
|
|
|
|
#define FWIDTH (float)WIDTH
|
|
|
|
|
#define FHEIGHT (float)HEIGHT
|
|
|
|
|
|
2024-12-11 21:01:00 +04:00
|
|
|
|
#define PUREBLUE (Color) { 0, 0, 255, 255 }
|
|
|
|
|
#define BLACKGRAY (Color) {30, 30, 30, 255}
|
2024-12-20 21:27:27 +04:00
|
|
|
|
#define VSGREEN (Color) {78, 201, 176, 255}
|
2024-12-27 14:05:23 +04:00
|
|
|
|
#define WATERBLUE CLITERAL(Color){200, 240, 255, 255}
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
2024-12-11 23:44:03 +04:00
|
|
|
|
// Коды ячеек:
|
|
|
|
|
// 0 - свободна
|
2024-12-11 21:01:00 +04:00
|
|
|
|
// 1 -
|
2024-12-11 23:44:03 +04:00
|
|
|
|
// 2 - препятствие
|
|
|
|
|
// 3 - золото
|
2024-12-11 21:01:00 +04:00
|
|
|
|
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},
|
|
|
|
|
{0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
|
|
|
|
|
{0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 3, 3, 0, 0, 0},
|
|
|
|
|
{0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 3, 0, 0, 0},
|
|
|
|
|
|
|
|
|
|
{0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0},
|
|
|
|
|
{0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 2, 0, 0, 2, 0},
|
|
|
|
|
{0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0},
|
|
|
|
|
{0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0},
|
|
|
|
|
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int player_x = 1;
|
|
|
|
|
int player_y = 1;
|
|
|
|
|
|
2024-12-24 20:06:13 +04:00
|
|
|
|
typedef enum obj_enum { empty = 0, wall = 2, gold = 3 } obj_enum;
|
2024-12-11 21:01:00 +04:00
|
|
|
|
// TODO: do something with "empty" object
|
|
|
|
|
#define INVENTORY_SIZE 4
|
|
|
|
|
int inventory[INVENTORY_SIZE] = { 0, 0, 15, 0 };
|
|
|
|
|
obj_enum selected_element = gold;
|
|
|
|
|
|
2024-12-12 23:41:46 +04:00
|
|
|
|
typedef enum { left, right, up, down } enum_ways;
|
2024-12-11 21:01:00 +04:00
|
|
|
|
void movePlayer(enum_ways move) {
|
|
|
|
|
switch (move) {
|
|
|
|
|
case left:
|
2024-12-24 20:06:13 +04:00
|
|
|
|
if (player_x > 0) {
|
|
|
|
|
if (map[player_y][player_x - 1] != wall) {
|
|
|
|
|
player_x -= 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (map[player_y][N - 1] != wall) {
|
|
|
|
|
player_x = N - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-11 21:01:00 +04:00
|
|
|
|
break;
|
|
|
|
|
case right:
|
2024-12-24 20:06:13 +04:00
|
|
|
|
if (player_x < N - 1) {
|
|
|
|
|
if (map[player_y][player_x + 1] != wall) {
|
|
|
|
|
player_x += 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (map[player_y][0] != wall) {
|
|
|
|
|
player_x = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-11 21:01:00 +04:00
|
|
|
|
break;
|
|
|
|
|
case up:
|
2024-12-24 20:06:13 +04:00
|
|
|
|
if (player_y > 0) {
|
|
|
|
|
if (map[player_y - 1][player_x] != wall) {
|
|
|
|
|
player_y -= 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (map[M - 1][player_x] != wall) {
|
|
|
|
|
player_y = M - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-11 21:01:00 +04:00
|
|
|
|
break;
|
|
|
|
|
case down:
|
2024-12-24 20:06:13 +04:00
|
|
|
|
if (player_y < M - 1) {
|
|
|
|
|
if (map[player_y + 1][player_x] != wall) {
|
|
|
|
|
player_y += 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (map[0][player_x] != wall) {
|
|
|
|
|
player_y = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-11 21:01:00 +04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (map[player_y][player_x] == gold) {
|
|
|
|
|
map[player_y][player_x] = empty;
|
|
|
|
|
inventory[gold]++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void putElement(enum_ways way, obj_enum element) {
|
|
|
|
|
if (element != empty && inventory[element] == 0) return;
|
|
|
|
|
|
|
|
|
|
switch (way) {
|
|
|
|
|
case left:
|
|
|
|
|
if ((player_x > 0) and map[player_y][player_x - 1] == 0) {
|
|
|
|
|
map[player_y][player_x - 1] = element;
|
|
|
|
|
inventory[element]--;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case right:
|
|
|
|
|
if ((player_x < N - 1) and map[player_y][player_x + 1] == 0) {
|
|
|
|
|
map[player_y][player_x + 1] = element;
|
|
|
|
|
inventory[element]--;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case up:
|
|
|
|
|
if ((player_y > 0) and map[player_y - 1][player_x] == 0) {
|
|
|
|
|
map[player_y - 1][player_x] = element;
|
|
|
|
|
inventory[element]--;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case down:
|
|
|
|
|
if ((player_y < M - 1) and map[player_y + 1][player_x] == 0) {
|
|
|
|
|
map[player_y + 1][player_x] = element;
|
|
|
|
|
inventory[element]--;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void deathbeam(enum_ways way) {
|
|
|
|
|
for (int i = player_x + 1; i < N; i++) {
|
|
|
|
|
if (map[player_y][i] != empty) inventory[map[player_y][i]] += 1;
|
|
|
|
|
map[player_y][i] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void stomp(int r) {
|
|
|
|
|
for (int i = 0; i < M; i++) {
|
|
|
|
|
for (int j = 0; j < N; j++) {
|
|
|
|
|
if ((player_y - r <= i) && (i <= player_y + r) && (player_x - r <= j) && (j <= player_x + r) && map[i][j] == wall) {
|
|
|
|
|
inventory[wall] += 1;
|
|
|
|
|
map[i][j] = empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void midasHand(int m, int n) {
|
|
|
|
|
if (map[m][n] == wall) {
|
|
|
|
|
map[m][n] = gold;
|
|
|
|
|
if (m > 0) midasHand(m - 1, n);
|
|
|
|
|
if (n > 0) midasHand(m, n - 1);
|
|
|
|
|
if (m < M - 1) midasHand(m + 1, n);
|
|
|
|
|
if (n < N - 1) midasHand(m, n + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void doMidashand() {
|
|
|
|
|
if ((player_y < M - 1) and map[player_y + 1][player_x] == wall) midasHand(player_y + 1, player_x);
|
|
|
|
|
if ((player_x < N - 1) and map[player_y][player_x + 1] == wall) midasHand(player_y, player_x + 1);
|
|
|
|
|
if ((player_y > 0) and map[player_y - 1][player_x] == wall) midasHand(player_y - 1, player_x);
|
|
|
|
|
if ((player_x > 0) and map[player_y][player_x - 1] == wall) midasHand(player_y, player_x - 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool netToggle = false;
|
|
|
|
|
void drawNet() {
|
2024-12-12 15:02:30 +04:00
|
|
|
|
for (int i = 0; i <= N * WIDTH; i += WIDTH) {
|
2024-12-11 21:01:00 +04:00
|
|
|
|
DrawLine(i, 0, i, M * HEIGHT, BLACK);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 15:02:30 +04:00
|
|
|
|
for (int i = 0; i <= M * HEIGHT; i += HEIGHT) {
|
2024-12-11 21:01:00 +04:00
|
|
|
|
DrawLine(0, i, N * WIDTH, i, BLACK);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void drawMap() {
|
2024-12-11 23:44:03 +04:00
|
|
|
|
// Коды ячеек:
|
|
|
|
|
// 0 - свободна
|
2024-12-11 21:01:00 +04:00
|
|
|
|
// 1 -
|
2024-12-11 23:44:03 +04:00
|
|
|
|
// 2 - препятствие
|
|
|
|
|
// 3 - золото
|
2024-12-11 21:01:00 +04:00
|
|
|
|
Color colors[4] = { LIGHTGRAY, PUREBLUE, BLACK, YELLOW };
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < M; i++) {
|
|
|
|
|
for (int j = 0; j < N; j++) {
|
|
|
|
|
int x1 = j * WIDTH;
|
|
|
|
|
int y1 = i * HEIGHT;
|
|
|
|
|
DrawRectangle(x1, y1, WIDTH, HEIGHT, colors[map[i][j]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void drawPlayer() {
|
|
|
|
|
int x1 = player_x * WIDTH;
|
|
|
|
|
int y1 = player_y * HEIGHT;;
|
|
|
|
|
DrawRectangle(x1, y1, WIDTH, HEIGHT, PUREBLUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void drawBottomBar(Font font, float fontSize) {
|
|
|
|
|
DrawRectangle(0, HEIGHT * M, WIDTH * N, VOFFSET, BLACKGRAY);
|
|
|
|
|
|
|
|
|
|
static char gold_string[50];
|
|
|
|
|
static char wall_string[50];
|
|
|
|
|
|
|
|
|
|
static char help_string[] = "wasd - move player G - change item F5 - save\narrows - place item M - Midas hand F9 - load";
|
|
|
|
|
|
|
|
|
|
sprintf(gold_string, " gold = %d", inventory[gold]);
|
|
|
|
|
sprintf(wall_string, " wall = %d", inventory[wall]);
|
|
|
|
|
|
|
|
|
|
if (selected_element == gold) gold_string[0] = '>';
|
|
|
|
|
else if (selected_element == wall) wall_string[0] = '>';
|
|
|
|
|
|
|
|
|
|
Vector2 goldpos = { WIDTH / 4, HEIGHT * M };
|
|
|
|
|
Vector2 wallpos = { WIDTH / 4, HEIGHT * M + fontSize };
|
|
|
|
|
Vector2 helppos = { WIDTH * N - 550 , HEIGHT * M };
|
|
|
|
|
|
2024-12-20 21:27:27 +04:00
|
|
|
|
DrawTextEx(font, gold_string, goldpos, fontSize, 0, VSGREEN);
|
|
|
|
|
DrawTextEx(font, wall_string, wallpos, fontSize, 0, VSGREEN);
|
|
|
|
|
DrawTextEx(font, help_string, helppos, fontSize, 0, VSGREEN);
|
2024-12-11 21:01:00 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void save() {
|
|
|
|
|
FILE* fout = fopen("savefile.txt", "w");
|
|
|
|
|
if (fout == NULL) {
|
2024-12-11 23:44:03 +04:00
|
|
|
|
printf("save error");
|
2024-12-11 21:01:00 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(fout, "%d %d\n", M, N);
|
|
|
|
|
for (int i = 0; i < M; i++) {
|
|
|
|
|
for (int j = 0; j < N; j++) {
|
|
|
|
|
fprintf(fout, "%d ", map[i][j]);
|
|
|
|
|
}
|
|
|
|
|
fprintf(fout, "\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < INVENTORY_SIZE; i++) {
|
|
|
|
|
fprintf(fout, "%d ", inventory[i]);
|
|
|
|
|
}
|
|
|
|
|
fprintf(fout, "\n");
|
|
|
|
|
|
|
|
|
|
fprintf(fout, "%d %d %d\n", player_x, player_y, selected_element);
|
|
|
|
|
|
|
|
|
|
fclose(fout);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 23:41:46 +04:00
|
|
|
|
typedef enum { OK = 0, saveError, loadError1, loadError2 } ErrorCodes;
|
2024-12-12 21:35:04 +04:00
|
|
|
|
ErrorCodes errorCode = OK;
|
2024-12-11 21:01:00 +04:00
|
|
|
|
void load() {
|
|
|
|
|
FILE* fin = fopen("savefile.txt", "r");
|
|
|
|
|
if (fin == NULL) {
|
2024-12-11 23:44:03 +04:00
|
|
|
|
printf("1) load error\n");
|
2024-12-12 21:35:04 +04:00
|
|
|
|
/*MessageBoxA(
|
2024-12-14 00:32:50 +04:00
|
|
|
|
GetActiveWindow(),
|
2024-12-11 23:44:03 +04:00
|
|
|
|
"Файл не найден\nПопробуйте сначала сохранить игру",
|
2024-12-12 21:35:04 +04:00
|
|
|
|
"Ошибка загрузки",
|
|
|
|
|
MB_ICONERROR
|
|
|
|
|
);*/
|
2024-12-20 21:27:27 +04:00
|
|
|
|
tinyfd_messageBox(
|
|
|
|
|
u8"Ошибка сохранения",
|
|
|
|
|
u8"Невозможно создать файл\nПроверьте целостность сохранения",
|
|
|
|
|
u8"ok",
|
|
|
|
|
"error", 1);
|
2024-12-26 17:18:09 +04:00
|
|
|
|
//errorCode = loadError1;
|
2024-12-11 21:01:00 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
int m, n;
|
|
|
|
|
fscanf_s(fin, "%d%d", &m, &n);
|
|
|
|
|
if (m != M || n != N) {
|
2024-12-11 23:44:03 +04:00
|
|
|
|
printf("2) load error\n");
|
2024-12-12 21:35:04 +04:00
|
|
|
|
/*MessageBoxW(
|
|
|
|
|
NULL,
|
|
|
|
|
L"Неправильный размер карты!\nПроверьте целостность сохранения",
|
|
|
|
|
L"Ошибка загрузки",
|
|
|
|
|
MB_ICONERROR
|
|
|
|
|
);*/
|
|
|
|
|
errorCode = loadError2;
|
2024-12-11 21:01:00 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < m; i++) {
|
|
|
|
|
for (int j = 0; j < n; j++) {
|
|
|
|
|
fscanf_s(fin, "%d", &map[i][j]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < INVENTORY_SIZE; i++) {
|
|
|
|
|
fscanf_s(fin, "%d", &inventory[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fscanf_s(fin, "%d%d%d", &player_x, &player_y, &selected_element);
|
|
|
|
|
|
|
|
|
|
fclose(fin);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 15:02:30 +04:00
|
|
|
|
bool editMap = 0;
|
2024-12-11 21:01:00 +04:00
|
|
|
|
void handleKeys() {
|
2024-12-12 15:02:30 +04:00
|
|
|
|
|
|
|
|
|
/*if (IsKeyPressedRepeat(KEY_W)) movePlayer(up);
|
|
|
|
|
if (IsKeyPressedRepeat(KEY_S)) movePlayer(down);
|
|
|
|
|
if (IsKeyPressedRepeat(KEY_D)) movePlayer(right);
|
|
|
|
|
if (IsKeyPressedRepeat(KEY_A)) movePlayer(left);*/
|
|
|
|
|
|
2024-12-11 23:44:03 +04:00
|
|
|
|
int key;
|
|
|
|
|
while (key = GetKeyPressed()) {
|
2024-12-12 15:02:30 +04:00
|
|
|
|
if (not editMap) {
|
|
|
|
|
switch (key)
|
|
|
|
|
{
|
|
|
|
|
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_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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-11 23:44:03 +04:00
|
|
|
|
switch (key)
|
|
|
|
|
{
|
|
|
|
|
case KEY_F5:
|
|
|
|
|
save();
|
|
|
|
|
break;
|
|
|
|
|
case KEY_F9:
|
|
|
|
|
load();
|
|
|
|
|
break;
|
|
|
|
|
case KEY_SPACE:
|
|
|
|
|
netToggle = !netToggle;
|
|
|
|
|
break;
|
2024-12-12 15:02:30 +04:00
|
|
|
|
case KEY_ENTER:
|
|
|
|
|
editMap = !editMap;
|
2024-12-11 23:44:03 +04:00
|
|
|
|
break;
|
|
|
|
|
case KEY_G:
|
|
|
|
|
if (selected_element == gold) selected_element = wall;
|
|
|
|
|
else selected_element = gold;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-12-11 21:01:00 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-14 00:32:50 +04:00
|
|
|
|
void drawRayguiErrorBoxes() {
|
|
|
|
|
const Rectangle errorBoxRect = { N * WIDTH / 2 - 200, M * HEIGHT / 2 - 75, 400, 150 };
|
2024-12-12 21:35:04 +04:00
|
|
|
|
int btn = -1;
|
|
|
|
|
|
|
|
|
|
switch (errorCode)
|
|
|
|
|
{
|
2024-12-14 00:32:50 +04:00
|
|
|
|
case OK:
|
2024-12-12 21:35:04 +04:00
|
|
|
|
break;
|
|
|
|
|
case saveError:
|
|
|
|
|
btn = GuiMessageBox(errorBoxRect,
|
|
|
|
|
u8"Ошибка сохранения",
|
|
|
|
|
u8"Невозможно создать файл",
|
|
|
|
|
u8"Ок;Выйти");
|
|
|
|
|
break;
|
|
|
|
|
case loadError1:
|
|
|
|
|
btn = GuiMessageBox(errorBoxRect,
|
|
|
|
|
u8"Ошибка загрузки",
|
|
|
|
|
u8"Файл не найден\nПопробуйте сначала сохранить игру",
|
2024-12-12 23:41:46 +04:00
|
|
|
|
u8"Игнорировать;Выйти из игры");
|
2024-12-12 21:35:04 +04:00
|
|
|
|
break;
|
|
|
|
|
case loadError2:
|
|
|
|
|
btn = GuiMessageBox(errorBoxRect,
|
|
|
|
|
u8"Ошибка загрузки",
|
|
|
|
|
u8"Неправильный размер карты!\nПроверьте целостность сохранения",
|
2024-12-12 23:41:46 +04:00
|
|
|
|
u8"Игнорировать;Выйти из игры");
|
2024-12-12 21:35:04 +04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (btn)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
errorCode = OK;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
errorCode = OK;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-14 00:32:50 +04:00
|
|
|
|
int nk_error_box(struct nk_context* ctx, const char* title, const char* error, const char* description)
|
|
|
|
|
{
|
|
|
|
|
int result = -1;
|
|
|
|
|
if (nk_begin(ctx, title,
|
|
|
|
|
nk_rect(N * WIDTH / 2 - 200, M * HEIGHT / 2 - 72, 400, 144),
|
|
|
|
|
NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR))
|
|
|
|
|
{
|
|
|
|
|
nk_layout_row_dynamic(ctx, 24, 1);
|
|
|
|
|
nk_label(ctx, error, NK_TEXT_CENTERED);
|
|
|
|
|
nk_layout_row_dynamic(ctx, 24, 1);
|
|
|
|
|
nk_label(ctx, description, NK_TEXT_CENTERED);
|
|
|
|
|
nk_layout_row_dynamic(ctx, 36, 2);
|
|
|
|
|
if (nk_button_label(ctx, u8"Игнорировать")) {
|
|
|
|
|
result = 1;
|
|
|
|
|
}
|
|
|
|
|
if (nk_button_label(ctx, u8"Выйти из игры")) {
|
|
|
|
|
result = 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
result = 0;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void callNKErrorBoxes(struct nk_context* ctx) {
|
|
|
|
|
int btn = -1;
|
|
|
|
|
|
|
|
|
|
switch (errorCode)
|
|
|
|
|
{
|
|
|
|
|
case OK:
|
|
|
|
|
break;
|
|
|
|
|
case saveError:
|
|
|
|
|
btn = nk_error_box(ctx,
|
|
|
|
|
u8"Ошибка сохранения",
|
|
|
|
|
u8"Невозможно создать файл",
|
|
|
|
|
u8"Проверьте целостность сохранения");
|
|
|
|
|
break;
|
|
|
|
|
case loadError1:
|
|
|
|
|
btn = nk_error_box(ctx,
|
|
|
|
|
u8"Ошибка загрузки",
|
|
|
|
|
u8"Файл не найден",
|
2024-12-20 21:27:27 +04:00
|
|
|
|
u8"Попробуйте сначала сохранить игру");
|
2024-12-14 00:32:50 +04:00
|
|
|
|
break;
|
|
|
|
|
case loadError2:
|
|
|
|
|
btn = nk_error_box(ctx,
|
|
|
|
|
u8"Ошибка загрузки",
|
2024-12-20 21:27:27 +04:00
|
|
|
|
u8"Неправильный размер карты",
|
2024-12-14 00:32:50 +04:00
|
|
|
|
u8"Проверьте целостность сохранения");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (btn)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
errorCode = OK;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
errorCode = OK;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 15:02:30 +04:00
|
|
|
|
#define CPSIZE 213
|
2024-12-12 21:35:04 +04:00
|
|
|
|
int main()
|
|
|
|
|
{
|
2024-12-27 14:05:23 +04:00
|
|
|
|
SetConfigFlags(FLAG_WINDOW_HIGHDPI);
|
2024-12-26 17:18:09 +04:00
|
|
|
|
//SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
2024-12-26 17:18:09 +04:00
|
|
|
|
const int screenWidth = N * WIDTH;
|
|
|
|
|
const int screenHeight = M * HEIGHT + VOFFSET;
|
|
|
|
|
const float screenWidthF = (float)screenWidth;
|
|
|
|
|
const float screenHeightF = (float)screenHeight;
|
|
|
|
|
|
|
|
|
|
InitWindow(screenWidth, screenHeight, "lab16 with raylib");
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
2024-12-20 21:27:27 +04:00
|
|
|
|
SetTargetFPS(60);
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
|
|
|
|
SearchAndSetResourceDir("resources");
|
|
|
|
|
|
2024-12-12 15:02:30 +04:00
|
|
|
|
int codepoints[CPSIZE] = { 0 };
|
2024-12-11 23:44:03 +04:00
|
|
|
|
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
|
|
|
|
|
|
2024-12-11 21:01:00 +04:00
|
|
|
|
//Font InconsolataRegular = LoadFontEx("Inconsolata-Regular.ttf", 24, NULL, 0);
|
2024-12-11 23:44:03 +04:00
|
|
|
|
//Font InconsolataSemiBold = LoadFontEx("Inconsolata-SemiBold.ttf", 48, codepoints, 512);
|
2024-12-12 21:35:04 +04:00
|
|
|
|
Font InconsolataBold = LoadFontEx("Inconsolata-LGC-Bold.ttf", 36, codepoints, CPSIZE);
|
2024-12-11 23:44:03 +04:00
|
|
|
|
SetTextureFilter(InconsolataBold.texture, TEXTURE_FILTER_BILINEAR);
|
2024-12-24 20:06:13 +04:00
|
|
|
|
//Font Consolas = LoadFontEx("consola.ttf", 24, codepoints, CPSIZE);
|
|
|
|
|
//SetTextureFilter(Consolas.texture, TEXTURE_FILTER_BILINEAR);
|
2024-12-14 00:32:50 +04:00
|
|
|
|
//Font Arial = LoadFontEx("arial.ttf", 36, codepoints, CPSIZE);
|
|
|
|
|
//SetTextureFilter(Arial.texture, TEXTURE_FILTER_BILINEAR);
|
2024-12-11 23:44:03 +04:00
|
|
|
|
|
2024-12-26 17:18:09 +04:00
|
|
|
|
RenderTexture2D canvas = LoadRenderTexture(screenWidth, screenHeight);
|
2024-12-27 10:57:48 +04:00
|
|
|
|
SetTextureFilter(canvas.texture, TEXTURE_FILTER_BILINEAR);
|
|
|
|
|
SetTextureWrap(canvas.texture, TEXTURE_WRAP_CLAMP);
|
2024-12-26 17:18:09 +04:00
|
|
|
|
|
2024-12-27 16:44:44 +04:00
|
|
|
|
RenderTexture2D canvasBlurX = LoadRenderTexture(screenWidth, screenHeight);
|
|
|
|
|
SetTextureFilter(canvasBlurX.texture, TEXTURE_FILTER_BILINEAR);
|
|
|
|
|
SetTextureWrap(canvasBlurX.texture, TEXTURE_WRAP_CLAMP);
|
|
|
|
|
|
2024-12-26 17:18:09 +04:00
|
|
|
|
Shader blur = LoadShader(0, "blur.frag");
|
2024-12-27 10:57:48 +04:00
|
|
|
|
int blurRenderWidthLoc = GetShaderLocation(blur, "renderWidth");
|
|
|
|
|
int blurRenderHeightLoc = GetShaderLocation(blur, "renderHeight");
|
|
|
|
|
int blurSecondsLoc = GetShaderLocation(blur, "seconds");
|
|
|
|
|
SetShaderValue(blur, blurRenderWidthLoc, &screenWidthF, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
SetShaderValue(blur, blurRenderHeightLoc, &screenHeightF, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
|
|
|
|
|
Shader water = LoadShader(0, "water.frag");
|
|
|
|
|
int waterRenderWidthLoc = GetShaderLocation(water, "renderWidth");
|
|
|
|
|
int waterRenderHeightLoc = GetShaderLocation(water, "renderHeight");
|
|
|
|
|
int intensityLoc = GetShaderLocation(water, "intensity");
|
|
|
|
|
int wavesLoc = GetShaderLocation(water, "waves");
|
|
|
|
|
int speedVLoc = GetShaderLocation(water, "speedV");
|
|
|
|
|
int speedHLoc = GetShaderLocation(water, "speedH");
|
|
|
|
|
int waterSecondsLoc = GetShaderLocation(water, "seconds");
|
|
|
|
|
float waves = 60.0f;
|
|
|
|
|
float intensity = 1.0f;
|
|
|
|
|
float speedV = 2.0f;
|
|
|
|
|
float speedH = 2.0f;
|
|
|
|
|
SetShaderValue(water, wavesLoc, &waves, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
SetShaderValue(water, intensityLoc, &intensity, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
SetShaderValue(water, speedVLoc, &speedV, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
SetShaderValue(water, speedHLoc, &speedH, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
SetShaderValue(water, waterRenderWidthLoc, &screenWidthF, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
SetShaderValue(water, waterRenderHeightLoc, &screenHeightF, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
|
2024-12-27 14:05:23 +04:00
|
|
|
|
Texture waterbump = LoadTexture("waterbump_blur.png");
|
|
|
|
|
SetTextureFilter(waterbump, TEXTURE_FILTER_BILINEAR);
|
2024-12-27 10:57:48 +04:00
|
|
|
|
Shader watershader = LoadShader(0, "watershader.frag");
|
|
|
|
|
int xWaterBumpMapLoc = GetShaderLocation(watershader, "texture1");
|
|
|
|
|
int watershaderSecondsLoc = GetShaderLocation(watershader, "seconds");
|
2024-12-27 14:05:23 +04:00
|
|
|
|
int iResolutionLoc = GetShaderLocation(watershader, "iResolution");
|
|
|
|
|
Vector2 iResolution = { screenWidthF, screenHeightF };
|
|
|
|
|
SetShaderValue(watershader, iResolutionLoc, &iResolution, SHADER_UNIFORM_VEC2);
|
|
|
|
|
SetShaderValueTexture(watershader, xWaterBumpMapLoc, waterbump);
|
2024-12-26 17:18:09 +04:00
|
|
|
|
|
2024-12-27 16:44:44 +04:00
|
|
|
|
Shader blur13 = LoadShader(0, "blur13.frag");
|
|
|
|
|
int blur13resolution = GetShaderLocation(blur13, "resolution");
|
|
|
|
|
int blur13direction = GetShaderLocation(blur13, "direction");
|
|
|
|
|
SetShaderValue(blur13, blur13resolution, &iResolution, SHADER_UNIFORM_VEC2);
|
|
|
|
|
|
2024-12-12 21:35:04 +04:00
|
|
|
|
GuiSetFont(InconsolataBold);
|
2024-12-12 23:41:46 +04:00
|
|
|
|
GuiSetStyle(DEFAULT, TEXT_SIZE, 24);
|
|
|
|
|
GuiSetStyle(DEFAULT, TEXT_SPACING, 0);
|
|
|
|
|
GuiSetStyle(DEFAULT, TEXT_LINE_SPACING, 24);
|
2024-12-14 00:32:50 +04:00
|
|
|
|
GuiSetStyle(STATUSBAR, BORDER_WIDTH, 2);
|
|
|
|
|
|
|
|
|
|
// Create the Nuklear Context
|
|
|
|
|
struct nk_context* ctx = InitNuklearEx(InconsolataBold, 24);
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
2024-12-12 15:02:30 +04:00
|
|
|
|
Vector2 mousePos = { 0 };
|
|
|
|
|
int mouseCellX = 0;
|
|
|
|
|
int mouseCellY = 0;
|
|
|
|
|
|
2024-12-11 21:01:00 +04:00
|
|
|
|
// game loop
|
|
|
|
|
while (!WindowShouldClose()) // run the loop untill the user presses ESCAPE or presses the Close button on the window
|
|
|
|
|
{
|
2024-12-12 15:02:30 +04:00
|
|
|
|
//------------------------------------------------------------------
|
2024-12-14 00:32:50 +04:00
|
|
|
|
// Update game logic
|
2024-12-12 15:02:30 +04:00
|
|
|
|
//------------------------------------------------------------------
|
2024-12-24 20:06:13 +04:00
|
|
|
|
|
2024-12-27 10:57:48 +04:00
|
|
|
|
float frametime = GetFrameTime();
|
|
|
|
|
|
|
|
|
|
if (IsKeyPressed(KEY_I)) {
|
|
|
|
|
speedV -= 1.0f;
|
|
|
|
|
}
|
|
|
|
|
if (IsKeyPressed(KEY_K)) {
|
|
|
|
|
speedV += 1.0f;
|
|
|
|
|
}
|
|
|
|
|
if (IsKeyPressed(KEY_J)) {
|
|
|
|
|
speedH -= 1.0f;
|
|
|
|
|
}
|
|
|
|
|
if (IsKeyPressed(KEY_L)) {
|
|
|
|
|
speedH += 1.0f;
|
|
|
|
|
}
|
|
|
|
|
SetShaderValue(water, speedVLoc, &speedV, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
SetShaderValue(water, speedHLoc, &speedH, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
|
|
|
|
|
|
2024-12-12 21:35:04 +04:00
|
|
|
|
if (errorCode == OK)
|
|
|
|
|
{
|
|
|
|
|
handleKeys();
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
2024-12-12 21:35:04 +04:00
|
|
|
|
if (editMap) {
|
2024-12-12 23:41:46 +04:00
|
|
|
|
mousePos = GetMousePosition();
|
2024-12-12 21:35:04 +04:00
|
|
|
|
mouseCellX = (int)(Clamp(mousePos.x, 0, FWIDTH * N - 1) / WIDTH);
|
|
|
|
|
mouseCellY = (int)(Clamp(mousePos.y, 0, FHEIGHT * M - 1) / HEIGHT);
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
2024-12-12 21:35:04 +04:00
|
|
|
|
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT) and not(mouseCellX == player_x and mouseCellY == player_y)) {
|
|
|
|
|
map[mouseCellY][mouseCellX] = selected_element;
|
|
|
|
|
}
|
|
|
|
|
else if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) {
|
|
|
|
|
map[mouseCellY][mouseCellX] = empty;
|
|
|
|
|
}
|
2024-12-12 15:02:30 +04:00
|
|
|
|
|
2024-12-12 21:35:04 +04:00
|
|
|
|
}
|
2024-12-12 15:02:30 +04:00
|
|
|
|
}
|
2024-12-14 00:32:50 +04:00
|
|
|
|
else {
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
// Update Nuklear context
|
|
|
|
|
//------------------------------------------------------------------
|
2024-12-20 21:27:27 +04:00
|
|
|
|
/*UpdateNuklear(ctx);
|
2024-12-14 00:32:50 +04:00
|
|
|
|
|
|
|
|
|
callNKErrorBoxes(ctx);
|
|
|
|
|
|
2024-12-20 21:27:27 +04:00
|
|
|
|
nk_end(ctx);*/
|
2024-12-14 00:32:50 +04:00
|
|
|
|
}
|
2024-12-12 21:35:04 +04:00
|
|
|
|
|
2024-12-12 15:02:30 +04:00
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
// Draw
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
BeginDrawing();
|
2024-12-26 17:18:09 +04:00
|
|
|
|
|
2024-12-27 10:57:48 +04:00
|
|
|
|
BeginTextureMode(canvas);
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
2024-12-27 16:44:44 +04:00
|
|
|
|
// Setup the back buffer for drawing (clear color and depth buffers)
|
|
|
|
|
ClearBackground(MAGENTA);
|
|
|
|
|
|
2024-12-11 21:01:00 +04:00
|
|
|
|
drawMap();
|
|
|
|
|
drawPlayer();
|
2024-12-24 20:06:13 +04:00
|
|
|
|
drawBottomBar(InconsolataBold, 24);
|
2024-12-14 00:32:50 +04:00
|
|
|
|
|
2024-12-12 15:02:30 +04:00
|
|
|
|
if (editMap) {
|
|
|
|
|
Rectangle rec = {
|
|
|
|
|
mouseCellX * FWIDTH,
|
|
|
|
|
mouseCellY * FHEIGHT,
|
|
|
|
|
FWIDTH, FHEIGHT
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Color color = { 0, 0, 0, 255 };
|
|
|
|
|
if (mouseCellX == player_x and mouseCellY == player_y) {
|
|
|
|
|
color.r = 255;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
color.g = 255;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawRectangleLinesEx(rec, 2, color);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-11 21:01:00 +04:00
|
|
|
|
if (netToggle) {
|
|
|
|
|
drawNet();
|
|
|
|
|
}
|
2024-12-11 23:44:03 +04:00
|
|
|
|
|
2024-12-14 00:32:50 +04:00
|
|
|
|
if (errorCode > OK) {
|
|
|
|
|
// Render the Nuklear GUI
|
2024-12-20 21:27:27 +04:00
|
|
|
|
//DrawNuklear(ctx);
|
2024-12-14 00:32:50 +04:00
|
|
|
|
|
2024-12-26 17:18:09 +04:00
|
|
|
|
//drawRayguiErrorBoxes();
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-27 10:57:48 +04:00
|
|
|
|
//BeginTextureMode(canvas);
|
2024-12-26 17:18:09 +04:00
|
|
|
|
{
|
2024-12-27 10:57:48 +04:00
|
|
|
|
//ClearBackground((Color) { 255, 255, 255, 0 });
|
2024-12-26 17:18:09 +04:00
|
|
|
|
//ClearBackground(BLANK);
|
|
|
|
|
Rectangle roundRect = { 100, 260, 185, 36 };
|
|
|
|
|
DrawRectangleRounded(roundRect, 0.5f, 6, BLACK);
|
|
|
|
|
DrawRectangleRoundedLines(roundRect, 0.5f, 6, ORANGE);
|
2024-12-14 00:32:50 +04:00
|
|
|
|
}
|
2024-12-26 17:18:09 +04:00
|
|
|
|
EndTextureMode();
|
|
|
|
|
|
|
|
|
|
float timeF = (float)GetTime();
|
2024-12-27 10:57:48 +04:00
|
|
|
|
SetShaderValue(blur, blurSecondsLoc, &timeF, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
SetShaderValue(water, waterSecondsLoc, &timeF, SHADER_UNIFORM_FLOAT);
|
|
|
|
|
SetShaderValue(watershader, watershaderSecondsLoc, &timeF, SHADER_UNIFORM_FLOAT);
|
2024-12-14 00:32:50 +04:00
|
|
|
|
|
2024-12-27 10:57:48 +04:00
|
|
|
|
Rectangle rec = { 0, 0, (float)canvas.texture.width, (float)(-canvas.texture.height) };
|
|
|
|
|
BeginShaderMode(watershader);
|
2024-12-26 17:18:09 +04:00
|
|
|
|
{
|
2024-12-27 10:57:48 +04:00
|
|
|
|
SetShaderValueTexture(watershader, xWaterBumpMapLoc, waterbump);
|
2024-12-27 14:05:23 +04:00
|
|
|
|
DrawTextureRec(canvas.texture, rec, (Vector2) { 0.0f, 0.0f }, WATERBLUE);
|
2024-12-26 17:18:09 +04:00
|
|
|
|
}
|
|
|
|
|
EndShaderMode();
|
2024-12-27 16:44:44 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//BeginTextureMode(canvasBlurX);
|
|
|
|
|
//{
|
|
|
|
|
// BeginShaderMode(blur13);
|
|
|
|
|
// {
|
|
|
|
|
// BeginShaderMode(watershader);
|
|
|
|
|
// {
|
|
|
|
|
// Vector2 dir = { 0.25f, 0.0f };
|
|
|
|
|
// SetShaderValue(blur13, blur13direction, &dir, SHADER_UNIFORM_VEC2);
|
|
|
|
|
// SetShaderValueTexture(watershader, xWaterBumpMapLoc, waterbump);
|
|
|
|
|
// DrawTextureRec(canvas.texture, rec, (Vector2) { 0.0f, 0.0f }, WATERBLUE);
|
|
|
|
|
// }
|
|
|
|
|
// EndShaderMode();
|
|
|
|
|
// }
|
|
|
|
|
// EndShaderMode();
|
|
|
|
|
//}
|
|
|
|
|
//EndTextureMode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//BeginShaderMode(blur13);
|
|
|
|
|
//{
|
|
|
|
|
// Vector2 dir = { 0.0f, 0.25f };
|
|
|
|
|
// SetShaderValue(blur13, blur13direction, &dir, SHADER_UNIFORM_VEC2);
|
|
|
|
|
// DrawTextureRec(canvasBlurX.texture, rec, (Vector2) { 0.0f, 0.0f }, WHITE);
|
|
|
|
|
//}
|
|
|
|
|
//EndShaderMode();
|
|
|
|
|
|
2024-12-26 17:18:09 +04:00
|
|
|
|
|
|
|
|
|
//drawBottomBar(InconsolataBold, 24);
|
|
|
|
|
|
2024-12-27 10:57:48 +04:00
|
|
|
|
//DrawTextureRec(canvas.texture, rec, (Vector2) { 0.0f, 0.0f }, SKYBLUE);
|
2024-12-24 20:06:13 +04:00
|
|
|
|
|
|
|
|
|
//DrawTextEx(Consolas, u8"Файл не найден\nПопробуйте сначала сохранить игру", (Vector2) { 100, 100 }, 24, 0, BLACK);
|
2024-12-12 21:35:04 +04:00
|
|
|
|
|
2024-12-12 15:02:30 +04:00
|
|
|
|
// show mouse position
|
|
|
|
|
//DrawText(TextFormat("%.1f %.1f", mousePos.x, mousePos.y), 5, M * HEIGHT - 30, 30, ORANGE);
|
|
|
|
|
|
2024-12-11 23:44:03 +04:00
|
|
|
|
// show FPS and frametime
|
|
|
|
|
//DrawText(TextFormat("%2d FPS", GetFPS()), 0, 0, 34, ORANGE);
|
|
|
|
|
//DrawText(TextFormat("%4f ms", GetFrameTime()), 0, 34, 34, BEIGE);
|
2024-12-11 21:01:00 +04:00
|
|
|
|
|
|
|
|
|
// end the frame and get ready for the next one (display frame, poll input, etc...)
|
|
|
|
|
EndDrawing();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//UnloadFont(InconsolataRegular);
|
2024-12-11 23:44:03 +04:00
|
|
|
|
UnloadFont(InconsolataBold);
|
2024-12-24 20:06:13 +04:00
|
|
|
|
//UnloadFont(Consolas);
|
2024-12-14 00:32:50 +04:00
|
|
|
|
//UnloadFont(Arial);
|
2024-12-11 21:01:00 +04:00
|
|
|
|
//UnloadFont(InconsolataBold);
|
|
|
|
|
|
2024-12-26 17:18:09 +04:00
|
|
|
|
UnloadRenderTexture(canvas);
|
|
|
|
|
|
2024-12-27 10:57:48 +04:00
|
|
|
|
UnloadShader(blur);
|
|
|
|
|
UnloadShader(water);
|
|
|
|
|
UnloadShader(watershader);
|
|
|
|
|
UnloadTexture(waterbump);
|
|
|
|
|
|
2024-12-14 00:32:50 +04:00
|
|
|
|
// De-initialize the Nuklear GUI
|
|
|
|
|
UnloadNuklear(ctx);
|
|
|
|
|
|
2024-12-11 21:01:00 +04:00
|
|
|
|
// destroy the window and cleanup the OpenGL context
|
|
|
|
|
CloseWindow();
|
|
|
|
|
return 0;
|
2024-12-11 19:46:01 +04:00
|
|
|
|
}
|