Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Added BlankEntity size modifiers#824

Merged
davesmith00000 merged 2 commits intoPurpleKingdomGames:mainfrom
exoego:size-modifiers
Jan 31, 2025
Merged

Added BlankEntity size modifiers#824
davesmith00000 merged 2 commits intoPurpleKingdomGames:mainfrom
exoego:size-modifiers

Conversation

@exoego
Copy link
Copy Markdown
Contributor

@exoego exoego commented Jan 30, 2025

Closes #813

Not sure to add size override to transform(To|By) so skipped.

  def transformTo(newPosition: Point, newRotation: Radians, newScale: Vector2, newSize: Size): BlankEntity =
    this.copy(position = newPosition, rotation = newRotation, scale = newScale, size = newSize)

  def transformBy(positionDiff: Point, rotationDiff: Radians, scaleDiff: Vector2, sizeDiff: Size): BlankEntity =
    transformTo(position + positionDiff, rotation + rotationDiff, scale * scaleDiff, size = size * sizeDiff)

davesmith00000
davesmith00000 previously approved these changes Jan 31, 2025
Copy link
Copy Markdown
Member

@davesmith00000 davesmith00000 left a comment

Choose a reason for hiding this comment

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

Perfect, thanks. 👍

@davesmith00000 davesmith00000 self-requested a review January 31, 2025 08:13
resizeTo(newSize)

def resizeBy(amount: Size): BlankEntity =
this.copy(size = size * amount)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, sorry, just noticed this. resizeBy is addition of a relative amount, so * should be +.

Copy link
Copy Markdown
Contributor Author

@exoego exoego Jan 31, 2025

Choose a reason for hiding this comment

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

Ok so only scale uses multiplication*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Correct, yes. The use-case for resizeBy is "However big it is, I need it 10x10 pixels bigger".

@davesmith00000 davesmith00000 dismissed their stale review January 31, 2025 08:15

I missed something...

Comment thread indigo/indigo/src/main/scala/indigo/shared/scenegraph/BlankEntity.scala Outdated
Copy link
Copy Markdown
Member

@davesmith00000 davesmith00000 left a comment

Choose a reason for hiding this comment

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

Thanks! 😄

@davesmith00000 davesmith00000 merged commit 8f78ae7 into PurpleKingdomGames:main Jan 31, 2025
@exoego exoego deleted the size-modifiers branch January 31, 2025 10:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BlankEntity is missing resize modifiers

2 participants