Compare commits

...

2 commits

Author SHA1 Message Date
Stephen Seo 9fb86c4cf8 Update LICENSE year 2024-01-23 13:48:46 +09:00
Stephen Seo f0ea268ab2 Fix color picking 2024-01-23 13:48:31 +09:00
2 changed files with 9 additions and 7 deletions

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2021,2023 Stephen Seo
Copyright (c) 2020-2021,2023-2024 Stephen Seo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -223,15 +223,17 @@ void Tri::State::handle_events() {
int mx = GetMouseX();
int my = GetMouseY();
if(mx < 0) { mx = 0; }
else if(mx >= (int)width) { mx = width - 1; }
else if(mx >= drawImage.width) { mx = drawImage.width - 1; }
if(my < 0) { my = 0; }
else if(my >= (int)height) { my = height - 1; }
else if(my >= drawImage.height) { my = drawImage.height - 1; }
colorPickerColor[0] = colors[mx + my * width].r;
colorPickerColor[1] = colors[mx + my * width].g;
colorPickerColor[2] = colors[mx + my * width].b;
my = drawImage.height - my;
colorPickerColor[0] = (float)(colors[mx + my * drawImage.width].r) / 255.0F;
colorPickerColor[1] = (float)(colors[mx + my * drawImage.width].g) / 255.0F;
colorPickerColor[2] = (float)(colors[mx + my * drawImage.width].b) / 255.0F;
colorPickerColor[3] = 1.0f;
pointCircle.fillColor = colors[mx + my * width];
pointCircle.fillColor = colors[mx + my * drawImage.width];
flags.reset(F_COPY_COLOR_MODE);
set_notification_text("Color set");