aboutsummaryrefslogtreecommitdiff
path: root/modules/gdnative/godot/godot_color.cpp
diff options
context:
space:
mode:
authorThomas Herzog2017-05-19 22:12:14 +0000
committerGitHub2017-05-19 22:12:14 +0000
commit6fd217d7c3afb1f7e4c68f9ab40883593f617a7e (patch)
treee1c16a806b9b5ec71730a5b09c2ff6a4b17bc93c /modules/gdnative/godot/godot_color.cpp
parenta75623f436c215e107ede321afa08a1897552deb (diff)
parentabcb044bf3f197ef68715f89abec77102bbe58ec (diff)
downloadgodot-6fd217d.tar.gz
godot-6fd217d.tar.zst
godot-6fd217d.zip
Merge pull request #8821 from touilleMan/gdnative_missing_functions
Finish implementing GDnative builtins bindings
Diffstat (limited to 'modules/gdnative/godot/godot_color.cpp')
-rw-r--r--modules/gdnative/godot/godot_color.cpp92
1 files changed, 78 insertions, 14 deletions
diff --git a/modules/gdnative/godot/godot_color.cpp b/modules/gdnative/godot/godot_color.cpp
index 203ce672f..0417a828a 100644
--- a/modules/gdnative/godot/godot_color.cpp
+++ b/modules/gdnative/godot/godot_color.cpp
@@ -28,34 +28,98 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_color.h"
+#include "core/variant.h"
-#include "color.h"
+#include "core/color.h"
#ifdef __cplusplus
extern "C" {
#endif
-void _color_api_anchor() {
+void _color_api_anchor() {}
+
+void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) {
+
+ Color *dest = (Color *)r_dest;
+ *dest = Color(p_r, p_g, p_b, p_a);
+}
+
+void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b) {
+
+ Color *dest = (Color *)r_dest;
+ *dest = Color(p_r, p_g, p_b);
+}
+
+godot_string GDAPI godot_color_as_string(const godot_color *p_self) {
+ godot_string ret;
+ const Color *self = (const Color *)p_self;
+ memnew_placement(&ret, String(*self));
+ return ret;
+}
+
+godot_int GDAPI godot_color_to_32(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->to_32();
+}
+
+godot_int GDAPI godot_color_to_ARGB32(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->to_ARGB32();
+}
+
+godot_real GDAPI godot_color_gray(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->gray();
+}
+
+godot_color GDAPI godot_color_inverted(const godot_color *p_self) {
+ godot_color dest;
+ const Color *self = (const Color *)p_self;
+ *((Color *)&dest) = self->inverted();
+ return dest;
}
-void GDAPI godot_color_new(godot_color *p_color) {
- Color *color = (Color *)p_color;
- *color = Color();
+godot_color GDAPI godot_color_contrasted(const godot_color *p_self) {
+ godot_color dest;
+ const Color *self = (const Color *)p_self;
+ *((Color *)&dest) = self->contrasted();
+ return dest;
}
-void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) {
- Color *color = (Color *)p_color;
- *color = Color(r, g, b, a);
+godot_color GDAPI godot_color_linear_interpolate(const godot_color *p_self, const godot_color *p_b, const godot_real p_t) {
+ godot_color dest;
+ const Color *self = (const Color *)p_self;
+ const Color *b = (const Color *)p_b;
+ *((Color *)&dest) = self->linear_interpolate(*b, p_t);
+ return dest;
+}
+
+godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over) {
+ godot_color dest;
+ const Color *self = (const Color *)p_self;
+ const Color *over = (const Color *)p_over;
+ *((Color *)&dest) = self->blend(*over);
+ return dest;
+}
+
+godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha) {
+ godot_string dest;
+ const Color *self = (const Color *)p_self;
+
+ *((String *)&dest) = self->to_html(p_with_alpha);
+ return dest;
}
-uint32_t GDAPI godot_color_get_32(const godot_color *p_color) {
- const Color *color = (const Color *)p_color;
- return color->to_32();
+godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b) {
+ const Color *self = (const Color *)p_self;
+ const Color *b = (const Color *)p_b;
+ return *self == *b;
}
-float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) {
- Color *color = (Color *)p_color;
- return &color->operator[](idx);
+godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b) {
+ const Color *self = (const Color *)p_self;
+ const Color *b = (const Color *)p_b;
+ return *self < *b;
}
#ifdef __cplusplus