summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/Asura/Asura.vcxproj1
-rw-r--r--Build/Asura/Asura.vcxproj.filters1
-rw-r--r--Build/Runner/Runner.vcxproj.user4
-rw-r--r--Docs/~$记录.docxbin0 -> 162 bytes
-rw-r--r--Docs/~WRL1631.tmpbin0 -> 12544 bytes
-rw-r--r--Docs/记录.docxbin0 -> 12731 bytes
-rw-r--r--Samples/Hello/entities/player.asr5
-rw-r--r--Samples/Hello/gfx/icon.pngbin0 -> 4147 bytes
-rw-r--r--Samples/Hello/gfx/icon.png.asr3
-rw-r--r--Samples/Hello/gfx/particles/fire.asr4
-rw-r--r--Samples/Hello/hello.asuraproject2
-rw-r--r--Samples/Hello/scripts/components/fireball.lua28
-rw-r--r--Samples/Hello/scripts/components/fireball.lua.asr0
-rw-r--r--Samples/Hello/scripts/entities/bullet.lua0
-rw-r--r--Samples/Hello/scripts/entities/bullet.lua.asr3
-rw-r--r--Samples/Hello/scripts/entities/spark.lua3
-rw-r--r--Samples/Hello/scripts/entities/spark.lua.asr0
-rw-r--r--Samples/Hello/scripts/hello.lua0
-rw-r--r--Samples/Hello/scripts/hello.lua.asr3
-rw-r--r--Samples/Hello/spr/spr_image.asr6
-rw-r--r--Source/Asura/Component.h2
-rw-r--r--Source/Asura/GameObject.h6
-rw-r--r--Source/Asura/Graphics/Animation.cpp21
-rw-r--r--Source/Asura/Graphics/Animation.h78
-rw-r--r--Source/Asura/Graphics/Camera.h5
-rw-r--r--Source/Asura/Graphics/Image.h33
-rw-r--r--Source/Asura/Graphics/Material.h6
-rw-r--r--Source/Asura/Graphics/Shader.h6
-rw-r--r--Source/Asura/Graphics/Sprite.h16
-rw-r--r--Source/Asura/Graphics/SpriteRenderer.h3
-rw-r--r--Source/Asura/Manager.hpp14
-rw-r--r--Source/Asura/Scene.h11
32 files changed, 252 insertions, 12 deletions
diff --git a/Build/Asura/Asura.vcxproj b/Build/Asura/Asura.vcxproj
index 12968cb..30bd0b0 100644
--- a/Build/Asura/Asura.vcxproj
+++ b/Build/Asura/Asura.vcxproj
@@ -137,6 +137,7 @@
<ClInclude Include="..\..\Source\Asura\Graphics\SpriteRenderer.h" />
<ClInclude Include="..\..\Source\Asura\Graphics\Texture.h" />
<ClInclude Include="..\..\Source\Asura\Layer.h" />
+ <ClInclude Include="..\..\Source\Asura\Manager.hpp" />
<ClInclude Include="..\..\Source\Asura\Math\Curve.h" />
<ClInclude Include="..\..\Source\Asura\Math\RangedValue.h" />
<ClInclude Include="..\..\Source\Asura\Object.h" />
diff --git a/Build/Asura/Asura.vcxproj.filters b/Build/Asura/Asura.vcxproj.filters
index 153a4cc..c1743ee 100644
--- a/Build/Asura/Asura.vcxproj.filters
+++ b/Build/Asura/Asura.vcxproj.filters
@@ -187,6 +187,7 @@
<ClInclude Include="..\..\Source\Asura\Graphics\Mesh2DRenderer.h">
<Filter>Graphics</Filter>
</ClInclude>
+ <ClInclude Include="..\..\Source\Asura\Manager.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\Source\Asura\AI\BehaviorTree.cpp">
diff --git a/Build/Runner/Runner.vcxproj.user b/Build/Runner/Runner.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/Build/Runner/Runner.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/Docs/~$记录.docx b/Docs/~$记录.docx
new file mode 100644
index 0000000..a03e1bd
--- /dev/null
+++ b/Docs/~$记录.docx
Binary files differ
diff --git a/Docs/~WRL1631.tmp b/Docs/~WRL1631.tmp
new file mode 100644
index 0000000..036bd85
--- /dev/null
+++ b/Docs/~WRL1631.tmp
Binary files differ
diff --git a/Docs/记录.docx b/Docs/记录.docx
new file mode 100644
index 0000000..97654a7
--- /dev/null
+++ b/Docs/记录.docx
Binary files differ
diff --git a/Samples/Hello/entities/player.asr b/Samples/Hello/entities/player.asr
new file mode 100644
index 0000000..fa7550d
--- /dev/null
+++ b/Samples/Hello/entities/player.asr
@@ -0,0 +1,5 @@
+<gameobject>
+ <components>
+ <component></component>
+ </components>
+</gameobject> \ No newline at end of file
diff --git a/Samples/Hello/gfx/icon.png b/Samples/Hello/gfx/icon.png
new file mode 100644
index 0000000..8074c4c
--- /dev/null
+++ b/Samples/Hello/gfx/icon.png
Binary files differ
diff --git a/Samples/Hello/gfx/icon.png.asr b/Samples/Hello/gfx/icon.png.asr
new file mode 100644
index 0000000..93d6d58
--- /dev/null
+++ b/Samples/Hello/gfx/icon.png.asr
@@ -0,0 +1,3 @@
+<image>
+ <extern>icon.png</extern>
+</image> \ No newline at end of file
diff --git a/Samples/Hello/gfx/particles/fire.asr b/Samples/Hello/gfx/particles/fire.asr
new file mode 100644
index 0000000..eae2506
--- /dev/null
+++ b/Samples/Hello/gfx/particles/fire.asr
@@ -0,0 +1,4 @@
+<!--ϵͳ-->
+<particlesystem>
+
+</particlesystem> \ No newline at end of file
diff --git a/Samples/Hello/hello.asuraproject b/Samples/Hello/hello.asuraproject
new file mode 100644
index 0000000..fee1eb1
--- /dev/null
+++ b/Samples/Hello/hello.asuraproject
@@ -0,0 +1,2 @@
+<folders>
+</folders> \ No newline at end of file
diff --git a/Samples/Hello/scripts/components/fireball.lua b/Samples/Hello/scripts/components/fireball.lua
new file mode 100644
index 0000000..8b31228
--- /dev/null
+++ b/Samples/Hello/scripts/components/fireball.lua
@@ -0,0 +1,28 @@
+--ӳcomponent
+--lua require룬package.load
+local Spark = require("scripts/spark.lua")
+local Fireball = AsuraEngine.Component.Extend("Fireball")
+-- µķǺ֣ͣʾڱ༭УҪʾڱ༭Уһʼֵ
+-- жͣnilҪʾڱ༭
+Fireball.name = ""
+Fireball.position = 1
+Fireball.image = nil
+Fireball.spark = Spark.New()
+
+function Fireball:OnEnable()
+ self.image = self.gameobject.GetComponent(AsuraEngine.Image)
+end
+
+function Fireball:OnEvent(e)
+
+end
+
+function Fireball:OnUpdate(ms)
+
+end
+
+function Fireball:OnDraw()
+
+end
+
+return Fireball \ No newline at end of file
diff --git a/Samples/Hello/scripts/components/fireball.lua.asr b/Samples/Hello/scripts/components/fireball.lua.asr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Samples/Hello/scripts/components/fireball.lua.asr
diff --git a/Samples/Hello/scripts/entities/bullet.lua b/Samples/Hello/scripts/entities/bullet.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Samples/Hello/scripts/entities/bullet.lua
diff --git a/Samples/Hello/scripts/entities/bullet.lua.asr b/Samples/Hello/scripts/entities/bullet.lua.asr
new file mode 100644
index 0000000..bd43c00
--- /dev/null
+++ b/Samples/Hello/scripts/entities/bullet.lua.asr
@@ -0,0 +1,3 @@
+<script>
+ <extern>bullet.lua</extern>
+</script> \ No newline at end of file
diff --git a/Samples/Hello/scripts/entities/spark.lua b/Samples/Hello/scripts/entities/spark.lua
new file mode 100644
index 0000000..c47be06
--- /dev/null
+++ b/Samples/Hello/scripts/entities/spark.lua
@@ -0,0 +1,3 @@
+local spark
+
+return spark \ No newline at end of file
diff --git a/Samples/Hello/scripts/entities/spark.lua.asr b/Samples/Hello/scripts/entities/spark.lua.asr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Samples/Hello/scripts/entities/spark.lua.asr
diff --git a/Samples/Hello/scripts/hello.lua b/Samples/Hello/scripts/hello.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Samples/Hello/scripts/hello.lua
diff --git a/Samples/Hello/scripts/hello.lua.asr b/Samples/Hello/scripts/hello.lua.asr
new file mode 100644
index 0000000..87e3c43
--- /dev/null
+++ b/Samples/Hello/scripts/hello.lua.asr
@@ -0,0 +1,3 @@
+<script>
+ <source>hello.lua</source>
+</script> \ No newline at end of file
diff --git a/Samples/Hello/spr/spr_image.asr b/Samples/Hello/spr/spr_image.asr
new file mode 100644
index 0000000..91be3a3
--- /dev/null
+++ b/Samples/Hello/spr/spr_image.asr
@@ -0,0 +1,6 @@
+<sprite>
+ <image>gfx/icon.png</image>
+ <name>spr_image</name>
+ <size>12,32</size>
+ <anchor>10,10</anchor>
+</sprite> \ No newline at end of file
diff --git a/Source/Asura/Component.h b/Source/Asura/Component.h
index a602d50..5a9073d 100644
--- a/Source/Asura/Component.h
+++ b/Source/Asura/Component.h
@@ -1,7 +1,7 @@
#ifndef __AE_COMPONENT_H__
#define __AE_COMPONENT_H__
-#include "Object.h"
+#include "GameObject.h"
namespace AsuraEngine
{
diff --git a/Source/Asura/GameObject.h b/Source/Asura/GameObject.h
index f4c4eb8..8e79b65 100644
--- a/Source/Asura/GameObject.h
+++ b/Source/Asura/GameObject.h
@@ -37,6 +37,12 @@ namespace AsuraEngine
void SetScale(const Math::Vector2& scale);
void SetRotation(const Math::Vector2& rotation);
+ template<typename T>
+ inline T GetComponent()
+ {
+ return NULL;
+ }
+
private:
Transform mTransform;
diff --git a/Source/Asura/Graphics/Animation.cpp b/Source/Asura/Graphics/Animation.cpp
index e69de29..47643aa 100644
--- a/Source/Asura/Graphics/Animation.cpp
+++ b/Source/Asura/Graphics/Animation.cpp
@@ -0,0 +1,21 @@
+#include "Animation.h"
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ void Animation::OnEnable()
+ {
+ mSpriteRenderer = mGameObject->GetComponent<SpriteRenderer*>();
+ }
+
+ void Animation::OnUpdate(uint32 milliseconds)
+ {
+ if (!mSpriteRenderer)
+ return;
+ mSpriteRenderer->SetSprite(NULL);
+ }
+
+ }
+}
diff --git a/Source/Asura/Graphics/Animation.h b/Source/Asura/Graphics/Animation.h
index e3d82b7..0e4bd5a 100644
--- a/Source/Asura/Graphics/Animation.h
+++ b/Source/Asura/Graphics/Animation.h
@@ -3,6 +3,11 @@
#include "Sprite.h"
#include "Component.h"
+#include "Manager.hpp"
+#include "SpriteRenderer.h"
+#include "Containers/Map.h"
+#include "Containers/Vector.hpp"
+#include "Containers/StringMap.hpp"
namespace AsuraEngine
{
@@ -12,9 +17,10 @@ namespace AsuraEngine
///
/// ؼ֡
///
- class AnimationKeyFrame
+ struct AnimationKeyFrame
{
-
+ float time;
+ Sprite* sprite;
};
///
@@ -24,12 +30,78 @@ namespace AsuraEngine
{
public:
+ enum UpdateMask
+ {
+ Scale = 1,
+ Position = 1 << 1,
+ Rotation = 1 << 2,
+ Sprite = 1 << 3
+ };
+
+ struct Definition
+ {
+
+ };
+
+ void OnEnable() override;
+ void OnUpdate(uint32 milliseconds) override;
+
+ void SetSpeed(float speed);
+
+ private:
+
+ Containers::Vector<AnimationKeyFrame> mFrames;
+
+ float mTime;
+
+ bool mLoop;
+
+ ///
+ /// ٶȣĬΪ1
+ ///
+ float mSpeed;
+
+ ///
+ ///
+ ///
+ uint mKey;
+
+ Containers::String mName;
+
+ UpdateMask mUpdateMask;
+
+ SpriteRenderer* mSpriteRenderer;
+
+ };
+
+ class AnimationManager : public Manager
+ {
+ public:
+
+ Containers::String GetAnimationName(uint ID);
+
+ uint GetAnimationID(const Containers::String& name);
+
+ Animation* GetAnimation(uint ID);
+
+ Animation* GetAnimation(const Containers::String& name);
+
+ ///
+ /// ӶID
+ ///
+ uint AddAnimation(Animation* animation);
+
private:
///
+ /// ӳIDanimation
+ ///
+ Containers::StringMap<uint> mAnimationIDs;
+
///
+ /// ӳkeyanimation
///
- Sprite* mSprite;
+ Containers::Map<uint, Animation*> mAnimations;
};
diff --git a/Source/Asura/Graphics/Camera.h b/Source/Asura/Graphics/Camera.h
index 9da6ab0..699d342 100644
--- a/Source/Asura/Graphics/Camera.h
+++ b/Source/Asura/Graphics/Camera.h
@@ -29,6 +29,11 @@ namespace AsuraEngine
///
bool mIsOnScreen;
+ ///
+ /// ü
+ ///
+ bool mIsCulling;
+
};
}
diff --git a/Source/Asura/Graphics/Image.h b/Source/Asura/Graphics/Image.h
index 198ad9e..34a83ce 100644
--- a/Source/Asura/Graphics/Image.h
+++ b/Source/Asura/Graphics/Image.h
@@ -2,6 +2,7 @@
#define __AE_IMAGE_H__
#include "Math/Vector2.h"
+#include "Manager.hpp"
#include "Object.h"
namespace AsuraEngine
@@ -10,8 +11,8 @@ namespace AsuraEngine
{
///
- /// ImageͼƬڴ󣬶ȡϷ󱣴ĽһImageڴ桢ԴֻᱣһݣҪ
- /// imageêλãźתǶȣʹspriteһֻࡣ
+ /// ImageͼƬڴ󣬶ȡϷ󱣴ĽһImageڴ桢ԴֻᱣһݣҪ
+ /// imageêλãźתǶȣʹspriteһֻࡣ
///
class Image final : public Object
{
@@ -30,6 +31,34 @@ namespace AsuraEngine
};
+ class ImageManager : public Manager
+ {
+ public:
+
+ uint GetImagePath(uint ID);
+
+ uint GetImageID(const Containers::String& path);
+
+ Image* GetImage(const Containers::String& path);
+
+ Image* GetImage(const Containers::String& id);
+
+ uint AddImage(const Containers::String& path, Image* image);
+
+ private:
+
+ ///
+ /// еimage
+ ///
+ Containers::Map<uint, Image*> mImages;
+
+ ///
+ /// еimage·IDӳ
+ ///
+ Containers::StringMap<uint> mImageIDs;
+
+ };
+
}
}
diff --git a/Source/Asura/Graphics/Material.h b/Source/Asura/Graphics/Material.h
index 13c066a..56db3d9 100644
--- a/Source/Asura/Graphics/Material.h
+++ b/Source/Asura/Graphics/Material.h
@@ -11,6 +11,7 @@
#include "Shader.h"
#include "Texture.h"
+#include "Manager.hpp"
namespace AsuraEngine
{
@@ -143,6 +144,11 @@ namespace AsuraEngine
};
+ class MaterialManager : public Manager
+ {
+
+ };
+
}
}
diff --git a/Source/Asura/Graphics/Shader.h b/Source/Asura/Graphics/Shader.h
index ccd38af..b1e9c7a 100644
--- a/Source/Asura/Graphics/Shader.h
+++ b/Source/Asura/Graphics/Shader.h
@@ -7,6 +7,7 @@
#include "Containers/StringMap.hpp"
#include "Object.h"
#include "Color.h"
+#include "Manager.hpp"
namespace AsuraEngine
{
@@ -54,6 +55,11 @@ namespace AsuraEngine
};
+ class ShaderManager final : public Manager
+ {
+
+ };
+
}
}
diff --git a/Source/Asura/Graphics/Sprite.h b/Source/Asura/Graphics/Sprite.h
index b573c45..581ee87 100644
--- a/Source/Asura/Graphics/Sprite.h
+++ b/Source/Asura/Graphics/Sprite.h
@@ -31,7 +31,16 @@ namespace AsuraEngine
};
- void SetImage(Image* image);
+ struct SpriteDef
+ {
+ Image* image;
+ Align align;
+ Math::Vector2 anchor;
+ Math::Vector2 size;
+ };
+
+ Sprite(SpriteDef definition);
+ ~Sprite();
private:
@@ -46,11 +55,6 @@ namespace AsuraEngine
Math::Vector2 size;
///
- /// GameObjecttransform
- ///
- Transform mTransform;
-
- ///
/// 󶨵image
///
Image* mImage;
diff --git a/Source/Asura/Graphics/SpriteRenderer.h b/Source/Asura/Graphics/SpriteRenderer.h
index 4df932c..bd81509 100644
--- a/Source/Asura/Graphics/SpriteRenderer.h
+++ b/Source/Asura/Graphics/SpriteRenderer.h
@@ -12,6 +12,9 @@ namespace AsuraEngine
class SpriteRenderer final : public Renderer
{
public:
+
+ void SetSprite(Sprite* sprite);
+
void OnRender() override;
private:
diff --git a/Source/Asura/Manager.hpp b/Source/Asura/Manager.hpp
new file mode 100644
index 0000000..5a94889
--- /dev/null
+++ b/Source/Asura/Manager.hpp
@@ -0,0 +1,14 @@
+#ifndef __AE_MANAGER_H__
+#define __AE_MANAGER_H__
+
+namespace AsuraEngine
+{
+
+ class Manager
+ {
+
+ };
+
+}
+
+#endif \ No newline at end of file
diff --git a/Source/Asura/Scene.h b/Source/Asura/Scene.h
index 2fc4649..c873751 100644
--- a/Source/Asura/Scene.h
+++ b/Source/Asura/Scene.h
@@ -1,11 +1,22 @@
#ifndef __AE_SCENE_H__
#define __AE_SCENE_H__
+#include "Containers/Vector.hpp"
+#include "GameObject.h"
+
namespace AsuraEngine
{
+ ///
+ /// Ϸ
+ ///
class Scene
{
+ public:
+
+ private:
+
+ Containers::Vector<GameObject*> mGameObjects;
};