summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-08 08:56:51 +0800
committerchai <chaifix@163.com>2019-08-08 08:56:51 +0800
commit6a065c913e9308cc72e1ad0723b6167048f439b6 (patch)
tree58cb4f28113949469c56584e32a510713ddbc2c1
parent0c391fdbce5a079cf03e483eb6174dd47806163d (diff)
*misc
-rw-r--r--Bin/win64/01-window.exebin1461760 -> 1462272 bytes
-rw-r--r--Bin/win64/SDL2.dllbin2491904 -> 2491904 bytes
-rw-r--r--Build/.vs/Asura/v15/Server/sqlite3/db.lock0
-rw-r--r--Build/.vs/Asura/v15/Server/sqlite3/storage.idebin0 -> 4096 bytes
-rw-r--r--Build/.vs/Asura/v15/Server/sqlite3/storage.ide-shmbin0 -> 32768 bytes
-rw-r--r--Build/.vs/Asura/v15/Server/sqlite3/storage.ide-walbin0 -> 539752 bytes
-rw-r--r--Build/Asura.Editor/Asura.Editor.vcxproj2
-rw-r--r--Build/Asura.Editor/Asura.Editor.vcxproj.filters6
-rw-r--r--Build/tools/bindingGen/obj/Debug/bindingGen.csproj.CoreCompileInputs.cache1
-rw-r--r--Build/tools/bindingGen/obj/Debug/bindingGen.csprojAssemblyReference.cachebin0 -> 8077 bytes
-rw-r--r--Source/Asura.Editor/Controls/GUIButton.h5
-rw-r--r--Source/Asura.Editor/Controls/GUIClip.h10
-rw-r--r--Source/Asura.Editor/Controls/GUIContent.h6
-rw-r--r--Source/Asura.Editor/Controls/GUIPanel.h10
-rw-r--r--Source/Asura.Editor/Controls/GUIState.h (renamed from Source/Asura.Editor/Core/GUIState.h)7
-rw-r--r--Source/modules/asura-base/FileSystem/Binding/_data_buffer.cpp6
-rw-r--r--Source/modules/asura-base/FileSystem/Binding/_file.cpp6
-rw-r--r--Source/modules/asura-base/FileSystem/Binding/_file_data.cpp6
-rw-r--r--Source/modules/asura-base/FileSystem/Binding/_file_manager.cpp6
-rw-r--r--Source/modules/asura-base/FileSystem/Binding/_io_task.cpp6
-rw-r--r--Source/modules/asura-base/FileSystem/Compressor.cpp10
-rw-r--r--Source/modules/asura-base/FileSystem/Compressor.h28
-rw-r--r--Source/modules/asura-base/FileSystem/DataBuffer.cpp6
-rw-r--r--Source/modules/asura-base/FileSystem/DataBuffer.h132
-rw-r--r--Source/modules/asura-base/FileSystem/DecodedData.h52
-rw-r--r--Source/modules/asura-base/FileSystem/File.cpp484
-rw-r--r--Source/modules/asura-base/FileSystem/File.h229
-rw-r--r--Source/modules/asura-base/FileSystem/FileData.cpp104
-rw-r--r--Source/modules/asura-base/FileSystem/FileData.h84
-rw-r--r--Source/modules/asura-base/FileSystem/FileManager.cpp320
-rw-r--r--Source/modules/asura-base/FileSystem/FileManager.h142
-rw-r--r--Source/modules/asura-base/FileSystem/IOBatchTask.h36
-rw-r--r--Source/modules/asura-base/FileSystem/IOTask.cpp86
-rw-r--r--Source/modules/asura-base/FileSystem/IOTask.h64
-rw-r--r--Source/modules/asura-base/FileSystem/Renewable.h30
-rw-r--r--bin/win64/01-window.exebin1461760 -> 1462272 bytes
-rw-r--r--bin/win64/SDL2.dllbin2491904 -> 2491904 bytes
-rw-r--r--build/Asura.Editor/Asura.Editor.vcxproj2
-rw-r--r--build/Asura.Editor/Asura.Editor.vcxproj.filters6
-rw-r--r--source/Asura.Editor/Controls/GUIButton.h5
-rw-r--r--source/Asura.Editor/Controls/GUIContent.h6
-rw-r--r--source/Asura.Editor/Controls/GUIPanel.h10
-rw-r--r--source/Asura.Editor/Core/GUIState.h27
43 files changed, 939 insertions, 1001 deletions
diff --git a/Bin/win64/01-window.exe b/Bin/win64/01-window.exe
index 190a0a7..70db8e5 100644
--- a/Bin/win64/01-window.exe
+++ b/Bin/win64/01-window.exe
Binary files differ
diff --git a/Bin/win64/SDL2.dll b/Bin/win64/SDL2.dll
index becc4ba..8f849cd 100644
--- a/Bin/win64/SDL2.dll
+++ b/Bin/win64/SDL2.dll
Binary files differ
diff --git a/Build/.vs/Asura/v15/Server/sqlite3/db.lock b/Build/.vs/Asura/v15/Server/sqlite3/db.lock
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Build/.vs/Asura/v15/Server/sqlite3/db.lock
diff --git a/Build/.vs/Asura/v15/Server/sqlite3/storage.ide b/Build/.vs/Asura/v15/Server/sqlite3/storage.ide
new file mode 100644
index 0000000..56758a8
--- /dev/null
+++ b/Build/.vs/Asura/v15/Server/sqlite3/storage.ide
Binary files differ
diff --git a/Build/.vs/Asura/v15/Server/sqlite3/storage.ide-shm b/Build/.vs/Asura/v15/Server/sqlite3/storage.ide-shm
new file mode 100644
index 0000000..baa828a
--- /dev/null
+++ b/Build/.vs/Asura/v15/Server/sqlite3/storage.ide-shm
Binary files differ
diff --git a/Build/.vs/Asura/v15/Server/sqlite3/storage.ide-wal b/Build/.vs/Asura/v15/Server/sqlite3/storage.ide-wal
new file mode 100644
index 0000000..a2c8fca
--- /dev/null
+++ b/Build/.vs/Asura/v15/Server/sqlite3/storage.ide-wal
Binary files differ
diff --git a/Build/Asura.Editor/Asura.Editor.vcxproj b/Build/Asura.Editor/Asura.Editor.vcxproj
index d2d7a5c..d214c2e 100644
--- a/Build/Asura.Editor/Asura.Editor.vcxproj
+++ b/Build/Asura.Editor/Asura.Editor.vcxproj
@@ -155,9 +155,9 @@
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUILabel.h" />
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUIPanel.h" />
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUISlider.h" />
+ <ClInclude Include="..\..\Source\Asura.Editor\Controls\GUIState.h" />
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUIToggle.h" />
<ClInclude Include="..\..\source\Asura.Editor\Controls\TextUtil.h" />
- <ClInclude Include="..\..\source\Asura.Editor\Core\GUIState.h" />
<ClInclude Include="..\..\source\Asura.Editor\Editor.h" />
<ClInclude Include="..\..\source\Asura.Editor\Graphics\Brush.h" />
<ClInclude Include="..\..\source\Asura.Editor\Graphics\Drawer.h" />
diff --git a/Build/Asura.Editor/Asura.Editor.vcxproj.filters b/Build/Asura.Editor/Asura.Editor.vcxproj.filters
index ef9bd0f..bc89328 100644
--- a/Build/Asura.Editor/Asura.Editor.vcxproj.filters
+++ b/Build/Asura.Editor/Asura.Editor.vcxproj.filters
@@ -109,9 +109,6 @@
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUIToggle.h">
<Filter>Controls</Filter>
</ClInclude>
- <ClInclude Include="..\..\source\Asura.Editor\Core\GUIState.h">
- <Filter>Core</Filter>
- </ClInclude>
<ClInclude Include="..\..\source\Asura.Editor\Graphics\Brush.h">
<Filter>Graphics</Filter>
</ClInclude>
@@ -162,5 +159,8 @@
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUIClip.h">
<Filter>Controls</Filter>
</ClInclude>
+ <ClInclude Include="..\..\Source\Asura.Editor\Controls\GUIState.h">
+ <Filter>Controls</Filter>
+ </ClInclude>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/Build/tools/bindingGen/obj/Debug/bindingGen.csproj.CoreCompileInputs.cache b/Build/tools/bindingGen/obj/Debug/bindingGen.csproj.CoreCompileInputs.cache
new file mode 100644
index 0000000..93b7e43
--- /dev/null
+++ b/Build/tools/bindingGen/obj/Debug/bindingGen.csproj.CoreCompileInputs.cache
@@ -0,0 +1 @@
+76869cb9eeaafde93fc35e764d87dc7f1f272b2f
diff --git a/Build/tools/bindingGen/obj/Debug/bindingGen.csprojAssemblyReference.cache b/Build/tools/bindingGen/obj/Debug/bindingGen.csprojAssemblyReference.cache
new file mode 100644
index 0000000..d31b6fe
--- /dev/null
+++ b/Build/tools/bindingGen/obj/Debug/bindingGen.csprojAssemblyReference.cache
Binary files differ
diff --git a/Source/Asura.Editor/Controls/GUIButton.h b/Source/Asura.Editor/Controls/GUIButton.h
index e1199db..47da571 100644
--- a/Source/Asura.Editor/Controls/GUIButton.h
+++ b/Source/Asura.Editor/Controls/GUIButton.h
@@ -2,13 +2,14 @@
#define _ASURA_EDITOR_GUI_BUTTON_H_
#include <asura-base/Classes.h>
+#include <asura-base/Type.h>
namespace_begin(AsuraEditor)
+bool GUIButton(int controlID);
bool GUIButton();
-
namespace_end
-#endif
+#endif \ No newline at end of file
diff --git a/Source/Asura.Editor/Controls/GUIClip.h b/Source/Asura.Editor/Controls/GUIClip.h
index 38b6094..f2aafad 100644
--- a/Source/Asura.Editor/Controls/GUIClip.h
+++ b/Source/Asura.Editor/Controls/GUIClip.h
@@ -1,6 +1,16 @@
#ifndef _ASURA_GUICLIP_H_
#define _ASURA_GUICLIP_H_
+#include <asura-base/Classes.h>
+#include <asura-base/Type.h>
+namespace_begin(AsuraEditor)
+
+class GUIClip
+{
+
+};
+
+namespace_end
#endif
diff --git a/Source/Asura.Editor/Controls/GUIContent.h b/Source/Asura.Editor/Controls/GUIContent.h
index 88213f4..034aa42 100644
--- a/Source/Asura.Editor/Controls/GUIContent.h
+++ b/Source/Asura.Editor/Controls/GUIContent.h
@@ -8,10 +8,14 @@ namespace_begin(AsuraEditor)
/// IMGUI content
class GUIContent
{
+public:
+
+ GUIContent();
+ ~GUIContent();
};
namespace_end
-#endif
+#endif \ No newline at end of file
diff --git a/Source/Asura.Editor/Controls/GUIPanel.h b/Source/Asura.Editor/Controls/GUIPanel.h
index 105edde..0f98eaa 100644
--- a/Source/Asura.Editor/Controls/GUIPanel.h
+++ b/Source/Asura.Editor/Controls/GUIPanel.h
@@ -8,9 +8,17 @@ namespace_begin(AsuraEditor)
/// IMGUI panel
class GUIPanel
{
+public:
+
+ GUIPanel();
+ ~GUIPanel();
+
+private:
+
+
};
namespace_end
-#endif
+#endif \ No newline at end of file
diff --git a/Source/Asura.Editor/Core/GUIState.h b/Source/Asura.Editor/Controls/GUIState.h
index b4fce49..424a12f 100644
--- a/Source/Asura.Editor/Core/GUIState.h
+++ b/Source/Asura.Editor/Controls/GUIState.h
@@ -8,14 +8,16 @@ namespace_begin(AsuraEditor)
/// GUI widgets uniqueID
class GUIState
{
-public:
+public:
inline int GetDepth() { return m_Depth; };
+ inline int GetCurrentControlID() { return m_CurrentControlID};
-private:
+private:
int m_Depth;
bool m_Changed;
+ int m_CurrentControlID;
};
@@ -23,5 +25,4 @@ extern GUIState g_GUIState;
namespace_end
-
#endif \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/Binding/_data_buffer.cpp b/Source/modules/asura-base/FileSystem/Binding/_data_buffer.cpp
index ff1f0dc..3f5ee57 100644
--- a/Source/modules/asura-base/FileSystem/Binding/_data_buffer.cpp
+++ b/Source/modules/asura-base/FileSystem/Binding/_data_buffer.cpp
@@ -2,10 +2,8 @@
using namespace Luax;
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
LUAX_REGISTRY(DataBuffer)
{
diff --git a/Source/modules/asura-base/FileSystem/Binding/_file.cpp b/Source/modules/asura-base/FileSystem/Binding/_file.cpp
index d19c02a..f2a45f9 100644
--- a/Source/modules/asura-base/FileSystem/Binding/_file.cpp
+++ b/Source/modules/asura-base/FileSystem/Binding/_file.cpp
@@ -1,9 +1,7 @@
#include "../file.h"
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
LUAX_REGISTRY(File)
{
diff --git a/Source/modules/asura-base/FileSystem/Binding/_file_data.cpp b/Source/modules/asura-base/FileSystem/Binding/_file_data.cpp
index ca872d2..3ecf2cf 100644
--- a/Source/modules/asura-base/FileSystem/Binding/_file_data.cpp
+++ b/Source/modules/asura-base/FileSystem/Binding/_file_data.cpp
@@ -2,10 +2,8 @@
using namespace std;
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
LUAX_REGISTRY(FileData)
{
diff --git a/Source/modules/asura-base/FileSystem/Binding/_file_manager.cpp b/Source/modules/asura-base/FileSystem/Binding/_file_manager.cpp
index 7781d99..6852c37 100644
--- a/Source/modules/asura-base/FileSystem/Binding/_file_manager.cpp
+++ b/Source/modules/asura-base/FileSystem/Binding/_file_manager.cpp
@@ -2,10 +2,8 @@
using namespace Luax;
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
#define PREPARE(l) \
LUAX_STATE(l); \
diff --git a/Source/modules/asura-base/FileSystem/Binding/_io_task.cpp b/Source/modules/asura-base/FileSystem/Binding/_io_task.cpp
index a3d82d5..82bb2ed 100644
--- a/Source/modules/asura-base/FileSystem/Binding/_io_task.cpp
+++ b/Source/modules/asura-base/FileSystem/Binding/_io_task.cpp
@@ -2,10 +2,8 @@
using namespace std;
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
LUAX_REGISTRY(IOTask)
{
diff --git a/Source/modules/asura-base/FileSystem/Compressor.cpp b/Source/modules/asura-base/FileSystem/Compressor.cpp
index eaa59a2..192ef7d 100644
--- a/Source/modules/asura-base/FileSystem/Compressor.cpp
+++ b/Source/modules/asura-base/FileSystem/Compressor.cpp
@@ -1,11 +1,9 @@
#include "Compressor.h"
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
- }
-} \ No newline at end of file
+namespace_end
+namespace_end \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/Compressor.h b/Source/modules/asura-base/FileSystem/Compressor.h
index 9fd0808..f06c5f4 100644
--- a/Source/modules/asura-base/FileSystem/Compressor.h
+++ b/Source/modules/asura-base/FileSystem/Compressor.h
@@ -3,26 +3,24 @@
#include "../Scripting/Scripting.h"
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
- class Compressor ASURA_FINAL
- : public AEScripting::Portable<Compressor>
- {
- public:
+class Compressor ASURA_FINAL
+ : public AEScripting::Portable<Compressor>
+{
+public:
- LUAX_DECL_SINGLETON(Compressor);
+ LUAX_DECL_SINGLETON(Compressor);
- private:
+private:
- LUAX_DECL_METHOD(_Compress);
- LUAX_DECL_METHOD(_Decompress);
+ LUAX_DECL_METHOD(_Compress);
+ LUAX_DECL_METHOD(_Decompress);
- };
+};
- }
-}
+namespace_end
+namespace_end
#endif \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/DataBuffer.cpp b/Source/modules/asura-base/FileSystem/DataBuffer.cpp
index 71431e1..cd6191b 100644
--- a/Source/modules/asura-base/FileSystem/DataBuffer.cpp
+++ b/Source/modules/asura-base/FileSystem/DataBuffer.cpp
@@ -4,10 +4,8 @@
using namespace AEThreading;
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
DataBuffer::DataBuffer(DataBuffer& src)
: m_Size(0)
diff --git a/Source/modules/asura-base/FileSystem/DataBuffer.h b/Source/modules/asura-base/FileSystem/DataBuffer.h
index ace372e..da302ce 100644
--- a/Source/modules/asura-base/FileSystem/DataBuffer.h
+++ b/Source/modules/asura-base/FileSystem/DataBuffer.h
@@ -6,81 +6,79 @@
#include "../Scripting/Scripting.h"
#include "../Threads/Mutex.h"
-namespace AsuraEngine
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
+
+///
+/// ڴݵķװеʹData bufferװֱʹconst void*ͨresource managerȡ
+///
+class DataBuffer ASURA_FINAL
+ : public AEScripting::Portable<DataBuffer>
{
- namespace FileSystem
- {
-
- ///
- /// ڴݵķװеʹData bufferװֱʹconst void*ͨresource managerȡ
- ///
- class DataBuffer ASURA_FINAL
- : public AEScripting::Portable<DataBuffer>
- {
- public:
-
- LUAX_DECL_FACTORY(DataBuffer);
-
- DataBuffer(DataBuffer& src);
- DataBuffer(std::size_t capacity);
- DataBuffer(const void* bytes, std::size_t size);
- ~DataBuffer();
-
- byte* GetData();
- size_t GetSize();
- size_t GetCapacity();
-
- ///
- /// ޸
- ///
- void Refactor(size_t capacity);
-
- ///
- /// Դ˻
- ///
- void Load(DataBuffer& db);
- void Load(const void* bytes, std::size_t size);
-
- ///
- /// bytesӵȨcapacityΪsize
- ///
- void Move(void* bytes, std::size_t size);
-
- ///
- ///
- ///
- void Clear();
-
- void Lock();
- void Unlock();
+public:
+
+ LUAX_DECL_FACTORY(DataBuffer);
+
+ DataBuffer(DataBuffer& src);
+ DataBuffer(std::size_t capacity);
+ DataBuffer(const void* bytes, std::size_t size);
+ ~DataBuffer();
+
+ byte* GetData();
+ size_t GetSize();
+ size_t GetCapacity();
+
+ ///
+ /// ޸
+ ///
+ void Refactor(size_t capacity);
+
+ ///
+ /// Դ˻
+ ///
+ void Load(DataBuffer& db);
+ void Load(const void* bytes, std::size_t size);
+
+ ///
+ /// bytesӵȨcapacityΪsize
+ ///
+ void Move(void* bytes, std::size_t size);
+
+ ///
+ ///
+ ///
+ void Clear();
+
+ void Lock();
+ void Unlock();
- private:
+private:
- LUAX_DECL_METHOD(_New);
- LUAX_DECL_METHOD(_GetData);
- LUAX_DECL_METHOD(_GetSize);
- LUAX_DECL_METHOD(_GetCapacity);
- LUAX_DECL_METHOD(_Refactor);
- LUAX_DECL_METHOD(_Load);
- LUAX_DECL_METHOD(_Clear);
+ LUAX_DECL_METHOD(_New);
+ LUAX_DECL_METHOD(_GetData);
+ LUAX_DECL_METHOD(_GetSize);
+ LUAX_DECL_METHOD(_GetCapacity);
+ LUAX_DECL_METHOD(_Refactor);
+ LUAX_DECL_METHOD(_Load);
+ LUAX_DECL_METHOD(_Clear);
- ///
- /// Buffer׵ַݵij
- ///
- byte* m_Bytes;
- size_t m_Size;
+ ///
+ /// Buffer׵ַݵij
+ ///
+ byte* m_Bytes;
+ size_t m_Size;
- ///
- /// Buffer
- ///
- size_t m_Capacity;
+ ///
+ /// Buffer
+ ///
+ size_t m_Capacity;
- AEThreading::Mutex m_Mutex;
+ AEThreading::Mutex m_Mutex;
- };
+};
- }
-}
+namespace_end
+namespace_end
namespace AEFileSystem = AsuraEngine::FileSystem;
diff --git a/Source/modules/asura-base/FileSystem/DecodedData.h b/Source/modules/asura-base/FileSystem/DecodedData.h
index 1744233..f83d1c3 100644
--- a/Source/modules/asura-base/FileSystem/DecodedData.h
+++ b/Source/modules/asura-base/FileSystem/DecodedData.h
@@ -9,33 +9,31 @@
#include "DataBuffer.h"
-namespace AsuraEngine
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
+
+///
+/// һ̹߳data̳дࡣͼƬݡƵݵȣһ߳нԭ
+/// ļڲݸʽصȡ
+///
+ASURA_ABSTRACT class DecodedData
{
- namespace FileSystem
- {
-
- ///
- /// һ̹߳data̳дࡣͼƬݡƵݵȣһ߳нԭ
- /// ļڲݸʽصȡ
- ///
- ASURA_ABSTRACT class DecodedData
- {
- public:
-
- ///
- /// ڴйdataԷһ߳棬Դϵͳء
- ///
- DecodedData() {};
- virtual ~DecodedData() {};
-
- ///
- /// ڴеݲijָʽ档
- ///
- virtual void Decode(DataBuffer& buffer) = 0;
-
- };
-
- }
-}
+public:
+
+ ///
+ /// ڴйdataԷһ߳棬Դϵͳء
+ ///
+ DecodedData() {};
+ virtual ~DecodedData() {};
+
+ ///
+ /// ڴеݲijָʽ档
+ ///
+ virtual void Decode(DataBuffer& buffer) = 0;
+
+};
+
+namespace_end
+namespace_end
#endif \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/File.cpp b/Source/modules/asura-base/FileSystem/File.cpp
index ec8a9bf..30a75e0 100644
--- a/Source/modules/asura-base/FileSystem/File.cpp
+++ b/Source/modules/asura-base/FileSystem/File.cpp
@@ -4,291 +4,289 @@
#include "File.h"
-namespace AsuraEngine
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
+
+File::File(const std::string& filename)
+ : m_FileName(filename)
+ , m_FileHandle(nullptr)
+ , m_Mode(FILE_MODE_CLOSED)
+ , m_BufferMode(BUFFER_MODE_NONE)
+ , m_BufferSize(0)
{
- namespace FileSystem
+ size_t dot = filename.rfind('.');
+ if (dot != std::string::npos)
{
+ m_Extension = filename.substr(dot + 1);
+ m_Name = filename.substr(0, dot);
+ }
+ else
+ m_Name = filename;
+}
- File::File(const std::string& filename)
- : m_FileName(filename)
- , m_FileHandle(nullptr)
- , m_Mode(FILE_MODE_CLOSED)
- , m_BufferMode(BUFFER_MODE_NONE)
- , m_BufferSize(0)
- {
- size_t dot = filename.rfind('.');
- if (dot != std::string::npos)
- {
- m_Extension = filename.substr(dot + 1);
- m_Name = filename.substr(0, dot);
- }
- else
- m_Name = filename;
- }
+File::~File()
+{
+ if (m_Mode != FILE_MODE_CLOSED)
+ Close();
+}
- File::~File()
- {
- if (m_Mode != FILE_MODE_CLOSED)
- Close();
- }
+bool File::Open(FileMode mode)
+{
+ if (!PHYSFS_isInit())
+ throw Exception("Physfs is NOT initialized.");
- bool File::Open(FileMode mode)
- {
- if (!PHYSFS_isInit())
- throw Exception("Physfs is NOT initialized.");
-
- if (mode == FILE_MODE_CLOSED)
- return false;
-
- if (mode == FILE_MODE_READ && !PHYSFS_exists(m_FileName.c_str()))
- throw Exception("Could NOT open file %s. Does not exist.", m_FileName.c_str());
-
- if (mode == FILE_MODE_APPEND || mode == FILE_MODE_WRITE)
- {
- if (!PHYSFS_getWriteDir())
- {
- throw Exception("Could NOT set write directory.");
- }
- }
-
- // Ѿ֮ǰ򿪹Ͳٴµhandle
- if (m_FileHandle != nullptr)
- return true;
-
- PHYSFS_getLastErrorCode();
-
- PHYSFS_File* handle = nullptr;
-
- switch (mode)
- {
- case FILE_MODE_READ:
- handle = PHYSFS_openRead(m_FileName.c_str());
- break;
- case FILE_MODE_APPEND:
- handle = PHYSFS_openAppend(m_FileName.c_str());
- break;
- case FILE_MODE_WRITE:
- handle = PHYSFS_openWrite(m_FileName.c_str());
- break;
- }
-
- if (handle == nullptr)
- {
- const char *err = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode());
- if (err == nullptr)
- err = "unknown error";
- throw Exception("Could not open file %s (%s)", m_FileName.c_str(), err);
- }
-
- m_FileHandle = handle;
- m_Mode = mode;
-
- if (m_FileHandle && !SetBuffer(m_BufferMode,m_BufferSize))
- {
- m_BufferMode = BUFFER_MODE_NONE;
- m_BufferSize = 0;
- }
-
- return m_FileHandle != nullptr;
- }
+ if (mode == FILE_MODE_CLOSED)
+ return false;
- bool File::Close()
- {
- if (m_FileHandle == nullptr || !PHYSFS_close(m_FileHandle))
- return false;
- m_Mode = FILE_MODE_CLOSED;
- m_FileHandle = nullptr;
- return true;
- }
+ if (mode == FILE_MODE_READ && !PHYSFS_exists(m_FileName.c_str()))
+ throw Exception("Could NOT open file %s. Does not exist.", m_FileName.c_str());
- bool File::IsOpen()
+ if (mode == FILE_MODE_APPEND || mode == FILE_MODE_WRITE)
+ {
+ if (!PHYSFS_getWriteDir())
{
- return m_Mode != FILE_MODE_CLOSED && m_FileHandle != nullptr;
+ throw Exception("Could NOT set write directory.");
}
+ }
- size_t File::GetSize()
- {
- if (m_FileHandle == nullptr)
- {
- Open(FILE_MODE_READ);
- size_t size = PHYSFS_fileLength(m_FileHandle);
- Close();
- return size;
- }
- return PHYSFS_fileLength(m_FileHandle);
- }
+ // Ѿ֮ǰ򿪹Ͳٴµhandle
+ if (m_FileHandle != nullptr)
+ return true;
- size_t File::Read(ASURA_OUT DataBuffer* dst, size_t length)
- {
- ASSERT(dst);
+ PHYSFS_getLastErrorCode();
- if (dst->GetCapacity() < length)
- throw Exception("Data buffer is too small compares to read length.");
+ PHYSFS_File* handle = nullptr;
- if (!m_FileHandle || m_Mode != FILE_MODE_READ)
- throw Exception("File \"%s\" is not opened for reading", m_FileName);
+ switch (mode)
+ {
+ case FILE_MODE_READ:
+ handle = PHYSFS_openRead(m_FileName.c_str());
+ break;
+ case FILE_MODE_APPEND:
+ handle = PHYSFS_openAppend(m_FileName.c_str());
+ break;
+ case FILE_MODE_WRITE:
+ handle = PHYSFS_openWrite(m_FileName.c_str());
+ break;
+ }
- size_t max = PHYSFS_fileLength(m_FileHandle);
- length = (length > max) ? max : length;
+ if (handle == nullptr)
+ {
+ const char *err = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode());
+ if (err == nullptr)
+ err = "unknown error";
+ throw Exception("Could not open file %s (%s)", m_FileName.c_str(), err);
+ }
- if (length < 0)
- throw Exception("Invalid read size.");
+ m_FileHandle = handle;
+ m_Mode = mode;
- dst->Lock();
- size_t size = PHYSFS_readBytes(m_FileHandle, dst->GetData(), length);
- dst->Unlock();
- return size;
- }
+ if (m_FileHandle && !SetBuffer(m_BufferMode,m_BufferSize))
+ {
+ m_BufferMode = BUFFER_MODE_NONE;
+ m_BufferSize = 0;
+ }
- size_t File::ReadAll(ASURA_OUT DataBuffer* dst)
- {
- ASSERT(dst);
+ return m_FileHandle != nullptr;
+}
- if (!m_FileHandle || m_Mode != FILE_MODE_READ)
- throw Exception("File \"%s\" is not opened for reading", m_FileName);
+bool File::Close()
+{
+ if (m_FileHandle == nullptr || !PHYSFS_close(m_FileHandle))
+ return false;
+ m_Mode = FILE_MODE_CLOSED;
+ m_FileHandle = nullptr;
+ return true;
+}
+
+bool File::IsOpen()
+{
+ return m_Mode != FILE_MODE_CLOSED && m_FileHandle != nullptr;
+}
+
+size_t File::GetSize()
+{
+ if (m_FileHandle == nullptr)
+ {
+ Open(FILE_MODE_READ);
+ size_t size = PHYSFS_fileLength(m_FileHandle);
+ Close();
+ return size;
+ }
+ return PHYSFS_fileLength(m_FileHandle);
+}
- size_t length = PHYSFS_fileLength(m_FileHandle);
+size_t File::Read(ASURA_OUT DataBuffer* dst, size_t length)
+{
+ ASSERT(dst);
- if (dst->GetCapacity() < length)
- throw Exception("Data buffer is too small compares to file length.");
+ if (dst->GetCapacity() < length)
+ throw Exception("Data buffer is too small compares to read length.");
- dst->Lock();
- byte* data = dst->GetData();
- size_t size = PHYSFS_readBytes(m_FileHandle, data, length);
- dst->Move(data, length);
- dst->Unlock();
- return size;
- }
+ if (!m_FileHandle || m_Mode != FILE_MODE_READ)
+ throw Exception("File \"%s\" is not opened for reading", m_FileName);
+
+ size_t max = PHYSFS_fileLength(m_FileHandle);
+ length = (length > max) ? max : length;
+
+ if (length < 0)
+ throw Exception("Invalid read size.");
+
+ dst->Lock();
+ size_t size = PHYSFS_readBytes(m_FileHandle, dst->GetData(), length);
+ dst->Unlock();
+ return size;
+}
+
+size_t File::ReadAll(ASURA_OUT DataBuffer* dst)
+{
+ ASSERT(dst);
+
+ if (!m_FileHandle || m_Mode != FILE_MODE_READ)
+ throw Exception("File \"%s\" is not opened for reading", m_FileName);
+
+ size_t length = PHYSFS_fileLength(m_FileHandle);
+
+ if (dst->GetCapacity() < length)
+ throw Exception("Data buffer is too small compares to file length.");
+
+ dst->Lock();
+ byte* data = dst->GetData();
+ size_t size = PHYSFS_readBytes(m_FileHandle, data, length);
+ dst->Move(data, length);
+ dst->Unlock();
+ return size;
+}
#ifdef ASURA_WINDOWS
- inline bool test_eof(File *that, PHYSFS_File *)
- {
- int64 pos = that->Tell();
- int64 size = that->GetSize();
- return pos == -1 || size == -1 || pos >= size;
- }
+inline bool test_eof(File *that, PHYSFS_File *)
+{
+ int64 pos = that->Tell();
+ int64 size = that->GetSize();
+ return pos == -1 || size == -1 || pos >= size;
+}
#else
- inline bool test_eof(File *, PHYSFS_File *file)
- {
- return PHYSFS_eof(file);
- }
+inline bool test_eof(File *, PHYSFS_File *file)
+{
+ return PHYSFS_eof(file);
+}
#endif
- bool File::IsEOF()
- {
- return m_FileHandle == nullptr || test_eof(this, m_FileHandle);
- }
+bool File::IsEOF()
+{
+ return m_FileHandle == nullptr || test_eof(this, m_FileHandle);
+}
- size_t File::Tell()
- {
- if (!m_FileHandle)
- return - 1;
+size_t File::Tell()
+{
+ if (!m_FileHandle)
+ return - 1;
- return PHYSFS_tell(m_FileHandle);
- }
+ return PHYSFS_tell(m_FileHandle);
+}
- bool File::Seek(size_t pos)
- {
- return m_FileHandle != nullptr && PHYSFS_seek(m_FileHandle, pos) != 0;
- }
+bool File::Seek(size_t pos)
+{
+ return m_FileHandle != nullptr && PHYSFS_seek(m_FileHandle, pos) != 0;
+}
- bool File::Write(ASURA_REF DataBuffer* src)
- {
- if (!m_FileHandle || (m_Mode != FILE_MODE_APPEND && m_Mode != FILE_MODE_WRITE))
- throw Exception("File is not opened for writing.");
+bool File::Write(ASURA_REF DataBuffer* src)
+{
+ if (!m_FileHandle || (m_Mode != FILE_MODE_APPEND && m_Mode != FILE_MODE_WRITE))
+ throw Exception("File is not opened for writing.");
- byte* data = src->GetData();
- int size = src->GetSize();
+ byte* data = src->GetData();
+ int size = src->GetSize();
- if (size < 0)
- throw Exception("Invalid write size.");
+ if (size < 0)
+ throw Exception("Invalid write size.");
- size_t written = PHYSFS_writeBytes(m_FileHandle, data, size);
+ size_t written = PHYSFS_writeBytes(m_FileHandle, data, size);
- if (written != src->GetSize())
- return false;
+ if (written != src->GetSize())
+ return false;
- // л
- if (m_BufferSize == BUFFER_MODE_LINE && m_BufferSize > size)
- {
- if (memchr(data, '\n', size) != nullptr)
- Flush();
- }
+ // л
+ if (m_BufferSize == BUFFER_MODE_LINE && m_BufferSize > size)
+ {
+ if (memchr(data, '\n', size) != nullptr)
+ Flush();
+ }
- return true;
- }
+ return true;
+}
- bool File::Flush()
- {
- if (!m_FileHandle || (m_Mode != FILE_MODE_WRITE && m_Mode != FILE_MODE_APPEND))
- throw Exception("File is not opened for writing.");
+bool File::Flush()
+{
+ if (!m_FileHandle || (m_Mode != FILE_MODE_WRITE && m_Mode != FILE_MODE_APPEND))
+ throw Exception("File is not opened for writing.");
- return PHYSFS_flush(m_FileHandle) != 0;
- }
+ return PHYSFS_flush(m_FileHandle) != 0;
+}
- bool File::SetBuffer(BufferMode mode, size_t size)
- {
- if (size < 0)
- return false;
-
- // If the file isn't open, we'll make sure the buffer values are set in
- // File::open.
- if (!IsOpen())
- {
- m_BufferMode = mode;
- m_BufferSize = size;
- return true;
- }
-
- int ret = 1;
-
- switch (mode)
- {
- case BUFFER_MODE_NONE:
- default:
- ret = PHYSFS_setBuffer(m_FileHandle, 0);
- size = 0;
- break;
- case BUFFER_MODE_LINE:
- case BUFFER_MODE_FULL:
- ret = PHYSFS_setBuffer(m_FileHandle, size);
- break;
- }
-
- if (ret == 0)
- return false;
-
- m_BufferMode = mode;
- m_BufferSize = size;
-
- return true;
- }
+bool File::SetBuffer(BufferMode mode, size_t size)
+{
+ if (size < 0)
+ return false;
- File::BufferMode File::GetBuffer(ASURA_OUT size_t& size)
- {
- size = m_BufferSize;
- return m_BufferMode;
- }
+ // If the file isn't open, we'll make sure the buffer values are set in
+ // File::open.
+ if (!IsOpen())
+ {
+ m_BufferMode = mode;
+ m_BufferSize = size;
+ return true;
+ }
- const std::string& File::GetFileName()
- {
- return m_FileName;
- }
+ int ret = 1;
- const std::string& File::GetName()
- {
- return m_Name;
- }
+ switch (mode)
+ {
+ case BUFFER_MODE_NONE:
+ default:
+ ret = PHYSFS_setBuffer(m_FileHandle, 0);
+ size = 0;
+ break;
+ case BUFFER_MODE_LINE:
+ case BUFFER_MODE_FULL:
+ ret = PHYSFS_setBuffer(m_FileHandle, size);
+ break;
+ }
- const std::string& File::GetExtension()
- {
- return m_Extension;
- }
+ if (ret == 0)
+ return false;
- File::FileMode File::GetMode()
- {
- return m_Mode;
- }
+ m_BufferMode = mode;
+ m_BufferSize = size;
- }
-} \ No newline at end of file
+ return true;
+}
+
+File::BufferMode File::GetBuffer(ASURA_OUT size_t& size)
+{
+ size = m_BufferSize;
+ return m_BufferMode;
+}
+
+const std::string& File::GetFileName()
+{
+ return m_FileName;
+}
+
+const std::string& File::GetName()
+{
+ return m_Name;
+}
+
+const std::string& File::GetExtension()
+{
+ return m_Extension;
+}
+
+File::FileMode File::GetMode()
+{
+ return m_Mode;
+}
+
+namespace_end
+namespace_end
diff --git a/Source/modules/asura-base/FileSystem/File.h b/Source/modules/asura-base/FileSystem/File.h
index be772e0..3bb6067 100644
--- a/Source/modules/asura-base/FileSystem/File.h
+++ b/Source/modules/asura-base/FileSystem/File.h
@@ -8,139 +8,104 @@
#include "FileData.h"
-namespace AsuraEngine
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
+
+///
+/// ʽļָд㡢Сʹȡʱʹñ࣬ʹFilesystem.read()ֱӶȡļȫ
+/// ݣһFileData
+///
+class File ASURA_FINAL : public AEScripting::Portable<File>
{
- namespace FileSystem
- {
+public:
+
+ LUAX_DECL_FACTORY(File);
- ///
- /// ʽļָд㡢Сʹȡʱʹñ࣬ʹFilesystem.read()ֱӶȡļȫ
- /// ݣһFileData
- ///
- class File ASURA_FINAL
- : public AEScripting::Portable<File>
- {
- public:
-
- LUAX_DECL_FACTORY(File);
-
- ///
- /// ļдģʽ
- ///
- enum FileMode
- {
- FILE_MODE_CLOSED,
- FILE_MODE_READ,
- FILE_MODE_WRITE,
- FILE_MODE_APPEND,
- };
-
- ///
- /// ļдʱΪ
- ///
- enum BufferMode
- {
- BUFFER_MODE_NONE, ///< ʹû壬дļ
- BUFFER_MODE_LINE, ///< л壬зߴﵽСʱдļ
- BUFFER_MODE_FULL, ///< ȫ壬ʱдļ
- };
-
- File(const std::string& filename);
- ~File();
-
- bool Open(FileMode mode);
- bool Close();
- bool IsOpen();
- FileMode GetMode();
- size_t GetSize();
-
- ///
- /// ȡdata bufferض
- ///
- size_t Read(ASURA_OUT DataBuffer* dst, size_t length);
- size_t ReadAll(ASURA_OUT DataBuffer* dst);
- size_t ReadAsync(ASURA_OUT DataBuffer* dst);
-
- ///
- /// Ƿļβ
- ///
- bool IsEOF();
-
- ///
- /// data bufferед룬Ƿɹ
- ///
- bool Write(ASURA_REF DataBuffer* src);
-
- ///
- /// 첽дļдļtaskthreadĶС
- ///
- bool WriteAsync(ASURA_REF DataBuffer* src, AEThreading::Thread* thread);
-
- ///
- /// ˻壬ǿջдļ
- ///
- bool Flush();
-
- ///
- /// صǰдλ
- ///
- size_t Tell();
-
- ///
- /// Ӧλ
- ///
- bool Seek(size_t pos);
-
- ///
- /// ûСģʽ
- ///
- bool SetBuffer(BufferMode mode, size_t size);
-
- ///
- /// ȡСģʽ
- ///
- BufferMode GetBuffer(ASURA_OUT size_t& size);
-
- const std::string& GetFileName();
- const std::string& GetName();
- const std::string& GetExtension();
-
- private:
-
- PHYSFS_File* m_FileHandle; ///< physfs ļ
- std::string m_FileName; ///< ļ
- std::string m_Extension; ///< չ
- std::string m_Name; ///< չļ
- FileMode m_Mode; ///< ļģʽ
- BufferMode m_BufferMode; ///< д뻺ģʽ
- size_t m_BufferSize; ///< д뻺С
-
- LUAX_DECL_ENUM(FileMode);
- LUAX_DECL_ENUM(BufferMode);
-
- LUAX_DECL_METHOD(_New);
- LUAX_DECL_METHOD(_Open);
- LUAX_DECL_METHOD(_Close);
- LUAX_DECL_METHOD(_IsOpen);
- LUAX_DECL_METHOD(_GetMode);
- LUAX_DECL_METHOD(_GetSize);
- LUAX_DECL_METHOD(_Read);
- LUAX_DECL_METHOD(_Write);
- LUAX_DECL_METHOD(_ReadAsync);
- LUAX_DECL_METHOD(_WriteAsync);
- LUAX_DECL_METHOD(_IsEOF);
- LUAX_DECL_METHOD(_Flush);
- LUAX_DECL_METHOD(_Tell);
- LUAX_DECL_METHOD(_Seek);
- LUAX_DECL_METHOD(_SetBuffer);
- LUAX_DECL_METHOD(_GetBuffer);
- LUAX_DECL_METHOD(_GetFileName);
- LUAX_DECL_METHOD(_GetExtension);
- LUAX_DECL_METHOD(_GetName);
-
- };
-
- }
-}
+ /// ļдģʽ
+ enum FileMode
+ {
+ FILE_MODE_CLOSED,
+ FILE_MODE_READ,
+ FILE_MODE_WRITE,
+ FILE_MODE_APPEND,
+ };
+
+ /// ļдʱΪ
+ enum BufferMode
+ {
+ BUFFER_MODE_NONE, ///< ʹû壬дļ
+ BUFFER_MODE_LINE, ///< л壬зߴﵽСʱдļ
+ BUFFER_MODE_FULL, ///< ȫ壬ʱдļ
+ };
+
+ File(const std::string& filename);
+ ~File();
+
+ bool Open(FileMode mode);
+ bool Close();
+ bool IsOpen();
+ FileMode GetMode();
+ size_t GetSize();
+
+ size_t Read(ASURA_OUT DataBuffer* dst, size_t length);
+ size_t ReadAll(ASURA_OUT DataBuffer* dst);
+ size_t ReadAsync(ASURA_OUT DataBuffer* dst);
+
+ bool IsEOF();
+
+ bool Write(ASURA_REF DataBuffer* src);
+ bool WriteAsync(ASURA_REF DataBuffer* src, AEThreading::Thread* thread);
+
+ bool Flush();
+
+ size_t Tell();
+
+ bool Seek(size_t pos);
+
+ bool SetBuffer(BufferMode mode, size_t size);
+
+ BufferMode GetBuffer(ASURA_OUT size_t& size);
+
+ const std::string& GetFileName();
+ const std::string& GetName();
+ const std::string& GetExtension();
+
+private:
+
+ PHYSFS_File* m_FileHandle; ///< physfs ļ
+ std::string m_FileName; ///< ļ
+ std::string m_Extension; ///< չ
+ std::string m_Name; ///< չļ
+ FileMode m_Mode; ///< ļģʽ
+ BufferMode m_BufferMode; ///< д뻺ģʽ
+ size_t m_BufferSize; ///< д뻺С
+
+ LUAX_DECL_ENUM(FileMode);
+ LUAX_DECL_ENUM(BufferMode);
+
+ LUAX_DECL_METHOD(_New);
+ LUAX_DECL_METHOD(_Open);
+ LUAX_DECL_METHOD(_Close);
+ LUAX_DECL_METHOD(_IsOpen);
+ LUAX_DECL_METHOD(_GetMode);
+ LUAX_DECL_METHOD(_GetSize);
+ LUAX_DECL_METHOD(_Read);
+ LUAX_DECL_METHOD(_Write);
+ LUAX_DECL_METHOD(_ReadAsync);
+ LUAX_DECL_METHOD(_WriteAsync);
+ LUAX_DECL_METHOD(_IsEOF);
+ LUAX_DECL_METHOD(_Flush);
+ LUAX_DECL_METHOD(_Tell);
+ LUAX_DECL_METHOD(_Seek);
+ LUAX_DECL_METHOD(_SetBuffer);
+ LUAX_DECL_METHOD(_GetBuffer);
+ LUAX_DECL_METHOD(_GetFileName);
+ LUAX_DECL_METHOD(_GetExtension);
+ LUAX_DECL_METHOD(_GetName);
+
+};
+
+namespace_end
+namespace_end
#endif \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/FileData.cpp b/Source/modules/asura-base/FileSystem/FileData.cpp
index b29a95b..6caedad 100644
--- a/Source/modules/asura-base/FileSystem/FileData.cpp
+++ b/Source/modules/asura-base/FileSystem/FileData.cpp
@@ -1,59 +1,57 @@
#include "FileData.h"
-namespace AsuraEngine
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
+
+FileData::FileData(const std::string& filename)
+ : m_Data(nullptr)
+ , m_FileName(filename)
{
- namespace FileSystem
+ size_t dot = filename.rfind('.');
+ if (dot != std::string::npos)
{
+ m_Extension = filename.substr(dot + 1);
+ m_Name = filename.substr(0, dot);
+ }
+ else
+ m_Name = filename;
+}
- FileData::FileData(const std::string& filename)
- : m_Data(nullptr)
- , m_FileName(filename)
- {
- size_t dot = filename.rfind('.');
- if (dot != std::string::npos)
- {
- m_Extension = filename.substr(dot + 1);
- m_Name = filename.substr(0, dot);
- }
- else
- m_Name = filename;
- }
-
- FileData::~FileData()
- {
- if (m_Data)
- m_Data->Release();
- }
-
- const std::string& FileData::GetFileName()
- {
- return m_FileName;
- }
-
- const std::string& FileData::GetExtension()
- {
- return m_Extension;
- }
-
- const std::string& FileData::GetName()
- {
- return m_Name;
- }
-
- void FileData::BindData(ASURA_MOVE DataBuffer* buffer)
- {
- if (!buffer)
- return;
- if (m_Data)
- m_Data->Release();
- m_Data = buffer;
- m_Data->Retain();
- }
-
- DataBuffer* FileData::GetDataBuffer()
- {
- return m_Data;
- }
+FileData::~FileData()
+{
+ if (m_Data)
+ m_Data->Release();
+}
- }
-} \ No newline at end of file
+const std::string& FileData::GetFileName()
+{
+ return m_FileName;
+}
+
+const std::string& FileData::GetExtension()
+{
+ return m_Extension;
+}
+
+const std::string& FileData::GetName()
+{
+ return m_Name;
+}
+
+void FileData::BindData(ASURA_MOVE DataBuffer* buffer)
+{
+ if (!buffer)
+ return;
+ if (m_Data)
+ m_Data->Release();
+ m_Data = buffer;
+ m_Data->Retain();
+}
+
+DataBuffer* FileData::GetDataBuffer()
+{
+ return m_Data;
+}
+
+namespace_end
+namespace_end \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/FileData.h b/Source/modules/asura-base/FileSystem/FileData.h
index d0acd26..e79d42c 100644
--- a/Source/modules/asura-base/FileSystem/FileData.h
+++ b/Source/modules/asura-base/FileSystem/FileData.h
@@ -7,63 +7,61 @@
#include "DataBuffer.h"
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
- class Filesystem;
+class Filesystem;
- ///
- /// filesystemֱӶȡļʱFileDataļݺϢFilesystem
- ///
- class FileData ASURA_FINAL
- : public AEScripting::Portable<FileData>
- {
- public:
+///
+/// filesystemֱӶȡļʱFileDataļݺϢFilesystem
+///
+class FileData ASURA_FINAL
+ : public AEScripting::Portable<FileData>
+{
+public:
- LUAX_DECL_FACTORY(FileData);
+ LUAX_DECL_FACTORY(FileData);
- ~FileData();
+ ~FileData();
- ///
- /// ļݣͨDatabufferݺʹСڲӿڶData bufferΪҲdata buffer
- ///
- DataBuffer* GetDataBuffer();
+ ///
+ /// ļݣͨDatabufferݺʹСڲӿڶData bufferΪҲdata buffer
+ ///
+ DataBuffer* GetDataBuffer();
- const std::string& GetFileName();
- const std::string& GetExtension();
- const std::string& GetName();
+ const std::string& GetFileName();
+ const std::string& GetExtension();
+ const std::string& GetName();
- private:
+private:
- friend class FileManager;
+ friend class FileManager;
- FileData(const std::string& name);
+ FileData(const std::string& name);
- ///
- /// data buffer
- ///
- void BindData(ASURA_MOVE DataBuffer* buffer);
+ ///
+ /// data buffer
+ ///
+ void BindData(ASURA_MOVE DataBuffer* buffer);
- ///
- /// Data bufferfiledataʱ٣luaüΪ0ʱluaGC١mDataʱһԱá
- ///
- ASURA_REF DataBuffer* m_Data;
- Luax::LuaxMemberRef m_DataRef;
+ ///
+ /// Data bufferfiledataʱ٣luaüΪ0ʱluaGC١mDataʱһԱá
+ ///
+ ASURA_REF DataBuffer* m_Data;
+ Luax::LuaxMemberRef m_DataRef;
- std::string m_FileName; ///< չļ
- std::string m_Extension; ///< չ
- std::string m_Name; ///< ͺ׺ļ
+ std::string m_FileName; ///< չļ
+ std::string m_Extension; ///< չ
+ std::string m_Name; ///< ͺ׺ļ
- LUAX_DECL_METHOD(_GetDataBuffer);
- LUAX_DECL_METHOD(_GetFileName);
- LUAX_DECL_METHOD(_GetExtension);
- LUAX_DECL_METHOD(_GetName);
+ LUAX_DECL_METHOD(_GetDataBuffer);
+ LUAX_DECL_METHOD(_GetFileName);
+ LUAX_DECL_METHOD(_GetExtension);
+ LUAX_DECL_METHOD(_GetName);
- };
+};
- }
-}
+namespace_end
+namespace_end
#endif \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/FileManager.cpp b/Source/modules/asura-base/FileSystem/FileManager.cpp
index bdb4069..c845c9c 100644
--- a/Source/modules/asura-base/FileSystem/FileManager.cpp
+++ b/Source/modules/asura-base/FileSystem/FileManager.cpp
@@ -8,191 +8,189 @@
using namespace std;
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
#ifdef ASURA_WINDOWS
- #include <windows.h>
- #include <direct.h>
+#include <windows.h>
+#include <direct.h>
#else
- #include <sys/param.h>
- #include <unistd.h>
+#include <sys/param.h>
+#include <unistd.h>
#endif
- FileManager::~FileManager()
- {
- if (m_Inited) //PHYSFS_isInit
- PHYSFS_deinit();
- }
+FileManager::~FileManager()
+{
+ if (m_Inited) //PHYSFS_isInit
+ PHYSFS_deinit();
+}
- void FileManager::Init(const char* arg0)
- {
- if (!PHYSFS_init(arg0))
- throw Exception("Failed to initialize filesystem: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+void FileManager::Init(const char* arg0)
+{
+ if (!PHYSFS_init(arg0))
+ throw Exception("Failed to initialize filesystem: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
- m_Inited = true;
- }
+ m_Inited = true;
+}
- bool FileManager::Mount(const std::string& locpath, const std::string& montpoint/* = "/"*/, bool prepend /*= false*/)
- {
- if (!m_Inited)
- return false;
+bool FileManager::Mount(const std::string& locpath, const std::string& montpoint/* = "/"*/, bool prepend /*= false*/)
+{
+ if (!m_Inited)
+ return false;
- return PHYSFS_mount(locpath.c_str(), montpoint.c_str(), !prepend);
- }
+ return PHYSFS_mount(locpath.c_str(), montpoint.c_str(), !prepend);
+}
- bool FileManager::Mount(DataBuffer* db, const std::string& archivename, const std::string& mountpoint /*= "/"*/, bool prepend /*= false*/)
- {
- if (!m_Inited)
- return false;
- if (PHYSFS_mountMemory(db->GetData(), db->GetSize(), nullptr, archivename.c_str(), mountpoint.c_str(), !prepend))
- {
- m_MountData[archivename] = db;
- return true;
- }
- return false;
- }
+bool FileManager::Mount(DataBuffer* db, const std::string& archivename, const std::string& mountpoint /*= "/"*/, bool prepend /*= false*/)
+{
+ if (!m_Inited)
+ return false;
+ if (PHYSFS_mountMemory(db->GetData(), db->GetSize(), nullptr, archivename.c_str(), mountpoint.c_str(), !prepend))
+ {
+ m_MountData[archivename] = db;
+ return true;
+ }
+ return false;
+}
- bool FileManager::Unmount(const std::string& locpath)
- {
- if (!m_Inited)
- return false;
-
- // ǹ鵵ӳɾ
- auto datait = m_MountData.find(locpath);
- if (datait != m_MountData.end() && PHYSFS_unmount(locpath.c_str()) != 0)
- {
- m_MountData.erase(datait);
- return true;
- }
-
- return PHYSFS_unmount(locpath.c_str());
- }
+bool FileManager::Unmount(const std::string& locpath)
+{
+ if (!m_Inited)
+ return false;
- bool FileManager::Unmount(DataBuffer* db)
- {
- for (const auto& dp : m_MountData)
- {
- if (dp.second == db)
- {
- std::string archive = dp.first;
- return Unmount(archive);
- }
- }
- }
+ // ǹ鵵ӳɾ
+ auto datait = m_MountData.find(locpath);
+ if (datait != m_MountData.end() && PHYSFS_unmount(locpath.c_str()) != 0)
+ {
+ m_MountData.erase(datait);
+ return true;
+ }
- bool FileManager::GetMountPoint(const std::string& locpath, ASURA_OUT std::string& mountpoint)
- {
- if (!m_Inited)
- return false;
- const char* point = PHYSFS_getMountPoint(locpath.c_str());
- if (point != nullptr)
- {
- mountpoint = point;
- return true;
- }
- return false;
- }
+ return PHYSFS_unmount(locpath.c_str());
+}
- void FileManager::SetWriteDirectory(const std::string locpath)
+bool FileManager::Unmount(DataBuffer* db)
+{
+ for (const auto& dp : m_MountData)
+ {
+ if (dp.second == db)
{
- if (!m_Inited)
- return;
- if (!PHYSFS_setWriteDir(locpath.c_str()))
- throw Exception("Failed to set write directory %s", locpath.c_str());
+ std::string archive = dp.first;
+ return Unmount(archive);
}
+ }
+}
- std::string FileManager::GetWriteDirectory()
- {
- return PHYSFS_getWriteDir();
- }
+bool FileManager::GetMountPoint(const std::string& locpath, ASURA_OUT std::string& mountpoint)
+{
+ if (!m_Inited)
+ return false;
+ const char* point = PHYSFS_getMountPoint(locpath.c_str());
+ if (point != nullptr)
+ {
+ mountpoint = point;
+ return true;
+ }
+ return false;
+}
- File* FileManager::NewFile(const std::string& name)
- {
- return new File(name);
- }
+void FileManager::SetWriteDirectory(const std::string locpath)
+{
+ if (!m_Inited)
+ return;
+ if (!PHYSFS_setWriteDir(locpath.c_str()))
+ throw Exception("Failed to set write directory %s", locpath.c_str());
+}
- bool FileManager::NewDirectory(const std::string& path)
- {
- if (!m_Inited)
- return false;
- if (!PHYSFS_getWriteDir())
- return false;
- if (!PHYSFS_mkdir(path.c_str()))
- return false;
- return true;
- }
+std::string FileManager::GetWriteDirectory()
+{
+ return PHYSFS_getWriteDir();
+}
- bool FileManager::Write(const std::string& name, ASURA_REF DataBuffer* buffer)
- {
- File file(name);
- file.Open(File::FILE_MODE_WRITE);
- if (!file.Write(buffer))
- throw Exception("Data could not be written.");
- }
+File* FileManager::NewFile(const std::string& name)
+{
+ return new File(name);
+}
- bool FileManager::Append(const std::string& name, ASURA_REF DataBuffer* buffer)
- {
- File file(name);
- file.Open(File::FILE_MODE_APPEND);
- if (!file.Write(buffer))
- throw Exception("Data could not be append.");
- }
+bool FileManager::NewDirectory(const std::string& path)
+{
+ if (!m_Inited)
+ return false;
+ if (!PHYSFS_getWriteDir())
+ return false;
+ if (!PHYSFS_mkdir(path.c_str()))
+ return false;
+ return true;
+}
+
+bool FileManager::Write(const std::string& name, ASURA_REF DataBuffer* buffer)
+{
+ File file(name);
+ file.Open(File::FILE_MODE_WRITE);
+ if (!file.Write(buffer))
+ throw Exception("Data could not be written.");
+}
- FileData* FileManager::Read(const std::string& name)
- {
- File file = File(name);
- file.Open(File::FILE_MODE_READ);
- int size = file.GetSize();
- DataBuffer* db = new DataBuffer(size);
- if (db)
- {
- file.ReadAll(db);
- FileData* fd = new FileData(name);
- fd->BindData(db);
- return fd;
- }
- return nullptr;
- }
+bool FileManager::Append(const std::string& name, ASURA_REF DataBuffer* buffer)
+{
+ File file(name);
+ file.Open(File::FILE_MODE_APPEND);
+ if (!file.Write(buffer))
+ throw Exception("Data could not be append.");
+}
- bool FileManager::Remove(const std::string& path)
- {
- if (!m_Inited)
- return false;
- if (PHYSFS_getWriteDir() == 0)
- return false;
+FileData* FileManager::Read(const std::string& name)
+{
+ File file = File(name);
+ file.Open(File::FILE_MODE_READ);
+ int size = file.GetSize();
+ DataBuffer* db = new DataBuffer(size);
+ if (db)
+ {
+ file.ReadAll(db);
+ FileData* fd = new FileData(name);
+ fd->BindData(db);
+ return fd;
+ }
+ return nullptr;
+}
- if (!PHYSFS_delete(path.c_str()))
- return false;
+bool FileManager::Remove(const std::string& path)
+{
+ if (!m_Inited)
+ return false;
+ if (PHYSFS_getWriteDir() == 0)
+ return false;
- return true;
- }
+ if (!PHYSFS_delete(path.c_str()))
+ return false;
- bool FileManager::GetFileInfo(const std::string& filepath, ASURA_OUT FileInfo* info)
- {
- if (!m_Inited)
- return false;
-
- PHYSFS_Stat stat = {};
- if (!PHYSFS_stat(filepath.c_str(), &stat))
- return false;
-
- info->size = (int64)stat.filesize;
- info->modtime = (int64)stat.modtime;
-
- if (stat.filetype == PHYSFS_FILETYPE_REGULAR)
- info->type = FILE_TYPE_FILE;
- else if (stat.filetype == PHYSFS_FILETYPE_DIRECTORY)
- info->type = FILE_TYPE_DIRECTORY;
- else if (stat.filetype == PHYSFS_FILETYPE_SYMLINK)
- info->type = FILE_TYPE_SYMLINK;
- else
- info->type = FILE_TYPE_OTHER;
-
- return true;
- }
+ return true;
+}
- }
-} \ No newline at end of file
+bool FileManager::GetFileInfo(const std::string& filepath, ASURA_OUT FileInfo* info)
+{
+ if (!m_Inited)
+ return false;
+
+ PHYSFS_Stat stat = {};
+ if (!PHYSFS_stat(filepath.c_str(), &stat))
+ return false;
+
+ info->size = (int64)stat.filesize;
+ info->modtime = (int64)stat.modtime;
+
+ if (stat.filetype == PHYSFS_FILETYPE_REGULAR)
+ info->type = FILE_TYPE_FILE;
+ else if (stat.filetype == PHYSFS_FILETYPE_DIRECTORY)
+ info->type = FILE_TYPE_DIRECTORY;
+ else if (stat.filetype == PHYSFS_FILETYPE_SYMLINK)
+ info->type = FILE_TYPE_SYMLINK;
+ else
+ info->type = FILE_TYPE_OTHER;
+
+ return true;
+}
+
+namespace_end
+namespace_end \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/FileManager.h b/Source/modules/asura-base/FileSystem/FileManager.h
index ac97da3..2820321 100644
--- a/Source/modules/asura-base/FileSystem/FileManager.h
+++ b/Source/modules/asura-base/FileSystem/FileManager.h
@@ -11,101 +11,99 @@
#include "FileData.h"
#include "File.h"
-namespace AsuraEngine
-{
- namespace FileSystem
- {
-
- enum FileType
- {
- FILE_TYPE_FILE, ///< ļ
- FILE_TYPE_DIRECTORY, ///< ļ
- FILE_TYPE_SYMLINK, ///<
- FILE_TYPE_OTHER, ///<
- };
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
- struct FileInfo
- {
- int64 size;
- int64 modtime;
- FileType type;
- };
+enum FileType
+{
+ FILE_TYPE_FILE, ///< ļ
+ FILE_TYPE_DIRECTORY, ///< ļ
+ FILE_TYPE_SYMLINK, ///<
+ FILE_TYPE_OTHER, ///<
+};
- ///
- /// Դء洢ԴָĿ¼ȡ۱༭ʱҪƷʵĻƣûIJϷĿ¼
- /// £file systemµġFileManagerʱͱ༭õ࣬AssetDatabaseԴ࣬framework
- /// ʵ֣߼дFileManagerʵ֣AssetDatabaseṩļݴӦԴķ
- ///
- class FileManager ASURA_FINAL
- : public Singleton<FileManager>
- , public AEScripting::Portable<FileManager>
- {
- public:
+struct FileInfo
+{
+ int64 size;
+ int64 modtime;
+ FileType type;
+};
+
+///
+/// Դء洢ԴָĿ¼ȡ۱༭ʱҪƷʵĻƣûIJϷĿ¼
+/// £file systemµġFileManagerʱͱ༭õ࣬AssetDatabaseԴ࣬framework
+/// ʵ֣߼дFileManagerʵ֣AssetDatabaseṩļݴӦԴķ
+///
+class FileManager ASURA_FINAL
+ : public Singleton<FileManager>
+ , public AEScripting::Portable<FileManager>
+{
+public:
- LUAX_DECL_SINGLETON(FileManager);
+ LUAX_DECL_SINGLETON(FileManager);
- ~FileManager();
+ ~FileManager();
- void Init(const char* arg0);
+ void Init(const char* arg0);
- ///
- /// ǰִļļ
- ///
- std::string GetWorkingDirectory();
+ ///
+ /// ǰִļļ
+ ///
+ std::string GetWorkingDirectory();
- bool Mount(const std::string& locpath, const std::string& montpoint = "/", bool prepend = false);
- bool Mount(DataBuffer* db, const std::string& archivename, const std::string& mountpoint = "/", bool prepend = false);
+ bool Mount(const std::string& locpath, const std::string& montpoint = "/", bool prepend = false);
+ bool Mount(DataBuffer* db, const std::string& archivename, const std::string& mountpoint = "/", bool prepend = false);
- bool Unmount(const std::string& locpath);
- bool Unmount(DataBuffer* db);
+ bool Unmount(const std::string& locpath);
+ bool Unmount(DataBuffer* db);
- bool GetMountPoint(const std::string& locpath, ASURA_OUT std::string& mountpoint);
+ bool GetMountPoint(const std::string& locpath, ASURA_OUT std::string& mountpoint);
- void SetWriteDirectory(const std::string locpath);
- std::string GetWriteDirectory();
- File* NewFile(const std::string& name);
- bool NewDirectory(const std::string& path);
- bool Write(const std::string& path, ASURA_REF DataBuffer* buffer);
- bool Append(const std::string& path, ASURA_REF DataBuffer* buffer);
- bool Remove(const std::string& path);
+ void SetWriteDirectory(const std::string locpath);
+ std::string GetWriteDirectory();
+ File* NewFile(const std::string& name);
+ bool NewDirectory(const std::string& path);
+ bool Write(const std::string& path, ASURA_REF DataBuffer* buffer);
+ bool Append(const std::string& path, ASURA_REF DataBuffer* buffer);
+ bool Remove(const std::string& path);
- FileData* Read(const std::string& path);
- bool GetFileInfo(const std::string& path, ASURA_OUT FileInfo* info);
+ FileData* Read(const std::string& path);
+ bool GetFileInfo(const std::string& path, ASURA_OUT FileInfo* info);
- bool GetDirectoryItems(const std::string& path, ASURA_OUT std::vector<std::string>& items) { return false; };
+ bool GetDirectoryItems(const std::string& path, ASURA_OUT std::vector<std::string>& items) { return false; };
- private:
+private:
- typedef std::map<std::string, DataBuffer*> MountDataMap;
+ typedef std::map<std::string, DataBuffer*> MountDataMap;
- bool m_Inited; ///< Ƿʼɹ
- std::string m_Cwd; ///< ǰִļĹĿ¼
- MountDataMap m_MountData; ///< ·ѹĵӳ
+ bool m_Inited; ///< Ƿʼɹ
+ std::string m_Cwd; ///< ǰִļĹĿ¼
+ MountDataMap m_MountData; ///< ·ѹĵӳ
- LUAX_DECL_METHOD(_Init);
- LUAX_DECL_METHOD(_Mount);
- LUAX_DECL_METHOD(_Unmount);
- LUAX_DECL_METHOD(_GetMountPoint);
+ LUAX_DECL_METHOD(_Init);
+ LUAX_DECL_METHOD(_Mount);
+ LUAX_DECL_METHOD(_Unmount);
+ LUAX_DECL_METHOD(_GetMountPoint);
- LUAX_DECL_METHOD(_SetWriteDirectory);
- LUAX_DECL_METHOD(_GetWriteDirectory);
- LUAX_DECL_METHOD(_CreateFile);
- LUAX_DECL_METHOD(_CreateDirectory);
+ LUAX_DECL_METHOD(_SetWriteDirectory);
+ LUAX_DECL_METHOD(_GetWriteDirectory);
+ LUAX_DECL_METHOD(_CreateFile);
+ LUAX_DECL_METHOD(_CreateDirectory);
- LUAX_DECL_METHOD(_Write);
- LUAX_DECL_METHOD(_Append);
- LUAX_DECL_METHOD(_Remove);
+ LUAX_DECL_METHOD(_Write);
+ LUAX_DECL_METHOD(_Append);
+ LUAX_DECL_METHOD(_Remove);
- LUAX_DECL_METHOD(_Read);
+ LUAX_DECL_METHOD(_Read);
- LUAX_DECL_METHOD(_GetFileInfo);
+ LUAX_DECL_METHOD(_GetFileInfo);
- LUAX_DECL_METHOD(_GetDirectoryItems);
+ LUAX_DECL_METHOD(_GetDirectoryItems);
- };
+};
- }
-}
+namespace_end
+namespace_end
namespace AEFileSystem = AsuraEngine::FileSystem;
diff --git a/Source/modules/asura-base/FileSystem/IOBatchTask.h b/Source/modules/asura-base/FileSystem/IOBatchTask.h
index 8d73e93..d82d83d 100644
--- a/Source/modules/asura-base/FileSystem/IOBatchTask.h
+++ b/Source/modules/asura-base/FileSystem/IOBatchTask.h
@@ -3,29 +3,27 @@
#include "IOTask.h"
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
- ///
- /// дһύһtableδ󷵻ؽ
- ///
- class IOBatchTask ASURA_FINAL : public AEThreading::Task
- {
- public:
+///
+/// дһύһtableδ󷵻ؽ
+///
+class IOBatchTask ASURA_FINAL : public AEThreading::Task
+{
+public:
- private:
+private:
- ///
- /// ÿһĽṹ£
- /// { path = "", }
- ///
- Luax::LuaxMemberRef m_Tasks;
+ ///
+ /// ÿһĽṹ£
+ /// { path = "", }
+ ///
+ Luax::LuaxMemberRef m_Tasks;
- };
+};
- }
-}
+namespace_end
+namespace_end
#endif \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/IOTask.cpp b/Source/modules/asura-base/FileSystem/IOTask.cpp
index 9152a6e..493ee9f 100644
--- a/Source/modules/asura-base/FileSystem/IOTask.cpp
+++ b/Source/modules/asura-base/FileSystem/IOTask.cpp
@@ -6,56 +6,54 @@
using namespace AEScripting;
using namespace Luax;
-namespace AsuraEngine
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
+
+IOTask::IOTask(const std::string& path, DataBuffer* buffer, IOTaskType type)
+ : m_Path(path)
+ , m_Buffer(buffer)
{
- namespace FileSystem
- {
+ if (buffer)
+ buffer->Retain();
+}
- IOTask::IOTask(const std::string& path, DataBuffer* buffer, IOTaskType type)
- : m_Path(path)
- , m_Buffer(buffer)
- {
- if (buffer)
- buffer->Retain();
- }
+IOTask::~IOTask()
+{
+ if (m_Buffer)
+ m_Buffer->Release();
+}
- IOTask::~IOTask()
- {
- if (m_Buffer)
- m_Buffer->Release();
- }
+bool IOTask::Execute()
+{
+ File file(m_Path);
+ if (m_Type == IOTASK_TYPE_WRITE)
+ {
- bool IOTask::Execute()
- {
- File file(m_Path);
- if (m_Type == IOTASK_TYPE_WRITE)
- {
-
- }
- // pathȡݱmBuffer
- else if (m_Type == IOTASK_TYPE_READ)
- {
- if (!m_Buffer)
- return false;
- file.Open(File::FILE_MODE_READ);
- file.ReadAll(m_Buffer);
- file.Close();
- }
- return true;
- }
+ }
+ // pathȡݱmBuffer
+ else if (m_Type == IOTASK_TYPE_READ)
+ {
+ if (!m_Buffer)
+ return false;
+ file.Open(File::FILE_MODE_READ);
+ file.ReadAll(m_Buffer);
+ file.Close();
+ }
+ return true;
+}
- void IOTask::Invoke(lua_State* invokeThreaad)
+void IOTask::Invoke(lua_State* invokeThreaad)
+{
+ if (m_Callback)
+ {
+ LuaxScopedState state(invokeThreaad);
+ if (this->PushLuaxMemberRef(state, m_Callback))
{
- if (m_Callback)
- {
- LuaxScopedState state(invokeThreaad);
- if (this->PushLuaxMemberRef(state, m_Callback))
- {
- this->PushLuaxMemberRef(state, m_BufferRef);
- state.Call(1, 0);
- }
- }
+ this->PushLuaxMemberRef(state, m_BufferRef);
+ state.Call(1, 0);
}
-
}
}
+
+namespace_end
+namespace_end \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/IOTask.h b/Source/modules/asura-base/FileSystem/IOTask.h
index da54fdc..c2a22ba 100644
--- a/Source/modules/asura-base/FileSystem/IOTask.h
+++ b/Source/modules/asura-base/FileSystem/IOTask.h
@@ -8,49 +8,47 @@
#include "DataBuffer.h"
-namespace AsuraEngine
-{
- namespace FileSystem
- {
-
- enum IOTaskType
- {
- IOTASK_TYPE_READ,
- IOTASK_TYPE_WRITE,
- IOTASK_TYPE_APPEND,
- };
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
- ///
- /// ȡļ
- ///
- class IOTask ASURA_FINAL
- : public AEScripting::Portable<IOTask, AEThreading::Task>
- {
- public:
+enum IOTaskType
+{
+ IOTASK_TYPE_READ,
+ IOTASK_TYPE_WRITE,
+ IOTASK_TYPE_APPEND,
+};
+
+///
+/// ȡļ
+///
+class IOTask ASURA_FINAL
+ : public AEScripting::Portable<IOTask, AEThreading::Task>
+{
+public:
- LUAX_DECL_FACTORY(IOTask);
+ LUAX_DECL_FACTORY(IOTask);
- IOTask(const std::string& path, DataBuffer* buffer, IOTaskType type);
- ~IOTask();
+ IOTask(const std::string& path, DataBuffer* buffer, IOTaskType type);
+ ~IOTask();
- bool Execute() override ;
- void Invoke(lua_State* invokeThreaad) override;
+ bool Execute() override ;
+ void Invoke(lua_State* invokeThreaad) override;
- private:
+private:
- LUAX_DECL_ENUM(IOTaskType);
+ LUAX_DECL_ENUM(IOTaskType);
- LUAX_DECL_METHOD(_New);
+ LUAX_DECL_METHOD(_New);
- std::string m_Path;
- IOTaskType m_Type;
+ std::string m_Path;
+ IOTaskType m_Type;
- DataBuffer* m_Buffer;
- Luax::LuaxMemberRef m_BufferRef;
+ DataBuffer* m_Buffer;
+ Luax::LuaxMemberRef m_BufferRef;
- };
+};
- }
-}
+namespace_end
+namespace_end
#endif \ No newline at end of file
diff --git a/Source/modules/asura-base/FileSystem/Renewable.h b/Source/modules/asura-base/FileSystem/Renewable.h
index ff44303..1be3a88 100644
--- a/Source/modules/asura-base/FileSystem/Renewable.h
+++ b/Source/modules/asura-base/FileSystem/Renewable.h
@@ -3,24 +3,22 @@
#include "DecodedData.h"
-namespace AsuraEngine
-{
- namespace FileSystem
- {
+namespace_begin(AsuraEngine)
+namespace_begin(FileSystem)
- ///
- /// ¹ݽṹͼƬƵ֣ӽݿֱӹڱ༭
- /// ¹޸handleֵı䲻߱ƻԣڲıhandleԴ
- ///
- ASURA_ABSTRACT class Renewable
- {
- public:
- Renewable() {};
- virtual ~Renewable() {};
- };
+///
+/// ¹ݽṹͼƬƵ֣ӽݿֱӹڱ༭
+/// ¹޸handleֵı䲻߱ƻԣڲıhandleԴ
+///
+ASURA_ABSTRACT class Renewable
+{
+public:
+ Renewable() {};
+ virtual ~Renewable() {};
+};
- }
-}
+namespace_end
+namespace_end
namespace AEFileSystem = AsuraEngine::FileSystem;
diff --git a/bin/win64/01-window.exe b/bin/win64/01-window.exe
index 190a0a7..70db8e5 100644
--- a/bin/win64/01-window.exe
+++ b/bin/win64/01-window.exe
Binary files differ
diff --git a/bin/win64/SDL2.dll b/bin/win64/SDL2.dll
index becc4ba..8f849cd 100644
--- a/bin/win64/SDL2.dll
+++ b/bin/win64/SDL2.dll
Binary files differ
diff --git a/build/Asura.Editor/Asura.Editor.vcxproj b/build/Asura.Editor/Asura.Editor.vcxproj
index d2d7a5c..d214c2e 100644
--- a/build/Asura.Editor/Asura.Editor.vcxproj
+++ b/build/Asura.Editor/Asura.Editor.vcxproj
@@ -155,9 +155,9 @@
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUILabel.h" />
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUIPanel.h" />
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUISlider.h" />
+ <ClInclude Include="..\..\Source\Asura.Editor\Controls\GUIState.h" />
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUIToggle.h" />
<ClInclude Include="..\..\source\Asura.Editor\Controls\TextUtil.h" />
- <ClInclude Include="..\..\source\Asura.Editor\Core\GUIState.h" />
<ClInclude Include="..\..\source\Asura.Editor\Editor.h" />
<ClInclude Include="..\..\source\Asura.Editor\Graphics\Brush.h" />
<ClInclude Include="..\..\source\Asura.Editor\Graphics\Drawer.h" />
diff --git a/build/Asura.Editor/Asura.Editor.vcxproj.filters b/build/Asura.Editor/Asura.Editor.vcxproj.filters
index ef9bd0f..bc89328 100644
--- a/build/Asura.Editor/Asura.Editor.vcxproj.filters
+++ b/build/Asura.Editor/Asura.Editor.vcxproj.filters
@@ -109,9 +109,6 @@
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUIToggle.h">
<Filter>Controls</Filter>
</ClInclude>
- <ClInclude Include="..\..\source\Asura.Editor\Core\GUIState.h">
- <Filter>Core</Filter>
- </ClInclude>
<ClInclude Include="..\..\source\Asura.Editor\Graphics\Brush.h">
<Filter>Graphics</Filter>
</ClInclude>
@@ -162,5 +159,8 @@
<ClInclude Include="..\..\source\Asura.Editor\Controls\GUIClip.h">
<Filter>Controls</Filter>
</ClInclude>
+ <ClInclude Include="..\..\Source\Asura.Editor\Controls\GUIState.h">
+ <Filter>Controls</Filter>
+ </ClInclude>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/source/Asura.Editor/Controls/GUIButton.h b/source/Asura.Editor/Controls/GUIButton.h
index e1199db..47da571 100644
--- a/source/Asura.Editor/Controls/GUIButton.h
+++ b/source/Asura.Editor/Controls/GUIButton.h
@@ -2,13 +2,14 @@
#define _ASURA_EDITOR_GUI_BUTTON_H_
#include <asura-base/Classes.h>
+#include <asura-base/Type.h>
namespace_begin(AsuraEditor)
+bool GUIButton(int controlID);
bool GUIButton();
-
namespace_end
-#endif
+#endif \ No newline at end of file
diff --git a/source/Asura.Editor/Controls/GUIContent.h b/source/Asura.Editor/Controls/GUIContent.h
index 88213f4..034aa42 100644
--- a/source/Asura.Editor/Controls/GUIContent.h
+++ b/source/Asura.Editor/Controls/GUIContent.h
@@ -8,10 +8,14 @@ namespace_begin(AsuraEditor)
/// IMGUI content
class GUIContent
{
+public:
+
+ GUIContent();
+ ~GUIContent();
};
namespace_end
-#endif
+#endif \ No newline at end of file
diff --git a/source/Asura.Editor/Controls/GUIPanel.h b/source/Asura.Editor/Controls/GUIPanel.h
index 105edde..0f98eaa 100644
--- a/source/Asura.Editor/Controls/GUIPanel.h
+++ b/source/Asura.Editor/Controls/GUIPanel.h
@@ -8,9 +8,17 @@ namespace_begin(AsuraEditor)
/// IMGUI panel
class GUIPanel
{
+public:
+
+ GUIPanel();
+ ~GUIPanel();
+
+private:
+
+
};
namespace_end
-#endif
+#endif \ No newline at end of file
diff --git a/source/Asura.Editor/Core/GUIState.h b/source/Asura.Editor/Core/GUIState.h
deleted file mode 100644
index b4fce49..0000000
--- a/source/Asura.Editor/Core/GUIState.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ASURA_EDITOR_GUI_STATE_H_
-#define _ASURA_EDITOR_GUI_STATE_H_
-
-#include <asura-base/Classes.h>
-
-namespace_begin(AsuraEditor)
-
-/// GUI widgets uniqueID
-class GUIState
-{
-public:
-
- inline int GetDepth() { return m_Depth; };
-
-private:
-
- int m_Depth;
- bool m_Changed;
-
-};
-
-extern GUIState g_GUIState;
-
-namespace_end
-
-
-#endif \ No newline at end of file