Skip to content

Minor change to set_drawFramerate #3621

Description

@SimonArs

Maybe its better to change drawFramerate setter a bit?

From:

static function set_drawFramerate(value:Int):Int
{
	if (value > updateFramerate)
		log.warn("FlxG.drawFramerate: the update framerate shouldn't be smaller than the draw framerate," + " since it can stop your game from updating.");

	drawFramerate = Std.int(Math.abs(value));

	if (game.stage != null)
		game.stage.frameRate = drawFramerate;

	game._maxAccumulation = 2000 / drawFramerate - 1;

	if (game._maxAccumulation < game._stepMS)
		game._maxAccumulation = game._stepMS;

	return value;
}

to:

static function set_drawFramerate(value:Int):Int
{
	if (value > updateFramerate)
		log.warn("FlxG.drawFramerate: the update framerate shouldn't be smaller than the draw framerate," + " since it can stop your game from updating.");

	value = Std.int(Math.abs(value));

	if (game.stage != null)
		game.stage.frameRate = value;

	game._maxAccumulation = 2000 / value - 1;

	if (game._maxAccumulation < game._stepMS)
		game._maxAccumulation = game._stepMS;

	return drawFramerate = value;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions