mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-15 00:11:55 +07:00
remove secf using
This commit is contained in:
@@ -67,9 +67,9 @@ namespace e2d
|
|||||||
void volume(f32 value) noexcept;
|
void volume(f32 value) noexcept;
|
||||||
[[nodiscard]] f32 volume() const noexcept;
|
[[nodiscard]] f32 volume() const noexcept;
|
||||||
|
|
||||||
void position(secf value) noexcept;
|
void position(f32 value) noexcept;
|
||||||
[[nodiscard]] secf position() const noexcept;
|
[[nodiscard]] f32 position() const noexcept;
|
||||||
[[nodiscard]] secf duration() const noexcept;
|
[[nodiscard]] f32 duration() const noexcept;
|
||||||
private:
|
private:
|
||||||
internal_state_uptr state_;
|
internal_state_uptr state_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ namespace e2d
|
|||||||
spine& set_atlas(atlas_ptr atlas);
|
spine& set_atlas(atlas_ptr atlas);
|
||||||
spine& set_skeleton(skeleton_data_ptr skeleton);
|
spine& set_skeleton(skeleton_data_ptr skeleton);
|
||||||
|
|
||||||
spine& set_default_mix(secf duration);
|
spine& set_default_mix(f32 duration);
|
||||||
spine& set_animation_mix(
|
spine& set_animation_mix(
|
||||||
const str& from,
|
const str& from,
|
||||||
const str& to,
|
const str& to,
|
||||||
secf duration);
|
f32 duration);
|
||||||
|
|
||||||
const atlas_ptr& atlas() const noexcept;
|
const atlas_ptr& atlas() const noexcept;
|
||||||
const skeleton_data_ptr& skeleton() const noexcept;
|
const skeleton_data_ptr& skeleton() const noexcept;
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ namespace e2d
|
|||||||
using milliseconds = unit<T, milliseconds_tag>;
|
using milliseconds = unit<T, milliseconds_tag>;
|
||||||
template < typename T >
|
template < typename T >
|
||||||
using microseconds = unit<T, microseconds_tag>;
|
using microseconds = unit<T, microseconds_tag>;
|
||||||
|
|
||||||
using secf = seconds<f32>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace e2d
|
namespace e2d
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace
|
|||||||
e.ensure_component<spine_player_cmd>()
|
e.ensure_component<spine_player_cmd>()
|
||||||
.add_command(spine_player_cmd::set_anim_cmd(1, "gun-grab"))
|
.add_command(spine_player_cmd::set_anim_cmd(1, "gun-grab"))
|
||||||
.add_command(spine_player_cmd::add_anim_cmd(1, "gun-holster")
|
.add_command(spine_player_cmd::add_anim_cmd(1, "gun-holster")
|
||||||
.delay(secf(3.f)));
|
.delay(3.f));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,19 +116,21 @@ namespace e2d
|
|||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sound_source::position(secf pos) noexcept {
|
void sound_source::position(f32 pos) noexcept {
|
||||||
QWORD byte_pos = BASS_ChannelSeconds2Bytes(state().channel(), pos.value);
|
QWORD byte_pos = BASS_ChannelSeconds2Bytes(state().channel(), pos);
|
||||||
BASS_ChannelSetPosition(state().channel(), byte_pos, BASS_POS_BYTE);
|
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);
|
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);
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -95,16 +95,16 @@ namespace e2d
|
|||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sound_source::position(secf value) noexcept {
|
void sound_source::position(f32 value) noexcept {
|
||||||
E2D_UNUSED(value);
|
E2D_UNUSED(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
secf sound_source::position() const noexcept {
|
f32 sound_source::position() const noexcept {
|
||||||
return {};
|
return 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
secf sound_source::duration() const noexcept {
|
f32 sound_source::duration() const noexcept {
|
||||||
return {};
|
return 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace
|
|||||||
struct animation_mix {
|
struct animation_mix {
|
||||||
str from;
|
str from;
|
||||||
str to;
|
str to;
|
||||||
secf duration;
|
f32 duration{0.f};
|
||||||
};
|
};
|
||||||
|
|
||||||
animation_mix parse_animation_mix(const rapidjson::Value& root) {
|
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 ( root.HasMember("default_animation_mix") ) {
|
||||||
if ( !json_utils::try_parse_value(root["default_animation_mix"], 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");
|
the<debug>().error("SPINE: Incorrect formating of 'default_animation_mix' property");
|
||||||
|
|||||||
@@ -78,18 +78,18 @@ namespace e2d
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
spine& spine::set_default_mix(secf duration) {
|
spine& spine::set_default_mix(f32 duration) {
|
||||||
if ( !animation_ ) {
|
if ( !animation_ ) {
|
||||||
throw bad_spine_access();
|
throw bad_spine_access();
|
||||||
}
|
}
|
||||||
animation_->defaultMix = duration.value;
|
animation_->defaultMix = duration;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
spine& spine::set_animation_mix(
|
spine& spine::set_animation_mix(
|
||||||
const str& from,
|
const str& from,
|
||||||
const str& to,
|
const str& to,
|
||||||
secf duration)
|
f32 duration)
|
||||||
{
|
{
|
||||||
spAnimation* from_anim = animation_
|
spAnimation* from_anim = animation_
|
||||||
? spSkeletonData_findAnimation(animation_->skeletonData, from.c_str())
|
? spSkeletonData_findAnimation(animation_->skeletonData, from.c_str())
|
||||||
@@ -103,7 +103,7 @@ namespace e2d
|
|||||||
throw bad_spine_access();
|
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;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user