Skip to content

Commit

Permalink
Feat: add goal
Browse files Browse the repository at this point in the history
  • Loading branch information
theminjunchoi committed Dec 11, 2022
1 parent 6eb9e1d commit 6799819
Show file tree
Hide file tree
Showing 45 changed files with 581 additions and 388 deletions.
Binary file modified Debug/CBottomWall.obj
Binary file not shown.
Binary file modified Debug/CFloor.obj
Binary file not shown.
Binary file modified Debug/CHandSphere.obj
Binary file not shown.
Binary file modified Debug/CHole.obj
Binary file not shown.
Binary file modified Debug/CLeftWall.obj
Binary file not shown.
Binary file modified Debug/CLight.obj
Binary file not shown.
Binary file modified Debug/CRightWall.obj
Binary file not shown.
Binary file modified Debug/CTopWall.obj
Binary file not shown.
Binary file modified Debug/CWall.obj
Binary file not shown.
Binary file modified Debug/Csphere.obj
Binary file not shown.
Binary file modified Debug/DisplayGameStatus.obj
Binary file not shown.
Binary file modified Debug/Player.obj
Binary file not shown.
Binary file modified Debug/VirtualLego.bsc
Binary file not shown.
Binary file modified Debug/VirtualLego.exe
Binary file not shown.
20 changes: 10 additions & 10 deletions Debug/VirtualLego.exe.recipe
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\Debug\VirtualLego.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\Debug\VirtualLego.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>
Binary file modified Debug/VirtualLego.ilk
Binary file not shown.
63 changes: 28 additions & 35 deletions Debug/VirtualLego.log
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
cl : 명령줄 warning D9035: 'Gm' 옵션은 더 이상 사용되지 않으므로 이후 릴리스에서 제거될 예정입니다.
virtualLego.cpp
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\d3dUtility.h(23,1): warning C4005: 'INFINITY': 매크로 재정의
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_math.h(88): message : 'INFINITY'의 이전 정의를 참조하십시오.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\Status.h(19,3): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\Status.h(53,65): warning C4290: 함수가 __declspec(nothrow)가 아님을 나타내려는 경우를 제외하고 C++ 예외 사양은 무시됩니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(99,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(100,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(101,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(102,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(103,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(104,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(105,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(106,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(109,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(110,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(111,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(112,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(113,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(128,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\virtualLego.cpp(278,52): warning C4244: '인수': 'double'에서 'float'(으)로 변환하면서 데이터가 손실될 수 있습니다.
DisplayText.cpp
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\d3dUtility.h(23,1): warning C4005: 'INFINITY': 매크로 재정의
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_math.h(88): message : 'INFINITY'의 이전 정의를 참조하십시오.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\DisplayText.cpp(15,28): warning C4154: 배열 식을 삭제했습니다. 포인터로 변환이 제공됩니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\DisplayText.cpp(43,45): warning C4244: '인수': 'int'에서 'FLOAT'(으)로 변환하면서 데이터가 손실될 수 있습니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\DisplayText.cpp(45,74): warning C4305: '인수': '__int64'에서 'DWORD'(으)로 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\DisplayText.cpp(45,41): warning C4309: '인수': 상수 값이 잘립니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\DisplayText.cpp(48,45): warning C4244: '인수': 'int'에서 'FLOAT'(으)로 변환하면서 데이터가 손실될 수 있습니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\DisplayText.cpp(49,45): warning C4244: '인수': 'int'에서 'FLOAT'(으)로 변환하면서 데이터가 손실될 수 있습니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\DisplayText.cpp(50,45): warning C4244: '인수': 'int'에서 'FLOAT'(으)로 변환하면서 데이터가 손실될 수 있습니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\DisplayText.cpp(51,45): warning C4244: '인수': 'int'에서 'FLOAT'(으)로 변환하면서 데이터가 손실될 수 있습니다.
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\DisplayText.cpp(57,45): warning C4244: '인수': 'int'에서 'FLOAT'(으)로 변환하면서 데이터가 손실될 수 있습니다.
코드를 생성하고 있습니다...
VirtualLego.vcxproj -> C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\Debug\VirtualLego.exe
cl : 명령줄 warning D9035: 'Gm' 옵션은 더 이상 사용되지 않으므로 이후 릴리스에서 제거될 예정입니다.
virtualLego.cpp
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\d3dUtility.h(23,1): warning C4005: 'INFINITY': 매크로 재정의
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(88): message : 'INFINITY'의 이전 정의를 참조하십시오.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\Status.h(19,3): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\Status.h(53,65): warning C4290: 함수가 __declspec(nothrow)가 아님을 나타내려는 경우를 제외하고 C++ 예외 사양은 무시됩니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(101,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(102,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(103,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(104,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(105,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(106,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(107,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(108,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(111,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(112,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(113,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(114,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(115,38): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(117,35): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(133,37): warning C4305: '인수': 'double'에서 'float'(으)로 잘립니다.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\virtualLego.cpp(289,52): warning C4244: '인수': 'double'에서 'float'(으)로 변환하면서 데이터가 손실될 수 있습니다.
Goal.cpp
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\d3dUtility.h(23,1): warning C4005: 'INFINITY': 매크로 재정의
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(88): message : 'INFINITY'의 이전 정의를 참조하십시오.
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\Goal.cpp(25,30): warning C4305: '=': 'double'에서 'float'(으)로 잘립니다.
코드를 생성하고 있습니다...
VirtualLego.vcxproj -> C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\Debug\VirtualLego.exe
Binary file modified Debug/VirtualLego.pdb
Binary file not shown.
Binary file modified Debug/VirtualLego.tlog/BscMake.command.1.tlog
Binary file not shown.
Binary file modified Debug/VirtualLego.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified Debug/VirtualLego.tlog/CL.write.1.tlog
Binary file not shown.
4 changes: 2 additions & 2 deletions Debug/VirtualLego.tlog/VirtualLego.lastbuildstate
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.22000.0:
Debug|Win32|C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\|
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.31.31103:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\|
Binary file modified Debug/VirtualLego.tlog/bscmake.read.1.tlog
Binary file not shown.
Binary file modified Debug/VirtualLego.tlog/bscmake.write.1.tlog
Binary file not shown.
Binary file modified Debug/VirtualLego.tlog/cl.command.1.tlog
Binary file not shown.
Binary file modified Debug/VirtualLego.tlog/link.command.1.tlog
Binary file not shown.
Binary file modified Debug/VirtualLego.tlog/link.read.1.tlog
Binary file not shown.
Binary file modified Debug/VirtualLego.tlog/link.write.1.tlog
Binary file not shown.
11 changes: 6 additions & 5 deletions Debug/VirtualLego.vcxproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
C:\Users\mj043\Desktop\새 폴더\Debug\VirtualLego.exe
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj3\Debug\VirtualLego.exe
C:\Users\김도엽\source\repos\Kredsya\OOP-Proj4\Debug\VirtualLego.exe
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\Debug\VirtualLego.exe
C:\Users\김도엽\source\repos\OOP-Proj4\Debug\VirtualLego.exe
C:\Users\mj043\Desktop\새 폴더\Debug\VirtualLego.exe
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj3\Debug\VirtualLego.exe
C:\Users\김도엽\source\repos\Kredsya\OOP-Proj4\Debug\VirtualLego.exe
C:\Users\jimin\Desktop\repos\hyun-hang\OOP-Proj4\Debug\VirtualLego.exe
C:\Users\김도엽\source\repos\OOP-Proj4\Debug\VirtualLego.exe
C:\Users\mj043\Desktop\객체지향프로그래밍\소스코드\OOP-Proj4\Debug\VirtualLego.exe
Binary file modified Debug/d3dUtility.obj
Binary file not shown.
Binary file modified Debug/d3dfont.obj
Binary file not shown.
Binary file modified Debug/d3dutil.obj
Binary file not shown.
Binary file modified Debug/dxutil.obj
Binary file not shown.
Binary file modified Debug/status.obj
Binary file not shown.
Binary file modified Debug/vc143.idb
Binary file not shown.
Binary file modified Debug/vc143.pdb
Binary file not shown.
Binary file modified Debug/virtualLego.obj
Binary file not shown.
140 changes: 140 additions & 0 deletions Goal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#include "Goal.h"
#include <stdlib.h>
#include <cstdlib>


#define M_RADIUS 0.14
#define PI 3.14159265
#define M_HEIGHT 0.01
#define FVF_VERTEX D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1

struct _VERTEX {
D3DXVECTOR3 pos;
D3DXVECTOR3 norm;
float tu;
float tv;
};

Goal::Goal(void) {
/*D3DXMatrixIdentity(&m_mLocal);
ZeroMemory(&m_mtrl, sizeof(m_mtrl));
m_radius = 0;
m_pSphereMesh = NULL;*/

ZeroMemory(&m_mtrl, sizeof(m_mtrl)); // memsetÀ» ÅëÇØ ¸ðµÎ 0À¸·Î ÃʱâÈ­
this->m_radius = M_RADIUS;
this->m_pSphereMesh = nullptr;
D3DXMatrixIdentity(&m_mLocal);
this->goalImageFileName = "goal";
}


Goal::~Goal(void) {}

bool Goal::create(IDirect3DDevice9* pDevice) {
if (NULL == pDevice) return false;

m_mtrl.Diffuse = d3d::WHITE;
m_mtrl.Ambient = d3d::WHITE;
m_mtrl.Specular = d3d::WHITE;
m_mtrl.Emissive = d3d::BLACK;
m_mtrl.Power = 100.0f;

pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
pDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);

this->m_pSphereMesh = _createMappedSphere(pDevice);

string filePath = "./image/" + this->goalImageFileName + ".bmp";

if (FAILED(D3DXCreateTextureFromFile(pDevice, filePath.c_str(), &Tex))) {
return false;
}

return true;
}

void Goal::destroy(void) {
if (m_pSphereMesh != NULL) {
m_pSphereMesh->Release();
m_pSphereMesh = NULL;
}
}

void Goal::draw(IDirect3DDevice9* pDevice, const D3DXMATRIX& mWorld) {
if (NULL == pDevice)
return;

pDevice->SetTransform(D3DTS_WORLD, &mWorld);
pDevice->MultiplyTransform(D3DTS_WORLD, &m_mLocal);
pDevice->SetTexture(0, Tex);
pDevice->SetMaterial(&m_mtrl);
m_pSphereMesh->DrawSubset(0);

}

bool Goal::hasIntersected(Jumper& ball) {


return false;
}

void Goal::hitBy(Jumper& ball) {
if (this->hasIntersected(ball)) {
}
}



const D3DXMATRIX& Goal::getLocalTransform(void) const { return m_mLocal; }
void Goal::setLocalTransform(const D3DXMATRIX& mLocal) { m_mLocal = mLocal; }




void Goal::setPosition(float x, float y, float z) {
D3DXMATRIX m;

this->center_x = x;
this->center_y = y;
this->center_z = z;

D3DXMatrixTranslation(&m, x, y, z);
this->setLocalTransform(m);
}



LPD3DXMESH Goal::_createMappedSphere(IDirect3DDevice9* pDev) {
LPD3DXMESH mesh;
if (FAILED(D3DXCreateSphere(pDev, this->getRadius(), 50, 50, &mesh, NULL)))
return nullptr;

LPD3DXMESH texMesh;
if (FAILED(mesh->CloneMeshFVF(D3DXMESH_SYSTEMMEM, FVF_VERTEX, pDev, &texMesh)))
return mesh;

mesh->Release();

struct _VERTEX* pVerts;
if (SUCCEEDED(texMesh->LockVertexBuffer(0, reinterpret_cast<void**>(&pVerts)))) {
int numVerts = texMesh->GetNumVertices();

for (int i = 0; i < numVerts; i++) {
pVerts->tu = asinf(pVerts->norm.x) / D3DX_PI + 0.5f;
pVerts->tv = asinf(pVerts->norm.y) / D3DX_PI + 0.5f;

pVerts++;
}
texMesh->UnlockVertexBuffer();
}

return texMesh;
}

D3DXVECTOR3 Goal::getPosition() const {
D3DXVECTOR3 org(center_x, center_y, center_z);
return org;
}
float Goal::getRadius(void) const { return (float)(M_RADIUS); }
37 changes: 37 additions & 0 deletions Goal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

#include "d3dUtility.h"
#include "Jumper.h"
#include "string"

using std::string;

class Goal
{
protected:
float center_x, center_y, center_z;
float m_radius;

string goalImageFileName = string();

IDirect3DTexture9* Tex = nullptr;
LPD3DXMESH _createMappedSphere(IDirect3DDevice9* pDev);
D3DXMATRIX m_mLocal;
D3DMATERIAL9 m_mtrl;
ID3DXMesh* m_pSphereMesh;


public:
Goal(void);
virtual ~Goal(void);

bool create(IDirect3DDevice9* pDevice);
void destroy(void);
void draw(IDirect3DDevice9* pDevice, const D3DXMATRIX& mWorld);
bool hasIntersected(Jumper& ball);
void hitBy(Jumper& ball);
const D3DXMATRIX& getLocalTransform(void) const;
void setLocalTransform(const D3DXMATRIX& mLocal);
void setPosition(float x, float y, float z);
D3DXVECTOR3 getPosition() const;
float getRadius(void) const;
};
5 changes: 4 additions & 1 deletion Jumper.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef _JUMPER
#define _JUMPER
#include <string>

#include "d3dUtility.h"
Expand Down Expand Up @@ -61,4 +63,5 @@ class Jumper {
void setMoveState(MOVESTATE iparam);
bool isFirstTouch();
void setFirstTouch(bool flag);
};
};
#endif
Loading

0 comments on commit 6799819

Please sign in to comment.