HaxeFlixel / HaxeFlixel/flixel-ui

Using center_x produces a crash

Open
#205 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
201
Forks
75
PR merge metrics
No merged PRs in 30d

Description

Setting center_x to "true" in an XML layout produces the following crash:

Invalid call
Called from flixel.ui.FlxTypedButton::set_x line 585
Called from flixel.addons.ui.FlxUITypedButton::set_x line 1147
Called from flixel.addons.ui.FlxUI::_loadPosition line 4970
Called from flixel.addons.ui.FlxUI::_loadSub line 989
Called from flixel.addons.ui.FlxUI::load line 886
Called from flixel.addons.ui.FlxUIState::loadUIFromData line 388
Called from flixel.addons.ui.FlxUIState::create line 190
Called from states.CreditsState::create line 26
Called from flixel.FlxGame::switchState line 649
Called from flixel.FlxGame::update line 739
Called from flixel.FlxGame::step line 689
Called from flixel.FlxGame::onEnterFrame line 554
Called from openfl._legacy.events.EventDispatcher::dispatchEvent line 98
Called from openfl._legacy.display.DisplayObject::__dispatchEvent line 182
Called from openfl._legacy.display.DisplayObject::__broadcast line 161
Called from openfl._legacy.display.DisplayObjectContainer::__broadcast line 286
Called from openfl._legacy.display.Stage::__render line 1103
Called from openfl._legacy.display.Stage::__checkRender line 351
Called from openfl._legacy.display.Stage::__pollTimers line 1084
Called from openfl._legacy.display.Stage::__doProcessStageEvent line 430

Version info:
Haxe: 3.4.2
HaxeFlixel: 4.2.1
Flixel-UI: 2.2.0

Possible workaround: Using

center_on_x="screen"

does the trick.

Contributor guide

No contributing guide indexed for this repository

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 at FlxUI::_loadPosition, where the XML center_x value is processed, and trace the set_x calls in FlxTypedButton and FlxUITypedButton. Reproduce the crash with center_x="true" and compare it with center_on_x="screen". Done means center_x="true" loads the layout without an invalid call and centers the control on the x axis.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.