-
Notifications
You must be signed in to change notification settings - Fork 52
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
support custom attributes defined in scenarios #1058
Conversation
259c91a
to
1bcac2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome! 💜 💙 💚 💛 🧡 ❤️
src/Swarm/Game/Scenario/Style.hs
Outdated
where | ||
addFg = maybe id (flip withForeColor . toAttrColor) $ fg ca | ||
addBg = maybe id (flip withBackColor . toAttrColor) $ bg ca | ||
addStyle = maybe id (flip withStyle . sum . map toStyle . toList) $ style ca |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Swarm/Game/Scenario/Style.hs
Outdated
import GHC.Generics (Generic) | ||
import Graphics.Vty.Attributes | ||
import Numeric (readHex) | ||
import Swarm.TUI.Attr (worldPrefix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @xsebek , I think it would be better to do this in a way that didn't depend on anything in Swarm.TUI.*
, partly just out of a sense that conceptually the abstract game should not depend on the specifics of the user interface, and partly for the practical reason that we might want to have different interfaces in the future.
Previously, custom attributes with only a foreground or only a background set would inherit the foreground/background to the left of them. This is due to mistakenly using `currentAttr` instead of `defAttr` in #1058. | Version | Screenshot | | --- | --- | | Before | ![Screenshot from 2023-02-28 22-38-55](https://user-images.githubusercontent.com/261693/222064852-11527d25-67b4-4f81-9733-d11ea40462cc.png) | | Fixed | ![Screenshot from 2023-02-28 22-44-20](https://user-images.githubusercontent.com/261693/222064883-07edb0dd-a233-4082-97da-c887efce5799.png) |
closes #1034
Demo