From d2c10b2e05d567c34c071e8845d23a8f9a0b50d3 Mon Sep 17 00:00:00 2001 From: kdx Date: Fri, 15 Mar 2024 17:41:01 +0100 Subject: fix colors --- map/0.tmj | 6 ++++++ run.sh | 2 +- src/_color.c | 1 + src/color.c | 8 ++++---- src/entity.c | 2 +- src/trigger.c | 8 ++++---- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/map/0.tmj b/map/0.tmj index 6cfb8a8..f79e360 100644 --- a/map/0.tmj +++ b/map/0.tmj @@ -790,6 +790,12 @@ "name":"color", "type":"color", "value":"#ff00eaff" + }, + { + "name":"color group", + "propertytype":"ColorGroup", + "type":"int", + "value":0 }], "rotation":0, "type":"color", diff --git a/run.sh b/run.sh index ef1d4c0..4b17e92 100755 --- a/run.sh +++ b/run.sh @@ -1,2 +1,2 @@ #!/bin/sh -tup build-default && gamescope -Fpixel -w480 -h360 -- ./build-default/build/nulltopos . +tup build-default && gamescope -Fpixel -w480 -h360 -- ./build-default/build/nulltopos . && killall nulltopos -9 diff --git a/src/_color.c b/src/_color.c index a7573fe..2f3c7cf 100644 --- a/src/_color.c +++ b/src/_color.c @@ -11,6 +11,7 @@ void setbgcolor(float r, float g, float b) { _br = r; _bg = g; _bb = b; + plog("%f %f %f", _br, _bg, _bb); } void fgcolor() { diff --git a/src/color.c b/src/color.c index 8f5b71b..67c3fb8 100644 --- a/src/color.c +++ b/src/color.c @@ -3,9 +3,9 @@ PARENT(trigger); IMPL(enter) { if (this->color_group) - setfgcolor(1. / 255. * this->color.r, 1. / 255. * this->color.g, - 1. / 255. * this->color.b); + setfgcolor(this->color.r / 255., this->color.g / 255., + this->color.b / 255.); else - setbgcolor(1. / 255. * this->color.r, 1. / 255. * this->color.g, - 1. / 255. * this->color.b); + setbgcolor(this->color.r / 255., this->color.g / 255., + this->color.b / 255.); } diff --git a/src/entity.c b/src/entity.c index 5f81cda..8076a86 100644 --- a/src/entity.c +++ b/src/entity.c @@ -245,5 +245,5 @@ const char *entity_propertyc(Entity *this, const char *property) { return e->valuestring; } } - return "#000000ff"; + return "#ff000000"; } diff --git a/src/trigger.c b/src/trigger.c index 987b7f9..7790d9d 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -17,10 +17,10 @@ INIT { const auto color = propertyc("color"); if (color != nullptr && strlen(color) > 8) { - this->color.r = strtobyte(color + 1); - this->color.g = strtobyte(color + 3); - this->color.b = strtobyte(color + 5); - this->color.a = strtobyte(color + 7); + this->color.r = strtobyte(color + 3); + this->color.g = strtobyte(color + 5); + this->color.b = strtobyte(color + 7); + this->color.a = strtobyte(color + 1); } else { this->color.r = 0; this->color.g = 0; -- cgit v1.2.3