diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /scene/animation/tween.h | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf180.tar.gz godot-5dbf180.tar.zst godot-5dbf180.zip | |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'scene/animation/tween.h')
| -rw-r--r-- | scene/animation/tween.h | 153 |
1 files changed, 39 insertions, 114 deletions
diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 07c2e90da..84f866f43 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -31,10 +31,9 @@ #include "scene/main/node.h" - class Tween : public Node { - GDCLASS( Tween, Node ); + GDCLASS(Tween, Node); public: enum TweenProcessMode { @@ -42,30 +41,30 @@ public: TWEEN_PROCESS_IDLE, }; - enum TransitionType { - TRANS_LINEAR, - TRANS_SINE, - TRANS_QUINT, - TRANS_QUART, - TRANS_QUAD, - TRANS_EXPO, - TRANS_ELASTIC, - TRANS_CUBIC, - TRANS_CIRC, - TRANS_BOUNCE, - TRANS_BACK, + enum TransitionType { + TRANS_LINEAR, + TRANS_SINE, + TRANS_QUINT, + TRANS_QUART, + TRANS_QUAD, + TRANS_EXPO, + TRANS_ELASTIC, + TRANS_CUBIC, + TRANS_CIRC, + TRANS_BOUNCE, + TRANS_BACK, TRANS_COUNT, - }; + }; - enum EaseType { - EASE_IN, - EASE_OUT, - EASE_IN_OUT, + enum EaseType { + EASE_IN, + EASE_OUT, + EASE_IN_OUT, EASE_OUT_IN, EASE_COUNT, - }; + }; private: enum InterpolateType { @@ -117,45 +116,32 @@ private: }; List<PendingCommand> pending_commands; - void _add_pending_command(StringName p_key - ,const Variant& p_arg1=Variant() - ,const Variant& p_arg2=Variant() - ,const Variant& p_arg3=Variant() - ,const Variant& p_arg4=Variant() - ,const Variant& p_arg5=Variant() - ,const Variant& p_arg6=Variant() - ,const Variant& p_arg7=Variant() - ,const Variant& p_arg8=Variant() - ,const Variant& p_arg9=Variant() - ,const Variant& p_arg10=Variant() - ); + void _add_pending_command(StringName p_key, const Variant &p_arg1 = Variant(), const Variant &p_arg2 = Variant(), const Variant &p_arg3 = Variant(), const Variant &p_arg4 = Variant(), const Variant &p_arg5 = Variant(), const Variant &p_arg6 = Variant(), const Variant &p_arg7 = Variant(), const Variant &p_arg8 = Variant(), const Variant &p_arg9 = Variant(), const Variant &p_arg10 = Variant()); void _process_pending_commands(); typedef real_t (*interpolater)(real_t t, real_t b, real_t c, real_t d); static interpolater interpolaters[TRANS_COUNT][EASE_COUNT]; real_t _run_equation(TransitionType p_trans_type, EaseType p_ease_type, real_t t, real_t b, real_t c, real_t d); - Variant& _get_delta_val(InterpolateData& p_data); - Variant& _get_initial_val(InterpolateData& p_data); - Variant _run_equation(InterpolateData& p_data); - bool _calc_delta_val(const Variant& p_initial_val, const Variant& p_final_val, Variant& p_delta_val); - bool _apply_tween_value(InterpolateData& p_data, Variant& value); + Variant &_get_delta_val(InterpolateData &p_data); + Variant &_get_initial_val(InterpolateData &p_data); + Variant _run_equation(InterpolateData &p_data); + bool _calc_delta_val(const Variant &p_initial_val, const Variant &p_final_val, Variant &p_delta_val); + bool _apply_tween_value(InterpolateData &p_data, Variant &value); void _tween_process(float p_delta); - void _set_process(bool p_process,bool p_force=false); + void _set_process(bool p_process, bool p_force = false); void _remove(Object *p_node, String p_key, bool first_only); protected: - - bool _set(const StringName& p_name, const Variant& p_value); - bool _get(const StringName& p_name,Variant &r_ret) const; + bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List<PropertyInfo> *p_list) const; void _notification(int p_what); static void _bind_methods(); public: - bool is_active() const; void set_active(bool p_active); @@ -182,89 +168,28 @@ public: real_t tell() const; real_t get_runtime() const; - bool interpolate_property(Object *p_node - , String p_property - , Variant p_initial_val - , Variant p_final_val - , real_t p_duration - , TransitionType p_trans_type - , EaseType p_ease_type - , real_t p_delay = 0 - ); + bool interpolate_property(Object *p_node, String p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); - bool interpolate_method(Object *p_node - , String p_method - , Variant p_initial_val - , Variant p_final_val - , real_t p_duration - , TransitionType p_trans_type - , EaseType p_ease_type - , real_t p_delay = 0 - ); + bool interpolate_method(Object *p_node, String p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); - bool interpolate_callback(Object *p_object - , real_t p_duration - , String p_callback - , VARIANT_ARG_DECLARE - ); + bool interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE); - bool interpolate_deferred_callback(Object *p_object - , real_t p_duration - , String p_callback - , VARIANT_ARG_DECLARE - ); + bool interpolate_deferred_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE); - bool follow_property(Object *p_node - , String p_property - , Variant p_initial_val - , Object *p_target - , String p_target_property - , real_t p_duration - , TransitionType p_trans_type - , EaseType p_ease_type - , real_t p_delay = 0 - ); + bool follow_property(Object *p_node, String p_property, Variant p_initial_val, Object *p_target, String p_target_property, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); - bool follow_method(Object *p_node - , String p_method - , Variant p_initial_val - , Object *p_target - , String p_target_method - , real_t p_duration - , TransitionType p_trans_type - , EaseType p_ease_type - , real_t p_delay = 0 - ); + bool follow_method(Object *p_node, String p_method, Variant p_initial_val, Object *p_target, String p_target_method, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); - bool targeting_property(Object *p_node - , String p_property - , Object *p_initial - , String p_initial_property - , Variant p_final_val - , real_t p_duration - , TransitionType p_trans_type - , EaseType p_ease_type - , real_t p_delay = 0 - ); + bool targeting_property(Object *p_node, String p_property, Object *p_initial, String p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); - bool targeting_method(Object *p_node - , String p_method - , Object *p_initial - , String p_initial_method - , Variant p_final_val - , real_t p_duration - , TransitionType p_trans_type - , EaseType p_ease_type - , real_t p_delay = 0 - ); + bool targeting_method(Object *p_node, String p_method, Object *p_initial, String p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); Tween(); ~Tween(); }; -VARIANT_ENUM_CAST( Tween::TweenProcessMode ); -VARIANT_ENUM_CAST( Tween::TransitionType ); -VARIANT_ENUM_CAST( Tween::EaseType ); +VARIANT_ENUM_CAST(Tween::TweenProcessMode); +VARIANT_ENUM_CAST(Tween::TransitionType); +VARIANT_ENUM_CAST(Tween::EaseType); #endif - |
