-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scoped config works, but not integrated
Reordered includes
- Loading branch information
1 parent
3958415
commit e76c99e
Showing
27 changed files
with
263 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "config_scoped_3d.h" | ||
|
||
#include "utils/utils.h" | ||
|
||
void DDScopedConfig3D::_bind_methods() { | ||
#define REG_CLASS_NAME DDScopedConfig3D | ||
REG_METHOD(set_thickness, "value"); | ||
REG_METHOD(get_thickness); | ||
#undef REG_CLASS_NAME | ||
} | ||
|
||
Ref<DDScopedConfig3D> DDScopedConfig3D::set_thickness(real_t value) { | ||
thickness = Math::clamp(value, (real_t)0, (real_t)100); | ||
return Ref<DDScopedConfig3D>(this); | ||
} | ||
|
||
real_t DDScopedConfig3D::get_thickness() { | ||
return thickness; | ||
} | ||
|
||
DDScopedConfig3D::DDScopedConfig3D() { | ||
unregister_action = nullptr; | ||
thread_id = 0; | ||
guard_id = 0; | ||
|
||
thickness = 0; | ||
} | ||
|
||
DDScopedConfig3D::DDScopedConfig3D(const uint64_t &p_thread_id, const uint64_t &p_guard_id, const DDScopedConfig3D *parent, const unregister_func p_unreg) { | ||
unregister_action = p_unreg; | ||
|
||
thread_id = p_thread_id; | ||
guard_id = p_guard_id; | ||
|
||
thickness = parent->thickness; | ||
} | ||
|
||
DDScopedConfig3D::~DDScopedConfig3D() { | ||
if (unregister_action) { | ||
unregister_action(thread_id, guard_id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include "utils/compiler.h" | ||
|
||
#include <functional> | ||
|
||
GODOT_WARNING_DISABLE() | ||
#include <godot_cpp/classes/ref_counted.hpp> | ||
GODOT_WARNING_RESTORE() | ||
using namespace godot; | ||
|
||
class DDScopedConfig3D : public RefCounted { | ||
GDCLASS(DDScopedConfig3D, RefCounted) | ||
|
||
protected: | ||
static void _bind_methods(); | ||
uint64_t thread_id; | ||
uint64_t guard_id; | ||
|
||
typedef std::function<void(uint64_t, uint64_t)> unregister_func; | ||
unregister_func unregister_action; | ||
real_t thickness; | ||
|
||
public: | ||
Ref<DDScopedConfig3D> set_thickness(real_t value); | ||
real_t get_thickness(); | ||
|
||
DDScopedConfig3D(); | ||
DDScopedConfig3D(const uint64_t &p_thread_id, const uint64_t &p_guard_id, const DDScopedConfig3D *parent, const unregister_func p_unreg); | ||
~DDScopedConfig3D(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.