HaxeFlixel / HaxeFlixel/flixel

Problem with rendering to proper sprite coordinates

Open
#3,334 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
2.2k
Forks
522
Avg merge
34m
Merged PRs (30d)
1

Description

  • Haxe version: 4.3.6
  • Flixel version: 5.9.0
  • OpenFL version: 9.4.1
  • Lime version: 8.2.2
  • Affected targets: HL and Native (macOS arm and linux, couldn't test windows)

Code snippet reproducing the issue:

package;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.util.FlxColor;

class PlayState extends FlxState
{
	override public function create()
	{
		super.create();

		bgColor = 0xFFE40066;

		var sprite = new FlxSprite();
		sprite.makeGraphic(200, 200, 0xFF345995);
		sprite.x = FlxG.width - sprite.width;
		sprite.y = 200;
		add(sprite);
	}
	override public function update(elapsed:Float)
	{
		super.update(elapsed);
	}
}

Minimum project if you want to clone and run quickly: https://github.com/kfjustis/SpriteOffsetBug


Observed behavior: The right side of the sprite rect is not exactly flush with the edge of the play area after maximizing the game window. By maximize, I mean both resizing the window and true fullscreen.

After launching the game via lime test hl:
image

After maximizing the window via double-clicking the title bar:
image

Cropped and zoomed in to show the extremely tiny offset issue (some pink comes through between the blue sprite and the black bar on the right):
image

Expected behavior: There should be no gap between the right side of the sprite and the black bar.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided PlayState reproduction and run the minimum project using lime test hl, then compare the sprite position before and after resizing or entering fullscreen. Investigate the rendering behavior responsible for the tiny offset; done means the sprite's right edge remains flush with the play area in both maximized cases.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.