Common.h
==> 헤더파일을 하나하나 지정해주기 힘드므로 Common.h에 헤더파일들을 포함해줌으로써 간단히 사용
#pragma once
#include <conio.h> //콘솔 이동키를 불러오는 함수
#include <iostream>
#include <Windows.h>
#include "yaMath.h"
enum COLOR
{
BLACK, /* 0 : 까망 */
DARK_BLUE, /* 1 : 어두운 파랑 */
DARK_GREEN, /* 2 : 어두운 초록 */
DARK_SKY_BLUE, /* 3 : 어두운 하늘 */
DARK_RED, /* 4 : 어두운 빨강 */
DARK_VIOLET, /* 5 : 어두운 보라 */
DARK_YELLOW, /* 6 : 어두운 노랑 */
GRAY, /* 7 : 회색 */
DARK_GRAY, /* 8 : 어두운 회색 */
BLUE, /* 9 : 파랑 */
GREEN, /* 10 : 초록 */
SKY_BLUE, /* 11 : 하늘 */
RED, /* 12 : 빨강 */
VIOLET, /* 13 : 보라 */
YELLOW, /* 14 : 노랑 */
WHITE, /* 15 : 하양 */
};
#define GOTO_XY(x, y) SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), COORD{(short)x, (short)y})
#define SET_COLOR(color) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color)
//void SetConsoleCursorPos(short x, short y)
//{
// COORD xy = { x, y };
// SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), xy);
//}
//void SetConsoleTextColor(int color)
//{
// SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
//}
yaMath.h
==> Vector2 즉 방향에 대한 함수내용을 갖고 있는 헤더파일
#pragma once
struct Vector2
{
int x;
int y;
Vector2()
: x(0), y(0)
{
}
Vector2(int x, int y)
: x(x), y(y)
{
}
//추가
Vector2(const Vector2& other)
{
x = other.x;
y = other.y;
}
Vector2& operator=(const Vector2& other) // 대입 연산자를 쓸 수 있게 만들어주는 것
{
x = other.x;
y = other.y;
return *this;
}
};
typedef Vector2 Pos;
typedef Vector2 Size;
'다양한 글들 > PushPush 게임' 카테고리의 다른 글
5. Scene (1) | 2022.09.23 |
---|---|
3. GameObject (1) | 2022.09.23 |
2. Highlevel_Interface (1) | 2022.09.23 |
1. main.cpp (0) | 2022.09.23 |
PushPush 게임 만들기 (0) | 2022.09.20 |