remove secf using

This commit is contained in:
2019-11-14 03:31:25 +07:00
parent f0704363cb
commit 503c52b0c5
8 changed files with 25 additions and 25 deletions

View File

@@ -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_;
};

View File

@@ -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;

View File

@@ -67,8 +67,6 @@ namespace e2d
using milliseconds = unit<T, milliseconds_tag>;
template < typename T >
using microseconds = unit<T, microseconds_tag>;
using secf = seconds<f32>;
}
namespace e2d

View File

@@ -51,7 +51,7 @@ namespace
e.ensure_component<spine_player_cmd>()
.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));
}
});
}

View File

@@ -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<f32>(
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<f32>(
BASS_ChannelBytes2Seconds(state().channel(), byte_len));
}
//

View File

@@ -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;
}
//

View File

@@ -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<debug>().error("SPINE: Incorrect formating of 'default_animation_mix' property");

View File

@@ -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;
}