easyx_framework
V1.0.0
基于easyx的c++游戏框架
载入中...
搜索中...
未找到
F:/vc/project/esayx_framewoek/esayx_framewoek/plateform.h
浏览该文件的文档.
1
#pragma once
2
#include"
Sprite.h
"
3
#include"
Animator.h
"
4
#include"
Collider.h
"
5
#include"
RigidBody.h
"
6
#include"
Timer.h
"
7
#include"
Particle.h
"
8
9
class
plateform
:
public
Sprite
10
{
11
BoxCollider
*
box
;
12
public
:
13
plateform
()
14
{
15
box
=
ConstructComponent<BoxCollider>
();
16
box
->
AttachTo
(
root
);
17
box
->
SetSize
({500,70});
18
box
->
SetCollisionMode
(
ColliderMode::Collision
);
19
box
->
SetType
(
CollisionType::plateform
);
20
box
->
OnComponentBeginOverlap
.Push([
this
](
Collider
* overlapcomp,
Collider
* overlapanothercomp,
Object
* overlapanotherator)
21
{
/*RigidBody* rigid = overlapanotherator->GetComponentByClass<RigidBody>(); if(rigid)rigid->SetMoveable(false);*/
std::cout <<
"hallo haina"
<<std::endl; }
22
);
23
box
->
OnComponentBeginOverlap
.Push([
this
](
Collider
* overlapcomp,
Collider
* overlapanothercomp,
Object
* overlapanotherator)
24
{
RigidBody
* rigid = overlapanotherator->
GetComponentByClass
<
RigidBody
>();
if
(rigid)rigid->
SetMoveable
(
false
); }
25
);
26
box
->
OnComponentHitOverlap
.Push([
this
](
Collider
* overlapcomp,
Collider
* overlapanothercomp,
Object
* overlapanotherator,
Vector2D
impactnolunit,
HitResult
hitresult)
27
{
RigidBody
* rigid = overlapanotherator->
GetComponentByClass
<
RigidBody
>();
/*if (rigid)rigid->SetGravityEnable(false);*/
/*if (rigid)rigid->SetGravityEnable(false);*/
28
if
(rigid)std::cout << rigid->
GetVelocity
()<<std::endl; }
29
);
30
/* box->OnComponentBeginOverlap.Remove([this](Collider* overlapcomp, Collider* overlapanothercomp, Object* overlapanotherator)
31
{RigidBody* rigid = overlapanotherator->GetComponentByClass<RigidBody>(); if (rigid)rigid->SetMoveable(false); }
32
);*/
33
}
34
};
Animator.h
动画接口及动画组件
Collider.h
游戏场景中所有碰撞相关事件的处理
ColliderMode::Collision
@ Collision
碰撞模式,相当于两个实体的球进行碰撞
CollisionType::plateform
@ plateform
Particle.h
2D粒子组件
RigidBody.h
刚体组件定义
Sprite.h
物体派生类(精灵类)
Timer.h
计时器类
BoxCollider
盒型碰撞器.
定义
Collider.h:368
BoxCollider::SetSize
void SetSize(Vector2D size)
设置大小.
定义
Collider.h:400
Collider
碰撞器基类.
定义
Collider.h:130
Collider::SetCollisionMode
void SetCollisionMode(ColliderMode mode)
设置碰撞模式.
定义
Collider.h:200
Collider::SetType
void SetType(CollisionType type)
设置碰撞物体种类.
定义
Collider.h:189
Collider::OnComponentHitOverlap
CollisionHitOverlapDelegate OnComponentHitOverlap
发生实体碰撞的委托
定义
Collider.h:237
Collider::OnComponentBeginOverlap
CollisionOverlapDelegate OnComponentBeginOverlap
碰撞体刚接触的委托
定义
Collider.h:235
Object
游戏对象基类.
定义
Object.h:20
Object::ConstructComponent
T * ConstructComponent()
创建组件,绑定到对象,并注册到对象容器.
定义
Object.h:108
Object::GetComponentByClass
T * GetComponentByClass()
访问物体对象的跟他匹配的组件.
定义
Object.h:91
Object::root
SceneComponent *const root
场景根组件,赋予场景属性 刚创建物体一定同时创建了它的场景组件,不允许改变指向
定义
Object.h:28
RigidBody
刚体组件.
定义
RigidBody.h:16
RigidBody::GetVelocity
Vector2D GetVelocity()
获取速度
定义
RigidBody.h:69
RigidBody::SetMoveable
void SetMoveable(bool Moveable)
是否可移动
定义
RigidBody.h:83
SceneComponent::AttachTo
void AttachTo(SceneComponent *par)
设置所属组件
定义
SceneComponent.cpp:21
Sprite
物体派生类(精灵类)
定义
Sprite.h:18
plateform
定义
plateform.h:10
plateform::box
BoxCollider * box
定义
plateform.h:11
plateform::plateform
plateform()
定义
plateform.h:13
HitResult
碰撞结果类
定义
Collider.h:42
Vector2D
二维向量
定义
Struct.h:18
plateform.h
制作者
1.12.0