mirror of
https://github.com/Kaehvaman/OAIP.git
synced 2025-01-18 08:39:11 +04:00
finished lab18
This commit is contained in:
parent
a6362c94c2
commit
2bcc4b083e
@ -178,7 +178,7 @@ void movePlayer(enum_ways move) {
|
||||
break;
|
||||
}
|
||||
if (map[player_y][player_x] == gold) {
|
||||
map[player_y][player_x] = 0;
|
||||
map[player_y][player_x] = empty;
|
||||
inventory[gold]++;
|
||||
}
|
||||
}
|
||||
@ -325,7 +325,7 @@ void drawBottomBar(HDC hdc) {
|
||||
CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH, TEXT("Consolas"));
|
||||
SelectObject(hdc, hFont);
|
||||
|
||||
SetTextColor(hdc, RGB(78, 201, 176));
|
||||
SetTextColor(hdc, RGB(0, 0, 0));
|
||||
//SetBkColor(hdc, RGB(255, 0, 0));
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
DrawTextA(hdc, gold_string, -1, &itemrect, (DT_SINGLELINE | DT_TOP | DT_LEFT));
|
||||
|
@ -1,13 +0,0 @@
|
||||
10 15
|
||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 2 2 0 0 0 0 2 0 3 0 0 0 0 0
|
||||
0 0 0 2 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 2 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
|
||||
0 0 15 0
|
||||
1 1 3
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "framework.h"
|
||||
#include "lab18.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
|
||||
@ -173,7 +174,7 @@ void drawRomb(HDC hdc, int cx, int cy, int size) {
|
||||
}
|
||||
|
||||
void drawStar(HDC hdc, int cx, int cy, int size) {
|
||||
HPEN hPen = CreatePen(PS_SOLID, 3, RGB(78, 180, 200));
|
||||
HPEN hPen = CreatePen(PS_SOLID, 3, RGB(78, 180, 255));
|
||||
SelectObject(hdc, hPen);
|
||||
|
||||
POINT p[9] = {
|
||||
@ -192,6 +193,15 @@ void drawStar(HDC hdc, int cx, int cy, int size) {
|
||||
DeleteObject(hPen);
|
||||
}
|
||||
|
||||
void drawCirle(HDC hdc, int cx, int cy, int size) {
|
||||
HPEN hPen = CreatePen(PS_SOLID, 3, RGB(255, 0, 255));
|
||||
SelectObject(hdc, hPen);
|
||||
|
||||
Ellipse(hdc, cx - size, cy - size, cx + size, cy + size);
|
||||
|
||||
DeleteObject(hPen);
|
||||
}
|
||||
|
||||
void drawRecursiveTriangle(HDC hdc, int cx, int cy, int size, int mode) {
|
||||
drawTriangle(hdc, cx, cy, size);
|
||||
|
||||
@ -237,10 +247,37 @@ void drawRecursiveStar(HDC hdc, int cx, int cy, int size, int mode) {
|
||||
if (size < 20) {
|
||||
return;
|
||||
}
|
||||
if (mode == drawRecursiveStar(hdc, cx - size, cy, size / 2, mode);
|
||||
drawRecursiveStar(hdc, cx + size, cy, size / 2, mode);
|
||||
if (mode == 1 || mode == 3) drawRecursiveStar(hdc, cx, cy + size, size / 2, mode);
|
||||
if (mode == 2 || mode == 3) drawRecursiveStar(hdc, cx, cy - size, size / 2, mode);
|
||||
if (mode == 0 || mode == 2) drawRecursiveStar(hdc, cx - size, cy, size / 2, mode);
|
||||
if (mode == 0) drawRecursiveStar(hdc, cx + size, cy, size / 2, mode);
|
||||
if (mode == 1 || mode == 2) drawRecursiveStar(hdc, cx, cy + size, size / 2, mode);
|
||||
if (mode == 1 || mode == 2) drawRecursiveStar(hdc, cx, cy - size, size / 2, mode);
|
||||
}
|
||||
|
||||
int circlecount = 0;
|
||||
void drawRecursiveCircle(HDC hdc, int cx, int cy, int size, int i) {
|
||||
drawCirle(hdc, cx, cy, size);
|
||||
i--;
|
||||
circlecount++;
|
||||
|
||||
static HFONT hFont = CreateFontW(18, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH, TEXT("Consolas"));
|
||||
|
||||
SelectObject(hdc, hFont);
|
||||
SetTextColor(hdc, RGB(0, 0, 0));
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
|
||||
static char circle_string[10];
|
||||
sprintf_s(circle_string, "%d", circlecount);
|
||||
RECT circlerect = { cx - size, cy - size, cx + size, cy + size };
|
||||
|
||||
DrawTextA(hdc, circle_string, -1, &circlerect, (DT_SINGLELINE | DT_VCENTER | DT_CENTER));
|
||||
|
||||
if (i == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawRecursiveCircle(hdc, cx, cy - size, size / 2, i);
|
||||
drawRecursiveCircle(hdc, cx + size, cy, size / 2, i);
|
||||
}
|
||||
|
||||
int trmode = 0;
|
||||
@ -291,11 +328,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (netToggle) drawNet(hdc, rect.right, rect.bottom, 50, 50);
|
||||
|
||||
drawRecursiveTriangle(hdc, 300, 300, 100, trmode);
|
||||
drawRecursiveHourglass(hdc, 600, 300, 100, hgmode);
|
||||
drawRecursiveHourglass(hdc, 700, 300, 100, hgmode);
|
||||
|
||||
//drawRecursiveRomb(hdc, 1100, 300, 100, rbmode);
|
||||
drawRecursiveStar(hdc, 1100, 300, 100, rbmode);
|
||||
|
||||
drawRecursiveCircle(hdc, 500, 500, 200, 5);
|
||||
circlecount = 0;
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
break;
|
||||
|
@ -558,7 +558,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (netToggle) drawNet(hdc, rect.right, rect.bottom); //drawNet(hdc, 1400, 650);
|
||||
|
||||
//drawImageSequence1(hdc);
|
||||
drawImageSequence1(hdc);
|
||||
|
||||
//lab5(hdc);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user