From 72bad342ad75294ae85aac8b2e2e7bea54193c15 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 31 Mar 2019 19:59:58 +0800 Subject: *misc --- build/modules/asura-utils/asura-utils.vcxproj | 4 +-- source/3rd-party/Luax/luax_class.hpp | 6 +++- source/modules/asura-core/application.cpp | 3 -- .../asura-core/graphics/binding/_color32.cpp | 27 ++------------- .../modules/asura-core/graphics/binding/_image.cpp | 2 +- source/modules/asura-core/graphics/image.h | 2 +- source/modules/asura-core/graphics/shader.h | 2 +- source/modules/asura-core/wnd/window.h | 4 +-- source/modules/asura-core/wnd/window_impl_sdl.cpp | 8 ++++- source/modules/asura-core/wnd/window_impl_sdl.h | 18 ++++++---- source/modules/asura-utils/io/reloadable.h | 33 ------------------- source/modules/asura-utils/io/renewable.h | 38 ++++++++++++++++++++++ source/modules/asura-utils/threading/mutex.h | 5 ++- 13 files changed, 75 insertions(+), 77 deletions(-) delete mode 100644 source/modules/asura-utils/io/reloadable.h create mode 100644 source/modules/asura-utils/io/renewable.h diff --git a/build/modules/asura-utils/asura-utils.vcxproj b/build/modules/asura-utils/asura-utils.vcxproj index ad005d9..98f526f 100644 --- a/build/modules/asura-utils/asura-utils.vcxproj +++ b/build/modules/asura-utils/asura-utils.vcxproj @@ -1,4 +1,4 @@ - + @@ -168,7 +168,7 @@ - + diff --git a/source/3rd-party/Luax/luax_class.hpp b/source/3rd-party/Luax/luax_class.hpp index e056b75..dd9414a 100644 --- a/source/3rd-party/Luax/luax_class.hpp +++ b/source/3rd-party/Luax/luax_class.hpp @@ -84,6 +84,10 @@ namespace Luax /// Ðé»ùÀ࣬ΪÁËʵÏÖ¶à̬¡£ÐèÒª·ÃÎÊÏÂÃæÕâЩ½Ó¿ÚµÄÍⲿ»ùÀàÐèÒªÐé¼Ì³Ð´ËÀ֮࣬ºóÔÙÅÉÉúÁ´Öоͻá /// µ÷ÓöÔӦʵÌåµÄ·½·¨¡£×¢Òâ¼Ì³Ð´ËÀàʱ²»ÄÜʵÏÖÏÂÃæµÄ·½·¨£¬ÊµÏÖÔÚLuaxNativeClassÖУ¬ÊµÏÖ»á /// µ¼Ö¶þÒåÐÔ¡£ + /// + /// ÒÀ¾ÝEffective C++Ìõ¿î40£¬Èç¹ûÔÚ±ØÐëʹÓÃvirtual base»ùÀàÇé¿öÏ£¬Ó¦¸Ã¾¡¿ÉÄܱÜÃâÏòÆäÖзŠ+ /// ÖÃÊý¾Ý³ÉÔ±£¬¹æ±ÜÊý¾Ý³ÉÔ±³õʼ»¯Ôì³ÉµÄһЩÒþÐÔÎÊÌâ¡£ÒÀ¾ÝÕâÒ»µã£¬vpb»ùÀà¸ü¼Ó½Ó½üC#ºÍJavaÖÐ + /// µÄInterface¡£ËùÒÔ£¬ÔÚÕâÀï°ÑÀàÓÃI¿ªÍ·±êʶÕâÊÇÒ»¸ö½Ó¿Ú¡£ /// class ILuaxNativeAccessor { @@ -105,7 +109,7 @@ namespace Luax /// ¶à¸öÏß³ÌÖÐÐèҪȷ¶¨²»»áÎóÊÍ·Å¡£ /// template - class LuaxNativeClass : public virtual ILuaxNativeAccessor + class LuaxNativeClass : virtual public ILuaxNativeAccessor { public: diff --git a/source/modules/asura-core/application.cpp b/source/modules/asura-core/application.cpp index 0a1c1ef..1ef9414 100644 --- a/source/modules/asura-core/application.cpp +++ b/source/modules/asura-core/application.cpp @@ -1,6 +1,3 @@ -#include "Sdl2/SDL.h" -#include "Exceptions/Exception.h" -#include "Scripting/Luax.hpp" #include "Application.h" using namespace Luax; diff --git a/source/modules/asura-core/graphics/binding/_color32.cpp b/source/modules/asura-core/graphics/binding/_color32.cpp index 7095866..ad7dad5 100644 --- a/source/modules/asura-core/graphics/binding/_color32.cpp +++ b/source/modules/asura-core/graphics/binding/_color32.cpp @@ -14,10 +14,7 @@ namespace AsuraEngine { "GetRed", _GetRed }, { "GetGreen", _GetGreen }, { "GetBlue", _GetBlue }, - { "GetAlpha", _GetAlpha }, - { "Multiply", _Multiply }, - { "Index", _Index }, - { "NewIndex", _NewIndex } + { "GetAlpha", _GetAlpha } ); } @@ -61,26 +58,6 @@ namespace AsuraEngine } - // color32:Multiply() - LUAX_IMPL_METHOD(Color32, _Multiply) - { - LUAX_PREPARE(L, Color32); - - } - - // color32:Index() - LUAX_IMPL_METHOD(Color32, _Index) - { - LUAX_PREPARE(L, Color32); - - } - - // color32:NewIndex() - LUAX_IMPL_METHOD(Color32, _NewIndex) - { - LUAX_PREPARE(L, Color32); - - } - } } + \ No newline at end of file diff --git a/source/modules/asura-core/graphics/binding/_image.cpp b/source/modules/asura-core/graphics/binding/_image.cpp index cc9a669..407ada7 100644 --- a/source/modules/asura-core/graphics/binding/_image.cpp +++ b/source/modules/asura-core/graphics/binding/_image.cpp @@ -54,7 +54,7 @@ namespace AsuraEngine state.Push(self->GetWidth()); return 1; } - + // height = image:GetHeight() LUAX_IMPL_METHOD(Image, _GetHeight) { diff --git a/source/modules/asura-core/graphics/image.h b/source/modules/asura-core/graphics/image.h index 06108ed..2424ebb 100644 --- a/source/modules/asura-core/graphics/image.h +++ b/source/modules/asura-core/graphics/image.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/source/modules/asura-core/graphics/shader.h b/source/modules/asura-core/graphics/shader.h index df0fcca..ae24548 100644 --- a/source/modules/asura-core/graphics/shader.h +++ b/source/modules/asura-core/graphics/shader.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include #include diff --git a/source/modules/asura-core/wnd/window.h b/source/modules/asura-core/wnd/window.h index 1ecb934..eb8a574 100644 --- a/source/modules/asura-core/wnd/window.h +++ b/source/modules/asura-core/wnd/window.h @@ -134,8 +134,8 @@ namespace AsuraEngine virtual void SetPosition(int x, int y) = 0; virtual void SetTitils(const std::string& title) = 0; - virtual void Show(); - virtual void Hide(); + virtual void Show() = 0; + virtual void Hide() = 0; virtual void SwapRenderBuffer() = 0; diff --git a/source/modules/asura-core/wnd/window_impl_sdl.cpp b/source/modules/asura-core/wnd/window_impl_sdl.cpp index bbbef9a..e608b8b 100644 --- a/source/modules/asura-core/wnd/window_impl_sdl.cpp +++ b/source/modules/asura-core/wnd/window_impl_sdl.cpp @@ -1,3 +1,7 @@ +#include "../core_config.h" + +#if ASURA_WINDOW_SDL + #include #include @@ -138,4 +142,6 @@ namespace AsuraEngine } } -} \ No newline at end of file +} + +#endif // ASURA_WINDOW_SDL \ No newline at end of file diff --git a/source/modules/asura-core/wnd/window_impl_sdl.h b/source/modules/asura-core/wnd/window_impl_sdl.h index 03e6579..0e81c0a 100644 --- a/source/modules/asura-core/wnd/window_impl_sdl.h +++ b/source/modules/asura-core/wnd/window_impl_sdl.h @@ -1,6 +1,10 @@ #ifndef __ASURA_WINDOW_SDL_H_ #define __ASURA_WINDOW_SDL_H_ +#include "../core_config.h" + +#if ASURA_WINDOW_SDL + #include #include "window.h" @@ -17,14 +21,14 @@ namespace AsuraEngine WindowImplSDL(const WindowConfig& config); ~WindowImplSDL(); - void SetSize(uint width, uint height); - void SetPosition(int x, int y); - void SetTitils(const std::string& title); + void SetSize(uint width, uint height) override; + void SetPosition(int x, int y) override; + void SetTitils(const std::string& title) override; - void Show(); - void Hide(); + void Show() override; + void Hide() override; - void SwapRenderBuffer(); + void SwapRenderBuffer() override; private: @@ -36,4 +40,6 @@ namespace AsuraEngine } } +#endif // ASURA_WINDOW_SDL + #endif \ No newline at end of file diff --git a/source/modules/asura-utils/io/reloadable.h b/source/modules/asura-utils/io/reloadable.h deleted file mode 100644 index c3b89ac..0000000 --- a/source/modules/asura-utils/io/reloadable.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __ASURA_ENGINE_RENEWABLE_H__ -#define __ASURA_ENGINE_RENEWABLE_H__ - -#include "../scripting/portable.hpp" - -namespace AsuraEngine -{ - namespace IO - { - - /// - /// ¿ÉÒÔÖØÐ¹¹½¨µÄÊý¾Ý½á¹¹¡£±ÈÈçͼƬ¡¢ÒôƵÕâÖÖ£¬´Ó½âÎöºóÊý¾Ý¿ÉÒÔÖ±½Ó¹¹½¨£¬¿ÉÒÔÔڱ༭Æ÷ÄÚÖØ - /// й¹½¨£¬²»»áÐÞ¸ÄhandleÖµ£¬¸Ä±ä²»¾ß±¸ÆÆ»µÐÔ£¬ÊÊÓÃÓÚ²»¸Ä±ähandleµÄ×ÊÔ´¡£ - /// - ASURA_ABSTRACT class Renewable - { - public: - Renewable(); - virtual ~ Renewable(); - - /// - /// ¼Ì³ÐRenewableµÄÐèÒªÌṩһ¸öRefresh·½·¨ - /// - virtual bool Refresh(AEIO::DecodedData* decode_data) = 0; - - }; - - } -} - -namespace AEIO = AsuraEngine::IO; - -#endif \ No newline at end of file diff --git a/source/modules/asura-utils/io/renewable.h b/source/modules/asura-utils/io/renewable.h new file mode 100644 index 0000000..769bdf6 --- /dev/null +++ b/source/modules/asura-utils/io/renewable.h @@ -0,0 +1,38 @@ +#ifndef __ASURA_ENGINE_RENEWABLE_H__ +#define __ASURA_ENGINE_RENEWABLE_H__ + +#include "../scripting/portable.hpp" + +#include "decoded_data.h" + +namespace AsuraEngine +{ + namespace IO + { + + /// + /// ¿ÉÒÔÖØÐ¹¹½¨µÄÊý¾Ý½á¹¹¡£±ÈÈçͼƬ¡¢ÒôƵÕâÖÖ£¬´Ó½âÎöºóÊý¾Ý¿ÉÒÔÖ±½Ó¹¹½¨£¬¿ÉÒÔÔڱ༭Æ÷ÄÚÖØ + /// й¹½¨£¬²»»áÐÞ¸ÄhandleÖµ£¬¸Ä±ä²»¾ß±¸ÆÆ»µÐÔ£¬ÊÊÓÃÓÚ²»¸Ä±ähandleµÄ×ÊÔ´¡£ + /// + ASURA_ABSTRACT class Renewable + { + public: + Renewable(); + virtual ~ Renewable(); + + /// + /// ¼Ì³ÐRenewableµÄÐèÒªÌṩһ¸öRefresh·½·¨ + /// + /// ÒÀ¾ÝEffective C++Ìõ¿î09.Ó¦¸Ã½ûÖ¹ÔÚ¹¹Ô캯ÊýÖе÷ÓÃvirtual·½·¨£¬ËùÒÔÕâÀïµÄRefresh + /// ±»´Ó¹¹Ô캯ÊýÖгéÀ룬ÐèÒªÊÖ¶¯µ÷ÓÃRefresh¡£ + /// + virtual bool Refresh(AEIO::DecodedData* decode_data) = 0; + + }; + + } +} + +namespace AEIO = AsuraEngine::IO; + +#endif \ No newline at end of file diff --git a/source/modules/asura-utils/threading/mutex.h b/source/modules/asura-utils/threading/mutex.h index 7afbe35..5d33be1 100644 --- a/source/modules/asura-utils/threading/mutex.h +++ b/source/modules/asura-utils/threading/mutex.h @@ -30,6 +30,10 @@ namespace AsuraEngine private: + // ½ûÖ¹¸´ÖÆ + Mutex(const Mutex&); + Mutex& operator=(const Mutex&); + MutexImpl* mImpl; }; @@ -52,7 +56,6 @@ namespace AsuraEngine Mutex& m; }; -// ½«ËùÔÚµÄÕ»´Ó´ËλÖÿªÊ¼µ½ÍËÕ»´¦×÷ΪÁÙ½çÇøËø¶¨¡£ #define lock(m) \ if(_mutex_locker _asura_mutex_locker = m){} else -- cgit v1.1-26-g67d0