Used methods in Tutorial part 1 - ilovethisid/Educational-Ascii-Game-engine GitHub Wiki
Tutorial part 1 : Getting started์์ ์ฌ์ฉ๋ EAG engine component๋ค์ ์๊ฐํฉ๋๋ค.
start()๊ฐ ํธ์ถ๋๋ฉด ์ต์ด๋ก 1ํ ์คํ๋๋ method์
๋๋ค.
Object class์์๋ console์์ ์์ง์ด๋ฉด์ ๊ฐ๋จํ ๋ฌผ๋ฆฌ๋ฒ์น์ ์ ์ฉํ ์ ์๋ object๋ค์ ์์ฑํ ์ ์์ต๋๋ค.
void Object::makeImage(Matrix& _image)๊ทธ๋ฆผ์ด ๊ทธ๋ ค์ง Matrix๋ฅผ ๋๊ฒจ์ฃผ๋ฉด object ๊ฐ์ฒด์ ์ ์ฅํฉ๋๋ค.
| Name | Value | Description |
|---|---|---|
| _image | Matrix | object์๊ฒ ๋ถ์ฌํ ๊ทธ๋ฆผ Matrix |
void Object::makeRigidbody()ํด๋น object ๊ฐ์ฒด๋ฅผ ์ถฉ๋์ด ์ ์ฉ๋๋ rigidbody๋ก ๋ง๋ญ๋๋ค.
void Object::setName(const char* name)ํด๋น object ๊ฐ์ฒด์ ์ถํ ํธ์ถ์ ์ํด ์ด๋ฆ์ ์ง์ ํฉ๋๋ค.
| Name | Value | Description |
|---|---|---|
| name | const char* | object ๊ฐ์ฒด์ ์ด๋ฆ |
Matrix class์๋ ๋ํ์ ๋ชจ์์ ์ ์ฅํด๋๊ณ ๊ณ์ํด์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ํ์ง๋ง, ์์ง Object๊ฐ ์๋๋ฏ๋ก ๋ฌผ๋ฆฌ๋ฒ์น์ ์ ์ฉํ ์๋ ์์ต๋๋ค.
Matrix makeFile2Matrix(const char* filename)| Name | Value | Description |
|---|---|---|
| filename | const char* | ์ธ๋ถ์ ์ ์ฅ๋ Matrix ํ์ผ ๊ฒฝ๋ก |
| Value | Description |
|---|---|
| Matrix | Matrix ํ์ผ์ ๋ณํํ Matrix๋ฅผ ๋ฐํํฉ๋๋ค. |
Matrix makeBox(int width, int height, short thickness, short c, short col)์ง์ฌ๊ฐํ ๋ชจ์์ Matrix๋ฅผ ์์ฑํ์ฌ ๋ฐํํฉ๋๋ค.
| Name | Value | Description |
|---|---|---|
| width | int | ์ง์ฌ๊ฐํ์ ๊ฐ๋ก ๊ธธ์ด |
| height | int | ์ง์ฌ๊ฐํ์ ์ธ๋ก ๊ธธ์ด |
| thickness | short | ์ง์ฌ๊ฐํ ๋๋ ์ ๋๊ป |
| c | short | ๋ํ์ ๊ตฌ์ฑํ๋ ๋ฌธ์ (๊ธฐ๋ณธ๊ฐ : ํฝ์ ) |
| col | short | ๋ํ์ ์๊น (๊ธฐ๋ณธ๊ฐ : ํ์์) |
| Value | Description |
|---|---|
| Matrix | ์์ฑ๋ Matrix๋ฅผ ๋ฐํํฉ๋๋ค. |
๊ฐ๋จํ ๋ฌผ๋ฆฌ๋ฒ์น ์ ์ฉ์ด ๊ฐ๋ฅํ Object
void Rigidbody::makeMatrixCollider(Matrix& matrix)Matrix๋ฅผ ๋๊ฒจ์ฃผ๋ฉด ๋ชจ์์ ๋ฐ๋ผ rigid body๋ฅผ ์์ฑํฉ๋๋ค.
| Name | Value | Description |
|---|---|---|
| matrix | Matrix | rigidbody๋ฅผ ์์ฑํ ์ฌ๋ฃ Matrix |
Game Loop ๋ด์์ ๋ฐ๋ณต์ ์ผ๋ก ํธ์ถ๋๋ฉฐ, ์ด method ๋ด๋ถ์ ๊ตฌํํจ์ผ๋ก์จ ๊ฒ์์ ํ๋ฆ์ ์งํ์ํฌ ์ ์์ต๋๋ค.
console ์ฐฝ ์ ์ด๋ฅผ ์ํ method๊ฐ ๋ค์ด์์ต๋๋ค.
void Console::drawTmpObjects(vector<Object*> objects)objects์ ๋ด๊ธด Object๋ค์ ๊ฐ๊ฐ tmp_screen_buffer์ ๋ฃ์ต๋๋ค.
| Name | Value | Description |
|---|---|---|
| objects | vector<Object*> | ์ฒ๋ฆฌํ Object๊ฐ ๋ด๊ธด vector |