Skip to content

Commit

Permalink
chore: added AllowShortLambdasOnASingleLine rule on clang-format, app…
Browse files Browse the repository at this point in the history
…lied on bindings
  • Loading branch information
Sygmei committed May 10, 2023
1 parent 50693eb commit 06ecf1d
Show file tree
Hide file tree
Showing 21 changed files with 451 additions and 215 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ AllowShortFunctionsOnASingleLine: false
BinPackParameters: true
ReflowComments: false
AlwaysBreakTemplateDeclarations: true
AllowShortLambdasOnASingleLine: Empty
87 changes: 58 additions & 29 deletions src/Core/Bindings/obe/animation/Animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,21 @@ namespace obe::animation::bindings
bind_animation_group["get_size"] = &obe::animation::AnimationGroup::get_size;
bind_animation_group["is_over"] = &obe::animation::AnimationGroup::is_over;
bind_animation_group["next"] = sol::overload(
[](obe::animation::AnimationGroup* self) -> void { return self->next(); },
[](obe::animation::AnimationGroup* self, bool force) -> void {
[](obe::animation::AnimationGroup* self) -> void
{
return self->next();
},
[](obe::animation::AnimationGroup* self, bool force) -> void
{
return self->next(force);
});
bind_animation_group["previous"] = sol::overload(
[](obe::animation::AnimationGroup* self) -> void { return self->previous(); },
[](obe::animation::AnimationGroup* self, bool force) -> void {
[](obe::animation::AnimationGroup* self) -> void
{
return self->previous();
},
[](obe::animation::AnimationGroup* self, bool force) -> void
{
return self->previous(force);
});
bind_animation_group["push_frame_index"]
Expand Down Expand Up @@ -134,7 +142,8 @@ namespace obe::animation::bindings
bind_animation_state["reset"] = &obe::animation::AnimationState::reset;
bind_animation_state["update"] = &obe::animation::AnimationState::update;
bind_animation_state["get_animation"]
= [](obe::animation::AnimationState* self) -> const obe::animation::Animation* {
= [](obe::animation::AnimationState* self) -> const obe::animation::Animation*
{
return &self->get_animation();
};
bind_animation_state["get_current_frame_index"]
Expand All @@ -154,22 +163,27 @@ namespace obe::animation::bindings
= &obe::animation::Animator::get_current_animation_name;
bind_animator["get_current_animation"] = &obe::animation::Animator::get_current_animation;
bind_animator["get_current_texture"] = &obe::animation::Animator::get_current_texture;
bind_animator["load"]
= sol::overload([](obe::animation::Animator* self,
obe::system::Path path) -> void { return self->load(path); },
[](obe::animation::Animator* self, obe::system::Path path,
obe::engine::ResourceManager* resources) -> void {
return self->load(path, resources);
});
bind_animator["load"] = sol::overload(
[](obe::animation::Animator* self, obe::system::Path path) -> void
{
return self->load(path);
},
[](obe::animation::Animator* self, obe::system::Path path,
obe::engine::ResourceManager* resources) -> void
{
return self->load(path, resources);
});
bind_animator["set_animation"] = &obe::animation::Animator::set_animation;
bind_animator["set_paused"] = &obe::animation::Animator::set_paused;
bind_animator["update"] = &obe::animation::Animator::update;
bind_animator["set_target"] = sol::overload(
[](obe::animation::Animator* self, obe::graphics::Sprite& sprite) -> void {
[](obe::animation::Animator* self, obe::graphics::Sprite& sprite) -> void
{
return self->set_target(sprite);
},
[](obe::animation::Animator* self, obe::graphics::Sprite& sprite,
obe::animation::AnimatorTargetScaleMode target_scale_mode) -> void {
obe::animation::AnimatorTargetScaleMode target_scale_mode) -> void
{
return self->set_target(sprite, target_scale_mode);
});
bind_animator["get_filesystem_path"] = &obe::animation::Animator::get_filesystem_path;
Expand All @@ -190,11 +204,13 @@ namespace obe::animation::bindings
bind_animator_state["set_paused"] = &obe::animation::AnimatorState::set_paused;
bind_animator_state["update"] = &obe::animation::AnimatorState::update;
bind_animator_state["set_target"] = sol::overload(
[](obe::animation::AnimatorState* self, obe::graphics::Sprite& sprite) -> void {
[](obe::animation::AnimatorState* self, obe::graphics::Sprite& sprite) -> void
{
return self->set_target(sprite);
},
[](obe::animation::AnimatorState* self, obe::graphics::Sprite& sprite,
obe::animation::AnimatorTargetScaleMode target_scale_mode) -> void {
obe::animation::AnimatorTargetScaleMode target_scale_mode) -> void
{
return self->set_target(sprite, target_scale_mode);
});
bind_animator_state["reset"] = &obe::animation::AnimatorState::reset;
Expand All @@ -204,7 +220,8 @@ namespace obe::animation::bindings
bind_animator_state["get_current_texture"]
= &obe::animation::AnimatorState::get_current_texture;
bind_animator_state["get_animator"]
= [](obe::animation::AnimatorState* self) -> const obe::animation::Animator* {
= [](obe::animation::AnimatorState* self) -> const obe::animation::Animator*
{
return &self->get_animator();
};
}
Expand Down Expand Up @@ -394,59 +411,71 @@ namespace obe::animation::bindings
sol::table animation_namespace = state["obe"]["animation"].get<sol::table>();
animation_namespace["Tween"] = sol::overload(
[](obe::graphics::Color from, obe::graphics::Color to,
obe::time::TimeUnit duration) -> ValueTweening<obe::graphics::Color> {
obe::time::TimeUnit duration) -> ValueTweening<obe::graphics::Color>
{
return obe::animation::ValueTweening<obe::graphics::Color>(from, to, duration);
},
[](obe::graphics::Color from, obe::graphics::Color to, obe::time::TimeUnit duration,
obe::animation::easing::EasingFunction easing)
-> ValueTweening<obe::graphics::Color> {
-> ValueTweening<obe::graphics::Color>
{
return obe::animation::ValueTweening<obe::graphics::Color>(
from, to, duration, easing);
},
[](obe::transform::UnitVector from, obe::transform::UnitVector to,
obe::time::TimeUnit duration) -> ValueTweening<obe::transform::UnitVector> {
obe::time::TimeUnit duration) -> ValueTweening<obe::transform::UnitVector>
{
return obe::animation::ValueTweening<obe::transform::UnitVector>(
from, to, duration);
},
[](obe::transform::UnitVector from, obe::transform::UnitVector to,
obe::time::TimeUnit duration, obe::animation::easing::EasingFunction easing)
-> ValueTweening<obe::transform::UnitVector> {
-> ValueTweening<obe::transform::UnitVector>
{
return obe::animation::ValueTweening<obe::transform::UnitVector>(
from, to, duration, easing);
},
[](obe::transform::Rect from, obe::transform::Rect to,
obe::time::TimeUnit duration) -> ValueTweening<obe::transform::Rect> {
obe::time::TimeUnit duration) -> ValueTweening<obe::transform::Rect>
{
return obe::animation::ValueTweening<obe::transform::Rect>(from, to, duration);
},
[](obe::transform::Rect from, obe::transform::Rect to, obe::time::TimeUnit duration,
obe::animation::easing::EasingFunction easing)
-> ValueTweening<obe::transform::Rect> {
-> ValueTweening<obe::transform::Rect>
{
return obe::animation::ValueTweening<obe::transform::Rect>(
from, to, duration, easing);
},
[](obe::collision::Trajectory from, obe::collision::Trajectory to,
obe::time::TimeUnit duration) -> ValueTweening<obe::collision::Trajectory> {
obe::time::TimeUnit duration) -> ValueTweening<obe::collision::Trajectory>
{
return obe::animation::ValueTweening<obe::collision::Trajectory>(
from, to, duration);
},
[](obe::collision::Trajectory from, obe::collision::Trajectory to,
obe::time::TimeUnit duration, obe::animation::easing::EasingFunction easing)
-> ValueTweening<obe::collision::Trajectory> {
-> ValueTweening<obe::collision::Trajectory>
{
return obe::animation::ValueTweening<obe::collision::Trajectory>(
from, to, duration, easing);
},
[](int from, int to, obe::time::TimeUnit duration) -> ValueTweening<int> {
[](int from, int to, obe::time::TimeUnit duration) -> ValueTweening<int>
{
return obe::animation::ValueTweening<int>(from, to, duration);
},
[](int from, int to, obe::time::TimeUnit duration,
obe::animation::easing::EasingFunction easing) -> ValueTweening<int> {
obe::animation::easing::EasingFunction easing) -> ValueTweening<int>
{
return obe::animation::ValueTweening<int>(from, to, duration, easing);
},
[](double from, double to, obe::time::TimeUnit duration) -> ValueTweening<double> {
[](double from, double to, obe::time::TimeUnit duration) -> ValueTweening<double>
{
return obe::animation::ValueTweening<double>(from, to, duration);
},
[](double from, double to, obe::time::TimeUnit duration,
obe::animation::easing::EasingFunction easing) -> ValueTweening<double> {
obe::animation::easing::EasingFunction easing) -> ValueTweening<double>
{
return obe::animation::ValueTweening<double>(from, to, duration, easing);
});
}
Expand Down
6 changes: 4 additions & 2 deletions src/Core/Bindings/obe/audio/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ namespace obe::audio::bindings
= audio_namespace.new_usertype<obe::audio::AudioManager>("AudioManager",
sol::call_constructor, sol::constructors<obe::audio::AudioManager()>());
bind_audio_manager["load"] = sol::overload(
[](obe::audio::AudioManager* self, const obe::system::Path& path) -> obe::audio::Sound {
[](obe::audio::AudioManager* self, const obe::system::Path& path) -> obe::audio::Sound
{
return self->load(path);
},
[](obe::audio::AudioManager* self, const obe::system::Path& path,
obe::audio::LoadPolicy load_policy) -> obe::audio::Sound {
obe::audio::LoadPolicy load_policy) -> obe::audio::Sound
{
return self->load(path, load_policy);
});
}
Expand Down
Loading

0 comments on commit 06ecf1d

Please sign in to comment.