From 9686368e58e25cbd6dc37d686bdd2be3f80486d6 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 6 Aug 2019 09:14:11 +0800 Subject: *misc --- source/modules/asura-base/BuildConfigure.h | 8 ++++ source/modules/asura-base/Config.h | 69 ---------------------------- source/modules/asura-base/Configure.h | 58 +++++++++++++++++++++++ source/modules/asura-base/config.h | 69 ---------------------------- source/modules/asura-core/Input/InputEvent.h | 34 ++++++++++++++ source/modules/asura-openal/Audio/Audio.h | 18 ++++++++ source/modules/asura-openal/audio/audio.h | 18 ++++++++ source/modules/asura-utils/Type.h | 2 +- source/modules/asura-utils/UtilsConfig.h | 2 +- source/modules/asura-utils/type.h | 2 +- 10 files changed, 139 insertions(+), 141 deletions(-) create mode 100644 source/modules/asura-base/BuildConfigure.h delete mode 100644 source/modules/asura-base/Config.h create mode 100644 source/modules/asura-base/Configure.h delete mode 100644 source/modules/asura-base/config.h (limited to 'source/modules') diff --git a/source/modules/asura-base/BuildConfigure.h b/source/modules/asura-base/BuildConfigure.h new file mode 100644 index 0000000..6fd3aad --- /dev/null +++ b/source/modules/asura-base/BuildConfigure.h @@ -0,0 +1,8 @@ +// Copy to asura-configure folder + +#ifndef _ASURA_EDITOR_CONFIGURE_H_ +#define _ASURA_EDITOR_CONFIGURE_H_ + +#define ASURA_EDITOR 1 + +#endif \ No newline at end of file diff --git a/source/modules/asura-base/Config.h b/source/modules/asura-base/Config.h deleted file mode 100644 index 024ac79..0000000 --- a/source/modules/asura-base/Config.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __ASURA_BASE_CONFIG_H__ -#define __ASURA_BASE_CONFIG_H__ - -// 在编辑器下会编译的代码 -#define ASURA_EDITOR 1 - -// 在运行时中的代码 -#define ASURA_RUNTIME 1 - -//--------------------------------------------------------------------------------// - -#ifndef ASSERT -#ifdef NDEBUG -#define ASSERT(x) { false ? (void)(x) : (void)0; } -#else -#ifdef _WIN32 -#define ASURA_DEBUG_BREAK() __debugbreak() -#else -#define ASURA_DEBUG_BREAK() raise(SIGTRAP) -#endif -#define ASSERT(x) do { const volatile bool asura_assert_b____ = !(x); if(asura_assert_b____) ASURA_DEBUG_BREAK(); } while (false) -#endif -#endif - -//--------------------------------------------------------------------------------// - -#ifdef _WIN32 - #define ASURA_FINAL final - #define ASURA_EXPORT __declspec(dllexport) - #define ASURA_IMPORT __declspec(dllimport) - #define ASURA_FORCE_INLINE __forceinline - #define ASURA_RESTRICT __restrict - #define ASURA_API ASURA_EXPORT - #define ASURA_ATTRIBUTE_USED - #define ASURA_ABSTRACT - #define ASURA_WINDOWS 1 -#else - #define ASURA_FINAL final - #define ASURA_EXPORT __attribute__((visibility("default"))) - #define ASURA_IMPORT - #define ASURA_FORCE_INLINE __attribute__((always_inline)) inline - #define ASURA_RESTRICT __restrict__ - #define ASURA_ATTRIBUTE_USED __attribute__((used)) - #define ASURA_ABSTRACT - #define ASURA_API ASURA_EXPORT -#endif - -/// -/// 表明移动指针所有权 -/// -#define ASURA_MOVE - -#define ASURA_DEBUG 0 - -//--------------------------------------------------------------------------------// - -#define ASURA_SDL_HOST 1 - -#define ASURA_LITTLE_ENDIAN 1 - -//--------------------------------------------------------------------------------// -// 扩展关键字 - -#define ASURA_THROW(ex) throw(ex) // 暗示抛出异常 - -#define ASURA_OUT -#define ASURA_REF - -#endif \ No newline at end of file diff --git a/source/modules/asura-base/Configure.h b/source/modules/asura-base/Configure.h new file mode 100644 index 0000000..07926d0 --- /dev/null +++ b/source/modules/asura-base/Configure.h @@ -0,0 +1,58 @@ +#ifndef _ASURA_BASE_CONFIG_H_ +#define _ASURA_BASE_CONFIG_H_ + +#include "BuildConfigure.h" + +#ifndef ASSERT +#ifdef NDEBUG +#define ASSERT(x) { false ? (void)(x) : (void)0; } +#else +#ifdef _WIN32 +#define ASURA_DEBUG_BREAK() __debugbreak() +#else +#define ASURA_DEBUG_BREAK() raise(SIGTRAP) +#endif +#define ASSERT(x) do { const volatile bool asura_assert_b____ = !(x); if(asura_assert_b____) ASURA_DEBUG_BREAK(); } while (false) +#endif +#endif + +#ifdef _WIN32 + #define ASURA_FINAL final + #define ASURA_EXPORT __declspec(dllexport) + #define ASURA_IMPORT __declspec(dllimport) + #define ASURA_FORCE_INLINE __forceinline + #define ASURA_RESTRICT __restrict + #define ASURA_API ASURA_EXPORT + #define ASURA_ATTRIBUTE_USED + #define ASURA_ABSTRACT + #define ASURA_WINDOWS 1 +#else + #define ASURA_FINAL final + #define ASURA_EXPORT __attribute__((visibility("default"))) + #define ASURA_IMPORT + #define ASURA_FORCE_INLINE __attribute__((always_inline)) inline + #define ASURA_RESTRICT __restrict__ + #define ASURA_ATTRIBUTE_USED __attribute__((used)) + #define ASURA_ABSTRACT + #define ASURA_API ASURA_EXPORT +#endif + +/// +/// 表明移动指针所有权 +/// +#define ASURA_MOVE + +#define ASURA_DEBUG 0 + +#define ASURA_SDL_HOST 1 + +#define ASURA_LITTLE_ENDIAN 1 + +// 扩展关键字 + +#define ASURA_THROW(ex) throw(ex) // 暗示抛出异常 + +#define ASURA_OUT +#define ASURA_REF + +#endif \ No newline at end of file diff --git a/source/modules/asura-base/config.h b/source/modules/asura-base/config.h deleted file mode 100644 index 024ac79..0000000 --- a/source/modules/asura-base/config.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __ASURA_BASE_CONFIG_H__ -#define __ASURA_BASE_CONFIG_H__ - -// 在编辑器下会编译的代码 -#define ASURA_EDITOR 1 - -// 在运行时中的代码 -#define ASURA_RUNTIME 1 - -//--------------------------------------------------------------------------------// - -#ifndef ASSERT -#ifdef NDEBUG -#define ASSERT(x) { false ? (void)(x) : (void)0; } -#else -#ifdef _WIN32 -#define ASURA_DEBUG_BREAK() __debugbreak() -#else -#define ASURA_DEBUG_BREAK() raise(SIGTRAP) -#endif -#define ASSERT(x) do { const volatile bool asura_assert_b____ = !(x); if(asura_assert_b____) ASURA_DEBUG_BREAK(); } while (false) -#endif -#endif - -//--------------------------------------------------------------------------------// - -#ifdef _WIN32 - #define ASURA_FINAL final - #define ASURA_EXPORT __declspec(dllexport) - #define ASURA_IMPORT __declspec(dllimport) - #define ASURA_FORCE_INLINE __forceinline - #define ASURA_RESTRICT __restrict - #define ASURA_API ASURA_EXPORT - #define ASURA_ATTRIBUTE_USED - #define ASURA_ABSTRACT - #define ASURA_WINDOWS 1 -#else - #define ASURA_FINAL final - #define ASURA_EXPORT __attribute__((visibility("default"))) - #define ASURA_IMPORT - #define ASURA_FORCE_INLINE __attribute__((always_inline)) inline - #define ASURA_RESTRICT __restrict__ - #define ASURA_ATTRIBUTE_USED __attribute__((used)) - #define ASURA_ABSTRACT - #define ASURA_API ASURA_EXPORT -#endif - -/// -/// 表明移动指针所有权 -/// -#define ASURA_MOVE - -#define ASURA_DEBUG 0 - -//--------------------------------------------------------------------------------// - -#define ASURA_SDL_HOST 1 - -#define ASURA_LITTLE_ENDIAN 1 - -//--------------------------------------------------------------------------------// -// 扩展关键字 - -#define ASURA_THROW(ex) throw(ex) // 暗示抛出异常 - -#define ASURA_OUT -#define ASURA_REF - -#endif \ No newline at end of file diff --git a/source/modules/asura-core/Input/InputEvent.h b/source/modules/asura-core/Input/InputEvent.h index 2c5b84b..d7643b6 100644 --- a/source/modules/asura-core/Input/InputEvent.h +++ b/source/modules/asura-core/Input/InputEvent.h @@ -1,16 +1,50 @@ #ifndef _ASURA_ENGINE_INPUT_EVENT_H_ #define _ASURA_ENGINE_INPUT_EVENT_H_ +#include #include +#include + +#include +#include namespace_begin(AsuraEngine) namespace_begin(Input) +// 所有的客户端事件,如键盘、重绘、鼠标 struct InputEvent { InputEvent(); ~InputEvent(); +#if ASURA_EDITOR + + bool Open(HWND window); + void Close(void); + + bool GetJoystickNames(std::vector &names); + + bool Activate(bool active); + bool ToggleFullscreen(bool fullscreen, HWND window); + + bool Process(bool discard); + LRESULT OnKey(HWND window, UINT message, WPARAM wParam, LPARAM lParam); + LRESULT OnInput(HWND window, UINT message, WPARAM wParam, LPARAM lParam); + LRESULT OnDeviceChange(LPCWSTR name, bool add); + + static bool ConvertPositionToClientAreaCoord(HWND activeWindow, POINT position, AEMath::Vector2f& newPos); + +#elif ASURA_RUNNER + + bool Open(); + +#endif + + enum + { + + }; + }; //InputEvent ConvertInputEvent(); diff --git a/source/modules/asura-openal/Audio/Audio.h b/source/modules/asura-openal/Audio/Audio.h index e69de29..b9f718f 100644 --- a/source/modules/asura-openal/Audio/Audio.h +++ b/source/modules/asura-openal/Audio/Audio.h @@ -0,0 +1,18 @@ +#ifndef _ASURA_AUDIO_H_ +#define _ASURA_AUDIO_H_ + +#include + +namespace_begin(AsuraEngine) +namespace_begin(Audio) + +class Audio +{ + +}; + + +namespace_end +namespace_end + +#endif \ No newline at end of file diff --git a/source/modules/asura-openal/audio/audio.h b/source/modules/asura-openal/audio/audio.h index e69de29..b9f718f 100644 --- a/source/modules/asura-openal/audio/audio.h +++ b/source/modules/asura-openal/audio/audio.h @@ -0,0 +1,18 @@ +#ifndef _ASURA_AUDIO_H_ +#define _ASURA_AUDIO_H_ + +#include + +namespace_begin(AsuraEngine) +namespace_begin(Audio) + +class Audio +{ + +}; + + +namespace_end +namespace_end + +#endif \ No newline at end of file diff --git a/source/modules/asura-utils/Type.h b/source/modules/asura-utils/Type.h index 318145b..5100fa3 100644 --- a/source/modules/asura-utils/Type.h +++ b/source/modules/asura-utils/Type.h @@ -5,7 +5,7 @@ #include #include -#include "asura-base/Config.h" +#include "asura-base/Configure.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/UtilsConfig.h b/source/modules/asura-utils/UtilsConfig.h index 89a605d..df52b13 100644 --- a/source/modules/asura-utils/UtilsConfig.h +++ b/source/modules/asura-utils/UtilsConfig.h @@ -2,7 +2,7 @@ #define _ASURA_UTILS_CONFIG_H_ // 基本的编译配置 -#include "asura-base/Config.h" +#include "asura-base/Configure.h" #define ASURA_THREAD_WIN32 1 #define ASURA_THREAD_STD 1 diff --git a/source/modules/asura-utils/type.h b/source/modules/asura-utils/type.h index 318145b..5100fa3 100644 --- a/source/modules/asura-utils/type.h +++ b/source/modules/asura-utils/type.h @@ -5,7 +5,7 @@ #include #include -#include "asura-base/Config.h" +#include "asura-base/Configure.h" namespace AsuraEngine { -- cgit v1.1-26-g67d0