Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color Clipboard #3100

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Color Clipboard #3100

wants to merge 13 commits into from

Conversation

bruhmoent
Copy link
Member

@bruhmoent bruhmoent commented Nov 15, 2024

This PR adds three new options to the Color Menu:

  • Copy to clipboard (rgb),
  • Copy to clipboard (hex),
  • Paste from clipboard

These options enable users to copy and paste colors between objects with the color menu via the SDL's clipboard feature.

@bruhmoent bruhmoent changed the title Implement the color clipboard Color Clipboard Nov 15, 2024
src/gui/color_clipboard.hpp Outdated Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
@MatusGuy
Copy link
Member

What is this? Please describe this feature in the pr description.

Copy link
Member

@MatusGuy MatusGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this copy to an in-game clipboard or the system clipboard? This feature might be confusing for users who want to copy/paste a color to outside of supertux.

You could parse a hex color value from the system clipboard which in my opinion would provide a better experience.

You can use SDL's clipboard functionality to do this.

@bruhmoent
Copy link
Member Author

I can do that, sure. I'm still gonna keep the current in game functionality, but I'm gonna also add parsing it from the clipboard upon clicking the paste entry.

Copy link
Member

@MatusGuy MatusGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/video/color.cpp Outdated Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/video/color.hpp Outdated Show resolved Hide resolved
Copy link
Member

@Vankata453 Vankata453 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only reviewed code for now.

src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
src/video/color.cpp Outdated Show resolved Hide resolved
src/video/color.hpp Outdated Show resolved Hide resolved
src/gui/menu_item.hpp Show resolved Hide resolved
src/gui/menu_color.cpp Outdated Show resolved Hide resolved
Copy link
Member

@Vankata453 Vankata453 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good code-wise.

src/gui/menu_item.hpp Show resolved Hide resolved
src/gui/item_action.cpp Outdated Show resolved Hide resolved
Co-authored-by: Marty <[email protected]>
@@ -22,7 +22,7 @@
class ItemAction final : public MenuItem
{
public:
ItemAction(const std::string& text, int id = -1, std::function<void()> callback = {});
ItemAction(const std::string& text, int id = -1, std::function<void()> callback = {}, const Color& text_color = Color(1.f, 1.f, 1.f));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have a Color::WHITE constant somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants