From 503c52b0c58ef55c60c4b2eb4151c410e8b019dd Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 14 Nov 2019 03:31:25 +0700 Subject: [PATCH] remove secf using --- headers/enduro2d/core/audio.hpp | 6 +++--- headers/enduro2d/high/spine.hpp | 4 ++-- headers/enduro2d/utils/_utils.hpp | 2 -- samples/sources/sample_06/sample_06.cpp | 2 +- sources/enduro2d/core/audio_impl/audio_bass.cpp | 14 ++++++++------ sources/enduro2d/core/audio_impl/audio_none.cpp | 10 +++++----- sources/enduro2d/high/assets/spine_asset.cpp | 4 ++-- sources/enduro2d/high/spine.cpp | 8 ++++---- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/headers/enduro2d/core/audio.hpp b/headers/enduro2d/core/audio.hpp index a8a41cdd..cccfcbab 100644 --- a/headers/enduro2d/core/audio.hpp +++ b/headers/enduro2d/core/audio.hpp @@ -67,9 +67,9 @@ namespace e2d void volume(f32 value) noexcept; [[nodiscard]] f32 volume() const noexcept; - void position(secf value) noexcept; - [[nodiscard]] secf position() const noexcept; - [[nodiscard]] secf duration() const noexcept; + void position(f32 value) noexcept; + [[nodiscard]] f32 position() const noexcept; + [[nodiscard]] f32 duration() const noexcept; private: internal_state_uptr state_; }; diff --git a/headers/enduro2d/high/spine.hpp b/headers/enduro2d/high/spine.hpp index 7bf39e74..db9f5397 100644 --- a/headers/enduro2d/high/spine.hpp +++ b/headers/enduro2d/high/spine.hpp @@ -45,11 +45,11 @@ namespace e2d spine& set_atlas(atlas_ptr atlas); spine& set_skeleton(skeleton_data_ptr skeleton); - spine& set_default_mix(secf duration); + spine& set_default_mix(f32 duration); spine& set_animation_mix( const str& from, const str& to, - secf duration); + f32 duration); const atlas_ptr& atlas() const noexcept; const skeleton_data_ptr& skeleton() const noexcept; diff --git a/headers/enduro2d/utils/_utils.hpp b/headers/enduro2d/utils/_utils.hpp index 12b07ac1..77397567 100644 --- a/headers/enduro2d/utils/_utils.hpp +++ b/headers/enduro2d/utils/_utils.hpp @@ -67,8 +67,6 @@ namespace e2d using milliseconds = unit; template < typename T > using microseconds = unit; - - using secf = seconds; } namespace e2d diff --git a/samples/sources/sample_06/sample_06.cpp b/samples/sources/sample_06/sample_06.cpp index c4f54729..151a0a33 100644 --- a/samples/sources/sample_06/sample_06.cpp +++ b/samples/sources/sample_06/sample_06.cpp @@ -51,7 +51,7 @@ namespace e.ensure_component() .add_command(spine_player_cmd::set_anim_cmd(1, "gun-grab")) .add_command(spine_player_cmd::add_anim_cmd(1, "gun-holster") - .delay(secf(3.f))); + .delay(3.f)); } }); } diff --git a/sources/enduro2d/core/audio_impl/audio_bass.cpp b/sources/enduro2d/core/audio_impl/audio_bass.cpp index 4ee56c93..d5706051 100644 --- a/sources/enduro2d/core/audio_impl/audio_bass.cpp +++ b/sources/enduro2d/core/audio_impl/audio_bass.cpp @@ -116,19 +116,21 @@ namespace e2d return volume; } - void sound_source::position(secf pos) noexcept { - QWORD byte_pos = BASS_ChannelSeconds2Bytes(state().channel(), pos.value); + void sound_source::position(f32 pos) noexcept { + QWORD byte_pos = BASS_ChannelSeconds2Bytes(state().channel(), pos); BASS_ChannelSetPosition(state().channel(), byte_pos, BASS_POS_BYTE); } - secf sound_source::position() const noexcept { + f32 sound_source::position() const noexcept { QWORD byte_pos = BASS_ChannelGetPosition(state().channel(), BASS_POS_BYTE); - return secf{f32(BASS_ChannelBytes2Seconds(state().channel(), byte_pos))}; + return math::numeric_cast( + BASS_ChannelBytes2Seconds(state().channel(), byte_pos)); } - secf sound_source::duration() const noexcept { + f32 sound_source::duration() const noexcept { QWORD byte_len = BASS_ChannelGetLength(state().channel(), BASS_POS_BYTE); - return secf{f32(BASS_ChannelBytes2Seconds(state().channel(), byte_len))}; + return math::numeric_cast( + BASS_ChannelBytes2Seconds(state().channel(), byte_len)); } // diff --git a/sources/enduro2d/core/audio_impl/audio_none.cpp b/sources/enduro2d/core/audio_impl/audio_none.cpp index 38356200..d2ced646 100644 --- a/sources/enduro2d/core/audio_impl/audio_none.cpp +++ b/sources/enduro2d/core/audio_impl/audio_none.cpp @@ -95,16 +95,16 @@ namespace e2d return 1.0f; } - void sound_source::position(secf value) noexcept { + void sound_source::position(f32 value) noexcept { E2D_UNUSED(value); } - secf sound_source::position() const noexcept { - return {}; + f32 sound_source::position() const noexcept { + return 0.f; } - secf sound_source::duration() const noexcept { - return {}; + f32 sound_source::duration() const noexcept { + return 0.f; } // diff --git a/sources/enduro2d/high/assets/spine_asset.cpp b/sources/enduro2d/high/assets/spine_asset.cpp index fbd5af9d..914279a4 100644 --- a/sources/enduro2d/high/assets/spine_asset.cpp +++ b/sources/enduro2d/high/assets/spine_asset.cpp @@ -73,7 +73,7 @@ namespace struct animation_mix { str from; str to; - secf duration; + f32 duration{0.f}; }; animation_mix parse_animation_mix(const rapidjson::Value& root) { @@ -262,7 +262,7 @@ namespace } } - secf default_animation_mix{0.5f}; + f32 default_animation_mix{0.5f}; if ( root.HasMember("default_animation_mix") ) { if ( !json_utils::try_parse_value(root["default_animation_mix"], default_animation_mix) ) { the().error("SPINE: Incorrect formating of 'default_animation_mix' property"); diff --git a/sources/enduro2d/high/spine.cpp b/sources/enduro2d/high/spine.cpp index 1fc798a9..e2d325da 100644 --- a/sources/enduro2d/high/spine.cpp +++ b/sources/enduro2d/high/spine.cpp @@ -78,18 +78,18 @@ namespace e2d return *this; } - spine& spine::set_default_mix(secf duration) { + spine& spine::set_default_mix(f32 duration) { if ( !animation_ ) { throw bad_spine_access(); } - animation_->defaultMix = duration.value; + animation_->defaultMix = duration; return *this; } spine& spine::set_animation_mix( const str& from, const str& to, - secf duration) + f32 duration) { spAnimation* from_anim = animation_ ? spSkeletonData_findAnimation(animation_->skeletonData, from.c_str()) @@ -103,7 +103,7 @@ namespace e2d throw bad_spine_access(); } - spAnimationStateData_setMix(animation_.get(), from_anim, to_anim, duration.value); + spAnimationStateData_setMix(animation_.get(), from_anim, to_anim, duration); return *this; }