summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-05-31 21:40:50 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-05-31 21:40:50 +0200
commit1ae9ff19194af9a365b3a76e50ee8d3aa01205b8 (patch)
treecfdedca728dab8b934e447fb6157492bdf0c407b
parent0325944ee4f6e3ca17382df82fa6d12868b3c541 (diff)
parentda3247a500662dcbd8e1946ecf0a9af19a146982 (diff)
Merge pull request #4960 from Hinsbart/fix_color8
Make Color.{rgba}8 return int instead float
-rw-r--r--core/variant_op.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index a9cc37168d..6065094da7 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -1354,7 +1354,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
return;
} else if (*str=="r8" ) {
valid=true;
- v->g=float(p_value)/255.0;
+ v->r=float(p_value)/255.0;
return;
} else if (*str=="g8" ) {
valid=true;
@@ -2213,16 +2213,16 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
return v->get_v();
} else if (*str=="r8") {
valid=true;
- return v->r*255.0;
+ return (int)Math::round(v->r*255.0);
} else if (*str=="g8" ) {
valid=true;
- return v->g*255.0;
+ return (int)Math::round(v->g*255.0);
} else if (*str=="b8" ) {
valid=true;
- return v->b*255.0;
+ return (int)Math::round(v->b*255.0);
} else if (*str=="a8" ) {
valid=true;
- return v->a*255.0;
+ return (int)Math::round(v->a*255.0);
}
} else if (p_index.get_type()==Variant::INT) {