summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/Asura.Engine/Asura.Engine.vcxproj2
-rw-r--r--Build/Asura.Engine/Asura.Engine.vcxproj.filters6
-rw-r--r--Build/Asura.Runner/Asura.Runner.vcxproj3
-rw-r--r--Build/Asura.Runner/Asura.Runner.vcxproj.filters3
-rw-r--r--Source/Asura.Engine/Application.cpp29
-rw-r--r--Source/Asura.Engine/Application.h33
-rw-r--r--Source/Asura.Engine/FileSystem/DecodedData.cpp1
-rw-r--r--Source/Asura.Engine/FileSystem/Reloadable.h24
-rw-r--r--Source/Asura.Engine/FileSystem/新建文本文档.txt0
-rw-r--r--Source/Asura.Engine/Graphics/Application.Graphics.cpp20
-rw-r--r--Source/Asura.Engine/Graphics/Image.h3
-rw-r--r--Source/Asura.Engine/Graphics/ImageData.cpp6
-rw-r--r--Source/Asura.Engine/Graphics/Shader.h3
-rw-r--r--Source/Asura.Engine/Window/Window.cpp39
-rw-r--r--Source/Asura.Engine/Window/Window.h16
-rw-r--r--Source/Asura.Runner/Runner.h15
-rw-r--r--Source/Asura.Runner/main.cpp11
-rw-r--r--git.exe.stackdump19
18 files changed, 192 insertions, 41 deletions
diff --git a/Build/Asura.Engine/Asura.Engine.vcxproj b/Build/Asura.Engine/Asura.Engine.vcxproj
index 9b366d6..49f20fd 100644
--- a/Build/Asura.Engine/Asura.Engine.vcxproj
+++ b/Build/Asura.Engine/Asura.Engine.vcxproj
@@ -138,6 +138,7 @@
<ClInclude Include="..\..\Source\Asura.Engine\Factory.h" />
<ClInclude Include="..\..\Source\Asura.Engine\FileSystem\DataBuffer.h" />
<ClInclude Include="..\..\Source\Asura.Engine\FileSystem\DecodedData.h" />
+ <ClInclude Include="..\..\Source\Asura.Engine\FileSystem\Reloadable.h" />
<ClInclude Include="..\..\Source\Asura.Engine\FileSystem\ResourceManager.h" />
<ClInclude Include="..\..\Source\Asura.Engine\Font\Glyph.h" />
<ClInclude Include="..\..\Source\Asura.Engine\Graphics\BlendMode.h" />
@@ -187,6 +188,7 @@
<ClCompile Include="..\..\Source\Asura.Engine\FileSystem\DecodedData.cpp" />
<ClCompile Include="..\..\Source\Asura.Engine\FileSystem\ResourceManager.cpp" />
<ClCompile Include="..\..\Source\Asura.Engine\Font\Glyph.cpp" />
+ <ClCompile Include="..\..\Source\Asura.Engine\Graphics\Application.Graphics.cpp" />
<ClCompile Include="..\..\Source\Asura.Engine\Graphics\Canvas.cpp" />
<ClCompile Include="..\..\Source\Asura.Engine\Graphics\Color.cpp" />
<ClCompile Include="..\..\Source\Asura.Engine\Graphics\Image.cpp" />
diff --git a/Build/Asura.Engine/Asura.Engine.vcxproj.filters b/Build/Asura.Engine/Asura.Engine.vcxproj.filters
index ae93e9f..79bf9a3 100644
--- a/Build/Asura.Engine/Asura.Engine.vcxproj.filters
+++ b/Build/Asura.Engine/Asura.Engine.vcxproj.filters
@@ -172,6 +172,9 @@
<Filter>Graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\Asura.Engine\Application.h" />
+ <ClInclude Include="..\..\Source\Asura.Engine\FileSystem\Reloadable.h">
+ <Filter>FileSystem</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\Source\Asura.Engine\Audio\Sound.cpp">
@@ -300,5 +303,8 @@
<Filter>Graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Asura.Engine\Application.cpp" />
+ <ClCompile Include="..\..\Source\Asura.Engine\Graphics\Application.Graphics.cpp">
+ <Filter>Graphics</Filter>
+ </ClCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/Build/Asura.Runner/Asura.Runner.vcxproj b/Build/Asura.Runner/Asura.Runner.vcxproj
index 7661cc6..e58ca6b 100644
--- a/Build/Asura.Runner/Asura.Runner.vcxproj
+++ b/Build/Asura.Runner/Asura.Runner.vcxproj
@@ -119,6 +119,9 @@
<ItemGroup>
<ClCompile Include="..\..\Source\Asura.Runner\main.cpp" />
</ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\Source\Asura.Runner\Runner.h" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/Build/Asura.Runner/Asura.Runner.vcxproj.filters b/Build/Asura.Runner/Asura.Runner.vcxproj.filters
index 089cc91..e9b240a 100644
--- a/Build/Asura.Runner/Asura.Runner.vcxproj.filters
+++ b/Build/Asura.Runner/Asura.Runner.vcxproj.filters
@@ -3,4 +3,7 @@
<ItemGroup>
<ClCompile Include="..\..\Source\Asura.Runner\main.cpp" />
</ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\Source\Asura.Runner\Runner.h" />
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/Source/Asura.Engine/Application.cpp b/Source/Asura.Engine/Application.cpp
index ba5feaa..59f5aae 100644
--- a/Source/Asura.Engine/Application.cpp
+++ b/Source/Asura.Engine/Application.cpp
@@ -1,4 +1,6 @@
#include "Application.h"
+#include "Sdl2/SDL.h"
+#include "Exceptions/Exception.h"
namespace AsuraEngine
{
@@ -13,18 +15,23 @@ namespace AsuraEngine
}
- bool InitGraphics(bool init)
+ bool Application::Application::InitSubModules(uint flag)
{
- if (!init) return true;
-
- }
+ // ʼģ
+ #define TryInitSubModule(module_name, func_name) \
+ if((flag&ASURA_MODULE_##module_name) && !Application::Init##func_name()) \
+ throw Exception("Asura init submodule %s failed.", #module_name);
+
+ TryInitSubModule(GRAPHICS, Graphics);
+ TryInitSubModule(AUDIO, Audio);
+ TryInitSubModule(FONT, Font);
+ TryInitSubModule(INPUT, Input);
+ TryInitSubModule(MATH, Math);
+ TryInitSubModule(PHYSICS, Physics);
+ TryInitSubModule(TIME, Time);
+ TryInitSubModule(WINDOW, Window);
- bool Application::Init(int flag)
- {
- if (!InitGraphics(flag & ASURA_MODULE_GRAPHICS))
- {
-
- }
+
}
-}
+} \ No newline at end of file
diff --git a/Source/Asura.Engine/Application.h b/Source/Asura.Engine/Application.h
index 68db22b..431924a 100644
--- a/Source/Asura.Engine/Application.h
+++ b/Source/Asura.Engine/Application.h
@@ -11,18 +11,18 @@ namespace AsuraEngine
///
enum SubModules
{
- ASURA_MODULE_NONE = 0x00000000,
+ ASURA_MODULE_NONE = 0X00000000U,
ASURA_MODULE_GRAPHICS = 1 << 1,
- ASURA_MODULE_AUDIO = 1 << 2,
- ASURA_MODULE_FONT = 1 << 3,
- ASURA_MODULE_INPUT = 1 << 4,
- ASURA_MODULE_MATH = 1 << 5,
- ASURA_MODULE_PHYSICS = 1 << 6,
- ASURA_MODULE_TIME = 1 << 7,
- ASURA_MODULE_WINDOW = 1 << 8,
-
- ASURA_MODULE_ALL = 0XFFFFFFFF
+ ASURA_MODULE_AUDIO = 1 << 2,
+ ASURA_MODULE_FONT = 1 << 3,
+ ASURA_MODULE_INPUT = 1 << 4,
+ ASURA_MODULE_MATH = 1 << 5,
+ ASURA_MODULE_PHYSICS = 1 << 6,
+ ASURA_MODULE_TIME = 1 << 7,
+ ASURA_MODULE_WINDOW = 1 << 8,
+
+ ASURA_MODULE_ALL = 0XFFFFFFFFU
};
///
@@ -39,10 +39,21 @@ namespace AsuraEngine
///
/// ʼǰϵͳ
///
- bool Init(int subsystems = ASURA_MODULE_ALL);
+ bool InitSubModules(uint flag = ASURA_MODULE_ALL);
virtual void Run();
+ private:
+
+ bool InitGraphics();
+ bool InitAudio();
+ bool InitFont();
+ bool InitInput();
+ bool InitMath();
+ bool InitPhysics();
+ bool InitTime();
+ bool InitWindow();
+
};
}
diff --git a/Source/Asura.Engine/FileSystem/DecodedData.cpp b/Source/Asura.Engine/FileSystem/DecodedData.cpp
index 90726cf..125c652 100644
--- a/Source/Asura.Engine/FileSystem/DecodedData.cpp
+++ b/Source/Asura.Engine/FileSystem/DecodedData.cpp
@@ -1,4 +1,5 @@
#include "DecodedData.h"
+#include "Exceptions/Exception.h"
namespace AsuraEngine
{
diff --git a/Source/Asura.Engine/FileSystem/Reloadable.h b/Source/Asura.Engine/FileSystem/Reloadable.h
new file mode 100644
index 0000000..e07b094
--- /dev/null
+++ b/Source/Asura.Engine/FileSystem/Reloadable.h
@@ -0,0 +1,24 @@
+#ifndef __ASURA_ENGINE_RELOADABLE_H__
+#define __ASURA_ENGINE_RELOADABLE_H__
+
+#include "Object.h"
+
+namespace AsuraEngine
+{
+ namespace Filesystem
+ {
+
+ class Reloadable : virtual public Object
+ {
+ public:
+ Reloadable();
+ ~Reloadable();
+
+ virtual bool Load();
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/FileSystem/新建文本文档.txt b/Source/Asura.Engine/FileSystem/新建文本文档.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/Asura.Engine/FileSystem/新建文本文档.txt
diff --git a/Source/Asura.Engine/Graphics/Application.Graphics.cpp b/Source/Asura.Engine/Graphics/Application.Graphics.cpp
new file mode 100644
index 0000000..64b9e09
--- /dev/null
+++ b/Source/Asura.Engine/Graphics/Application.Graphics.cpp
@@ -0,0 +1,20 @@
+#include "Application.h"
+#include "Sdl2/SDL.h"
+#include "Exceptions/Exception.h"
+
+namespace AsuraEngine
+{
+
+ ///
+ /// ʼgraphicsģ
+ ///
+ bool Application::InitGraphics()
+ {
+
+ if (SDL_Init(SDL_INIT_VIDEO) < 0)
+ return false;
+
+ }
+
+
+} \ No newline at end of file
diff --git a/Source/Asura.Engine/Graphics/Image.h b/Source/Asura.Engine/Graphics/Image.h
index da881aa..7897f74 100644
--- a/Source/Asura.Engine/Graphics/Image.h
+++ b/Source/Asura.Engine/Graphics/Image.h
@@ -1,6 +1,7 @@
#ifndef __ASURA_ENGINE_IMAGE_H__
#define __ASURA_ENGINE_IMAGE_H__
+#include "FileSystem/Reloadable.h"
#include "StringMap.hpp"
#include "Manager.hpp"
#include "Texture.h"
@@ -19,7 +20,7 @@ namespace AsuraEngine
/// ImageͼƬڴ󣬶ȡϷ󱣴ĽһImageڴ桢ԴֻᱣһݣҪ
/// imageêλãźתǶȣʹspriteһֻࡣҪǿǵeditorengineʹòͬķװ
///
- class Image final : public Drawable, public Scripting::Portable
+ class Image final : public Drawable, public Scripting::Portable, public Filesystem::Reloadable
{
public:
diff --git a/Source/Asura.Engine/Graphics/ImageData.cpp b/Source/Asura.Engine/Graphics/ImageData.cpp
index af448bd..002de67 100644
--- a/Source/Asura.Engine/Graphics/ImageData.cpp
+++ b/Source/Asura.Engine/Graphics/ImageData.cpp
@@ -15,12 +15,6 @@ namespace AsuraEngine
new STBDecoder() // jpeg, tga, bmp
};
- void ImageData::ReleaseAllDecoders()
- {
- for (ImageDecoder* decoder : ImageDecoders)
- decoder->Release();
- }
-
ImageData::ImageData(const Filesystem::DataBuffer* buffer)
: DecodedData(buffer)
{
diff --git a/Source/Asura.Engine/Graphics/Shader.h b/Source/Asura.Engine/Graphics/Shader.h
index 831f5c3..7dbfb0d 100644
--- a/Source/Asura.Engine/Graphics/Shader.h
+++ b/Source/Asura.Engine/Graphics/Shader.h
@@ -4,6 +4,7 @@
#include <map>
#include <string>
+#include "FileSystem/Reloadable.h"
#include "Scripting/Luax.hpp"
#include "Math/Vector2.hpp"
#include "Math/Vector3.hpp"
@@ -25,7 +26,7 @@ namespace AsuraEngine
/// һshaderһڲʼ乲ijShaderuniformsͶݣֻṩuniformsuseɫķ༭
/// ÿshaderͨshaderҵuniforms¶frameworkmaterialá
///
- class Shader final : virtual public Object
+ class Shader final : virtual public Object, public Filesystem::Reloadable
{
public:
diff --git a/Source/Asura.Engine/Window/Window.cpp b/Source/Asura.Engine/Window/Window.cpp
index 5e800e0..6e9300f 100644
--- a/Source/Asura.Engine/Window/Window.cpp
+++ b/Source/Asura.Engine/Window/Window.cpp
@@ -5,9 +5,9 @@ namespace AsuraEngine
namespace Graphics
{
- Window::Window()
+ Window::Window(WindowStyle style)
{
-
+ //mWindowHandle = SDL_CreateWindow();
}
Window::~Window()
@@ -15,5 +15,40 @@ namespace AsuraEngine
}
+ SDL_Window* Window::GetSDLWindowHandle()
+ {
+ return mWindowHandle;
+ }
+
+ void Window::SetPosition(int x, int y)
+ {
+
+ }
+
+ void Window::SetTitle(const std::string& title)
+ {
+
+ }
+
+ void Window::Show()
+ {
+
+ }
+
+ void Window::Hide()
+ {
+
+ }
+
+ void Window::SetWindowStyle(WindowStyle style)
+ {
+
+ }
+
+ void Window::SwapRenderBuffer()
+ {
+
+ }
+
}
}
diff --git a/Source/Asura.Engine/Window/Window.h b/Source/Asura.Engine/Window/Window.h
index 3456d75..71aaf0e 100644
--- a/Source/Asura.Engine/Window/Window.h
+++ b/Source/Asura.Engine/Window/Window.h
@@ -12,21 +12,21 @@ namespace AsuraEngine
enum WindowStyle
{
-
+ WINDOW_STYLE_FULLSCREEN = 1 << 1,
};
///
/// ڣֶ֧രڡڱ༭Ҫ֧֣runnerֻҪһڡ
///
- class Window final : public RenderTarget
+ class Window : public RenderTarget
{
public:
- Window();
+ Window(WindowStyle style);
~Window();
- SDL_Window* GetSDLHandle();
+ SDL_Window* GetSDLWindowHandle();
void SetSize(uint width, uint height);
@@ -45,6 +45,14 @@ namespace AsuraEngine
///
void SwapRenderBuffer();
+ void Clear(const Color& col = Color::Black);
+
+ void Clear(const Math::Recti& quad, const Color& col = Color::Black);
+
+ void Draw(const Drawable* texture, const RenderState& state);
+
+ void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state);
+
private:
///
diff --git a/Source/Asura.Runner/Runner.h b/Source/Asura.Runner/Runner.h
new file mode 100644
index 0000000..45d9028
--- /dev/null
+++ b/Source/Asura.Runner/Runner.h
@@ -0,0 +1,15 @@
+#ifndef __ASURA_RUNNER_H__
+#define __ASURA_RUNNER_H__
+
+#include "Asura.h"
+
+using namespace AsuraEngine;
+
+class Runner : public Application
+{
+public:
+
+
+};
+
+#endif \ No newline at end of file
diff --git a/Source/Asura.Runner/main.cpp b/Source/Asura.Runner/main.cpp
index 96b17bb..3947f65 100644
--- a/Source/Asura.Runner/main.cpp
+++ b/Source/Asura.Runner/main.cpp
@@ -1,11 +1,12 @@
-#include "Asura.h"
+#include "Runner.h"
// ϷᱻһԴļrunnerȡݣϷ
// RunnerֻܶȡpackerϷļeditorֱϷassetsRunnerһСл
int main()
{
-
- Applicatoin runner;
- runner.Init(ASURAMODULE_ALL);
-
+ Runner runner;
+ runner.Init();
+ runner.Run();
+ runner.Exit();
+ return 0;
} \ No newline at end of file
diff --git a/git.exe.stackdump b/git.exe.stackdump
new file mode 100644
index 0000000..cfc009f
--- /dev/null
+++ b/git.exe.stackdump
@@ -0,0 +1,19 @@
+Stack trace:
+Frame Function Args
+000FFFFB4C0 0018005FDA9 (00000000000, 00600076400, 0007E13C269, 000FFFFDE50)
+00000000002 00180061C1A (000FFFFB7A0, 00000000000, 00000000340, 00000000000)
+000FFFFB7A0 0018012860B (0000000000B, 00000000000, 0000000000B, 00000000000)
+000FFFFBA80 00180124BEE (000FFFFB9F0, 00100000000, 00000000000, 7FFA00000003)
+00600075600 001801250E4 (0018019A537, 0018032C518, 000FFFFBAA0, 00000000006)
+00600075600 00180125329 (00000000018, 00000001028, 000FFFFBBA0, 0010058939C)
+00600075600 0018012560F (001801613CE, 00600075600, 00100608ED5, 000000001F4)
+00600075600 00100589517 (0018012078B, 000FFFFBCE8, 000FFFFBD90, 000FFFFBD90)
+00600075600 00100589858 (00600083C08, 00000000002, 001006090B7, 00180242080)
+00600075600 0010054A27C (00100605FF0, 00600074690, 001800BF9A2, 00000000000)
+001005EEE8A 001004B9394 (000FFFFC028, 00000000006, 00600000000, 00000000001)
+00000000001 00100577E8E (000000000A8, 000000000A8, 00000000000, 00600073D38)
+00000000100 00100579E12 (00000000000, 001005D9959, 000FFFFCC6A, 001005D9959)
+001005B2D60 0010045EC6E (00000000000, 00000000000, 000FFFFC2B0, 001005DA0A0)
+001005B2D60 00100460036 (001800BF8FE, 000FFFFCA50, 00000000004, 00100648160)
+000FFFFCC38 00100401265 (00180124994, 00000000000, 001006481B8, 00600072640)
+End of stack trace (more stack frames may be present)