Skip to content

Label and Layout enhancements#461

Merged
benmoran56 merged 3 commits intopyglet:pyglet-1.5-maintenancefrom
caffeinepills:label_enhancements
Sep 16, 2021
Merged

Label and Layout enhancements#461
benmoran56 merged 3 commits intopyglet:pyglet-1.5-maintenancefrom
caffeinepills:label_enhancements

Conversation

@caffeinepills
Copy link
Copy Markdown
Collaborator

This adds a couple enhancements to existing Label and layouts to make it similar to Sprites.

Adds a visibility property. This behaves like Sprite visibility, except this deletes the vertices, then re-adds them. This also lets you change text while it's not visible.

Add opacity property for DocumentLabels. - Even though you can adjust this through color property, it gets cumbersome if all you want to do is adjust the opacity.

Add an update function to update both the x and y position simultaneously on layouts. This is a small performance speedup, since both axis can be adjusted in the same loop. In the future can be added with more functionality, for example, adding a Z axis or rotations.

@zhengxyz123
Copy link
Copy Markdown
Contributor

Can I rotate the Label?

Fix small typo.
Copy link
Copy Markdown
Member

@benmoran56 benmoran56 left a comment

Choose a reason for hiding this comment

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

Thanks! These were definitely lacking.

@benmoran56 benmoran56 merged commit 9328a17 into pyglet:pyglet-1.5-maintenance Sep 16, 2021
@benmoran56
Copy link
Copy Markdown
Member

@jason-bowen-zheng Unfortunately not. The layout class it too complex to add rotation.
Instead, it would be better to create a Texture out of a Label, and then rotate that.
Eventually we need to add an example to the Github on how to do that.

@zhengxyz123
Copy link
Copy Markdown
Contributor

@benmoran56 It seems like a good solution!

@caffeinepills
Copy link
Copy Markdown
Collaborator Author

caffeinepills commented Sep 16, 2021

Can I rotate the Label?

@jason-bowen-zheng

Not with this merge. However, this is supported in the alternate font renderer (Windows only).

See: https://github.com/pyglet/pyglet/blob/pyglet-1.5-maintenance/examples/text/advanced_font.py

@caffeinepills caffeinepills deleted the label_enhancements branch March 13, 2023 21:49
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.

3 participants