mirror of
https://github.com/Kaehvaman/OAIP.git
synced 2025-01-18 16:49:11 +04:00
Created game
This commit is contained in:
parent
7d62562d44
commit
f6d50cae54
31
lab16/lab16.sln
Normal file
31
lab16/lab16.sln
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.11.35222.181
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab16", "lab16\lab16.vcxproj", "{858481BD-1D6A-4285-8320-0F35ABD843EC}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{858481BD-1D6A-4285-8320-0F35ABD843EC}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{858481BD-1D6A-4285-8320-0F35ABD843EC}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{858481BD-1D6A-4285-8320-0F35ABD843EC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{858481BD-1D6A-4285-8320-0F35ABD843EC}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{858481BD-1D6A-4285-8320-0F35ABD843EC}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{858481BD-1D6A-4285-8320-0F35ABD843EC}.Release|x64.Build.0 = Release|x64
|
||||||
|
{858481BD-1D6A-4285-8320-0F35ABD843EC}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{858481BD-1D6A-4285-8320-0F35ABD843EC}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {09E25C09-72E3-4986-91C3-8CF0930227ED}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
30
lab16/lab16/Resource.h
Normal file
30
lab16/lab16/Resource.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Включаемый файл, созданный в Microsoft Visual C++.
|
||||||
|
// Используется lab16.rc
|
||||||
|
|
||||||
|
#define IDS_APP_TITLE 103
|
||||||
|
|
||||||
|
#define IDR_MAINFRAME 128
|
||||||
|
#define IDD_LAB16_DIALOG 102
|
||||||
|
#define IDD_ABOUTBOX 103
|
||||||
|
#define IDM_ABOUT 104
|
||||||
|
#define IDM_EXIT 105
|
||||||
|
#define IDI_LAB16 107
|
||||||
|
#define IDI_SMALL 108
|
||||||
|
#define IDC_LAB16 109
|
||||||
|
#define IDC_MYICON 2
|
||||||
|
#ifndef IDC_STATIC
|
||||||
|
#define IDC_STATIC -1
|
||||||
|
#endif
|
||||||
|
// Следующие стандартные значения для новых объектов
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
#define _APS_NO_MFC 130
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 110
|
||||||
|
#endif
|
||||||
|
#endif
|
15
lab16/lab16/framework.h
Normal file
15
lab16/lab16/framework.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// header.h: включаемый файл для стандартных системных включаемых файлов
|
||||||
|
// или включаемые файлы для конкретного проекта
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "targetver.h"
|
||||||
|
#define WIN32_LEAN_AND_MEAN // Исключите редко используемые компоненты из заголовков Windows
|
||||||
|
// Файлы заголовков Windows
|
||||||
|
#include <windows.h>
|
||||||
|
// Файлы заголовков среды выполнения C
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <memory.h>
|
||||||
|
#include <tchar.h>
|
388
lab16/lab16/lab16.cpp
Normal file
388
lab16/lab16/lab16.cpp
Normal file
@ -0,0 +1,388 @@
|
|||||||
|
// lab16.cpp : Определяет точку входа для приложения.
|
||||||
|
//
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
#include "framework.h"
|
||||||
|
#include "lab16.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
#define MAX_LOADSTRING 100
|
||||||
|
|
||||||
|
// Глобальные переменные:
|
||||||
|
HINSTANCE hInst; // текущий экземпляр
|
||||||
|
WCHAR szTitle[MAX_LOADSTRING]; // Текст строки заголовка
|
||||||
|
WCHAR szWindowClass[MAX_LOADSTRING]; // имя класса главного окна
|
||||||
|
|
||||||
|
// Отправить объявления функций, включенных в этот модуль кода:
|
||||||
|
ATOM MyRegisterClass(HINSTANCE hInstance);
|
||||||
|
BOOL InitInstance(HINSTANCE, int);
|
||||||
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
|
||||||
|
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||||
|
_In_opt_ HINSTANCE hPrevInstance,
|
||||||
|
_In_ LPWSTR lpCmdLine,
|
||||||
|
_In_ int nCmdShow)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
|
|
||||||
|
// TODO: Разместите код здесь.
|
||||||
|
|
||||||
|
// Инициализация глобальных строк
|
||||||
|
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||||
|
LoadStringW(hInstance, IDC_LAB16, szWindowClass, MAX_LOADSTRING);
|
||||||
|
MyRegisterClass(hInstance);
|
||||||
|
|
||||||
|
// Выполнить инициализацию приложения:
|
||||||
|
if (!InitInstance (hInstance, nCmdShow))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_LAB16));
|
||||||
|
|
||||||
|
MSG msg;
|
||||||
|
|
||||||
|
// Цикл основного сообщения:
|
||||||
|
while (GetMessage(&msg, nullptr, 0, 0))
|
||||||
|
{
|
||||||
|
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
|
||||||
|
{
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) msg.wParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// ФУНКЦИЯ: MyRegisterClass()
|
||||||
|
//
|
||||||
|
// ЦЕЛЬ: Регистрирует класс окна.
|
||||||
|
//
|
||||||
|
ATOM MyRegisterClass(HINSTANCE hInstance)
|
||||||
|
{
|
||||||
|
WNDCLASSEXW wcex;
|
||||||
|
|
||||||
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
|
||||||
|
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
|
wcex.lpfnWndProc = WndProc;
|
||||||
|
wcex.cbClsExtra = 0;
|
||||||
|
wcex.cbWndExtra = 0;
|
||||||
|
wcex.hInstance = hInstance;
|
||||||
|
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_LAB16));
|
||||||
|
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||||
|
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||||
|
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_LAB16);
|
||||||
|
wcex.lpszClassName = szWindowClass;
|
||||||
|
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
||||||
|
|
||||||
|
return RegisterClassExW(&wcex);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define M 10
|
||||||
|
#define N 15
|
||||||
|
#define WIDTH 40
|
||||||
|
#define HEIGHT 40
|
||||||
|
|
||||||
|
//
|
||||||
|
// ФУНКЦИЯ: InitInstance(HINSTANCE, int)
|
||||||
|
//
|
||||||
|
// ЦЕЛЬ: Сохраняет маркер экземпляра и создает главное окно
|
||||||
|
//
|
||||||
|
// КОММЕНТАРИИ:
|
||||||
|
//
|
||||||
|
// В этой функции маркер экземпляра сохраняется в глобальной переменной, а также
|
||||||
|
// создается и выводится главное окно программы.
|
||||||
|
//
|
||||||
|
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
|
{
|
||||||
|
hInst = hInstance; // Сохранить маркер экземпляра в глобальной переменной
|
||||||
|
|
||||||
|
int wstyle = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX);
|
||||||
|
|
||||||
|
RECT wnd = { 0, 0, N * WIDTH, M * HEIGHT };
|
||||||
|
AdjustWindowRectEx(&wnd, wstyle, 1, WS_EX_COMPOSITED);
|
||||||
|
|
||||||
|
int width = wnd.right - wnd.left;
|
||||||
|
int height = wnd.bottom - wnd.top;
|
||||||
|
|
||||||
|
RECT workarea;
|
||||||
|
SystemParametersInfoW(SPI_GETWORKAREA, 0, &workarea, 0);
|
||||||
|
|
||||||
|
int cx = ((workarea.right - workarea.left) / 2) - (width / 2);
|
||||||
|
int cy = ((workarea.bottom - workarea.top) / 2)- (height / 2);
|
||||||
|
|
||||||
|
HWND hWnd = CreateWindowExW(WS_EX_COMPOSITED, szWindowClass, szTitle, wstyle,
|
||||||
|
cx, cy, width, height, nullptr, nullptr, hInstance, nullptr);
|
||||||
|
|
||||||
|
if (!hWnd)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowWindow(hWnd, nCmdShow);
|
||||||
|
UpdateWindow(hWnd);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int player_x = 1;
|
||||||
|
int player_y = 1;
|
||||||
|
int gold = 0;
|
||||||
|
|
||||||
|
// Коды ячеек:
|
||||||
|
// 0 - свободна
|
||||||
|
// 1 -
|
||||||
|
// 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},
|
||||||
|
{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}
|
||||||
|
};
|
||||||
|
|
||||||
|
enum enum_moves { left, right, up, down };
|
||||||
|
void movePlayer(enum_moves move) {
|
||||||
|
switch (move) {
|
||||||
|
case left:
|
||||||
|
if ((player_x > 0) and map[player_y][player_x - 1] != 2) player_x -= 1;
|
||||||
|
break;
|
||||||
|
case right:
|
||||||
|
if ((player_x < N - 1) and map[player_y][player_x + 1] != 2) player_x += 1;
|
||||||
|
break;
|
||||||
|
case up:
|
||||||
|
if ((player_y > 0) and map[player_y - 1][player_x] != 2) player_y -= 1;
|
||||||
|
break;
|
||||||
|
case down:
|
||||||
|
if ((player_y < M - 1) and map[player_y + 1][player_x] != 2) player_y += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (map[player_y][player_x] == 3) {
|
||||||
|
map[player_y][player_x] = 0;
|
||||||
|
gold++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawNet(HDC hdc, int width, int height, int step) {
|
||||||
|
for (int i = 0; i <= width; i = i + step) {
|
||||||
|
MoveToEx(hdc, i, 0, NULL);
|
||||||
|
LineTo(hdc, i, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i <= height; i = i + step) {
|
||||||
|
MoveToEx(hdc, 0, i, NULL);
|
||||||
|
LineTo(hdc, width, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawMap(HDC hdc) {
|
||||||
|
// кисть для пустого поля
|
||||||
|
HBRUSH hBrushEmptyCell = CreateSolidBrush(RGB(200, 200, 200)); // серый
|
||||||
|
// кисть для поля с золотом
|
||||||
|
HBRUSH hBrushGold = CreateSolidBrush(RGB(255, 255, 0)); // желтый
|
||||||
|
// кисть для стены
|
||||||
|
HBRUSH hBrushWall = CreateSolidBrush(RGB(0, 0, 0)); // черный
|
||||||
|
// кисть для игрока
|
||||||
|
HBRUSH hBrushMan = CreateSolidBrush(RGB(0, 0, 255)); // синий
|
||||||
|
|
||||||
|
// Коды ячеек:
|
||||||
|
// 0 - свободна
|
||||||
|
// 1 -
|
||||||
|
// 2 - препятствие
|
||||||
|
// 3 - золото
|
||||||
|
HBRUSH brush[4] = { hBrushEmptyCell, hBrushMan, hBrushWall, hBrushGold };
|
||||||
|
|
||||||
|
for (int i = 0; i < M; i++) {
|
||||||
|
for (int j = 0; j < N; j++) {
|
||||||
|
|
||||||
|
int x1 = j * WIDTH;
|
||||||
|
int x2 = (j + 1) * WIDTH;
|
||||||
|
int y1 = i * HEIGHT;
|
||||||
|
int y2 = (i + 1) * HEIGHT;
|
||||||
|
|
||||||
|
RECT r = { x1, y1, x2, y2 };
|
||||||
|
FillRect(hdc, &r, brush[map[i][j]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Все кисти удаляем!!!
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
DeleteObject(brush[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawPlayer(HDC hdc) {
|
||||||
|
HBRUSH hBrushMan = CreateSolidBrush(RGB(0, 0, 255)); // синий
|
||||||
|
int x1 = player_x * WIDTH;
|
||||||
|
int x2 = (player_x + 1) * WIDTH;
|
||||||
|
int y1 = player_y * HEIGHT;
|
||||||
|
int y2 = (player_y + 1) * HEIGHT;
|
||||||
|
RECT r = { x1, y1, x2, y2 };
|
||||||
|
FillRect(hdc, &r, hBrushMan);
|
||||||
|
}
|
||||||
|
|
||||||
|
void save() {
|
||||||
|
FILE* fout = fopen("savefile.txt", "w");
|
||||||
|
if (fout == NULL) {
|
||||||
|
puts("Невозможно создать файл");
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(fout, "%d %d %d\n", player_x, player_y, gold);
|
||||||
|
|
||||||
|
fclose(fout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void load() {
|
||||||
|
FILE* fin = fopen("savefile.txt", "r");
|
||||||
|
if (fin == NULL) {
|
||||||
|
puts("Файл не найден");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int m, n;
|
||||||
|
fscanf_s(fin, "%d%d", &m, &n);
|
||||||
|
if (m != M || n != N) {
|
||||||
|
printf("Неправильный размер карты!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < m; i++) {
|
||||||
|
for (int j = 0; j < n; j++) {
|
||||||
|
fscanf_s(fin, "%d", &map[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fscanf_s(fin, "%d%d%d", &player_x, &player_y, &gold);
|
||||||
|
|
||||||
|
fclose(fin);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool netToggle = false;
|
||||||
|
|
||||||
|
enum keyboard {
|
||||||
|
VK_A = 65, VK_B, VK_C, VK_D, VK_E, VK_F, VK_G, VK_H,
|
||||||
|
VK_I, VK_J, VK_K, VK_L, VK_M, VK_N, VK_O, VK_P, VK_Q,
|
||||||
|
VK_R, VK_S, VK_T, VK_U, VK_V, VK_W, VK_X, VK_Y, VK_Z
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// ФУНКЦИЯ: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||||
|
//
|
||||||
|
// ЦЕЛЬ: Обрабатывает сообщения в главном окне.
|
||||||
|
//
|
||||||
|
// WM_COMMAND - обработать меню приложения
|
||||||
|
// WM_PAINT - Отрисовка главного окна
|
||||||
|
// WM_DESTROY - отправить сообщение о выходе и вернуться
|
||||||
|
//
|
||||||
|
//
|
||||||
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
int wmId = LOWORD(wParam);
|
||||||
|
// Разобрать выбор в меню:
|
||||||
|
switch (wmId)
|
||||||
|
{
|
||||||
|
case IDM_ABOUT:
|
||||||
|
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
|
||||||
|
break;
|
||||||
|
case IDM_EXIT:
|
||||||
|
DestroyWindow(hWnd);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_PAINT:
|
||||||
|
{
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC hdc = BeginPaint(hWnd, &ps);
|
||||||
|
// TODO: Добавьте сюда любой код прорисовки, использующий HDC...
|
||||||
|
|
||||||
|
RECT rect;
|
||||||
|
GetClientRect(hWnd, &rect);
|
||||||
|
|
||||||
|
drawMap(hdc);
|
||||||
|
drawPlayer(hdc);
|
||||||
|
if (netToggle) drawNet(hdc, rect.right, rect.bottom, 40);
|
||||||
|
|
||||||
|
EndPaint(hWnd, &ps);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
switch (wParam)
|
||||||
|
{
|
||||||
|
case VK_F5:
|
||||||
|
save();
|
||||||
|
break;
|
||||||
|
case VK_F6:
|
||||||
|
load();
|
||||||
|
break;
|
||||||
|
case VK_SPACE:
|
||||||
|
netToggle = !netToggle;
|
||||||
|
break;
|
||||||
|
case VK_W:
|
||||||
|
movePlayer(up);
|
||||||
|
break;
|
||||||
|
case VK_S:
|
||||||
|
movePlayer(down);
|
||||||
|
break;
|
||||||
|
case VK_D:
|
||||||
|
movePlayer(right);
|
||||||
|
break;
|
||||||
|
case VK_A:
|
||||||
|
movePlayer(left);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
InvalidateRect(hWnd, NULL, FALSE);
|
||||||
|
break;
|
||||||
|
case WM_DESTROY:
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработчик сообщений для окна "О программе".
|
||||||
|
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(lParam);
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
return (INT_PTR)TRUE;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||||
|
{
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
return (INT_PTR)TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return (INT_PTR)FALSE;
|
||||||
|
}
|
3
lab16/lab16/lab16.h
Normal file
3
lab16/lab16/lab16.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "resource.h"
|
BIN
lab16/lab16/lab16.ico
Normal file
BIN
lab16/lab16/lab16.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
BIN
lab16/lab16/lab16.rc
Normal file
BIN
lab16/lab16/lab16.rc
Normal file
Binary file not shown.
148
lab16/lab16/lab16.vcxproj
Normal file
148
lab16/lab16/lab16.vcxproj
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>17.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{858481bd-1d6a-4285-8320-0f35abd843ec}</ProjectGuid>
|
||||||
|
<RootNamespace>lab16</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="framework.h" />
|
||||||
|
<ClInclude Include="lab16.h" />
|
||||||
|
<ClInclude Include="Resource.h" />
|
||||||
|
<ClInclude Include="targetver.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="lab16.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="lab16.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="lab16.ico" />
|
||||||
|
<Image Include="small.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
49
lab16/lab16/lab16.vcxproj.filters
Normal file
49
lab16/lab16/lab16.vcxproj.filters
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Исходные файлы">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Файлы заголовков">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Файлы ресурсов">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="framework.h">
|
||||||
|
<Filter>Файлы заголовков</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="targetver.h">
|
||||||
|
<Filter>Файлы заголовков</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Resource.h">
|
||||||
|
<Filter>Файлы заголовков</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="lab16.h">
|
||||||
|
<Filter>Файлы заголовков</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="lab16.cpp">
|
||||||
|
<Filter>Исходные файлы</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="lab16.rc">
|
||||||
|
<Filter>Файлы ресурсов</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="small.ico">
|
||||||
|
<Filter>Файлы ресурсов</Filter>
|
||||||
|
</Image>
|
||||||
|
<Image Include="lab16.ico">
|
||||||
|
<Filter>Файлы ресурсов</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
12
lab16/lab16/savefile.txt
Normal file
12
lab16/lab16/savefile.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
10 15
|
||||||
|
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 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 3 3 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 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
|
||||||
|
9 4 10
|
BIN
lab16/lab16/small.ico
Normal file
BIN
lab16/lab16/small.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
6
lab16/lab16/targetver.h
Normal file
6
lab16/lab16/targetver.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// // При включении SDKDDKVer.h будет задана самая новая из доступных платформ Windows.
|
||||||
|
// Если вы планируете сборку приложения для предыдущей версии платформы Windows, включите WinSDKVer.h и
|
||||||
|
// задайте желаемую платформу в макросе _WIN32_WINNT, прежде чем включать SDKDDKVer.h.
|
||||||
|
#include <SDKDDKVer.h>
|
Loading…
Reference in New Issue
Block a user