Author Topic: Organizing Flixel a tad better  (Read 1903 times)

IQAndreas

  • Member
  • **
  • Posts: 35
  • Karma: +0/-0
    • View Profile
    • IQAndreas.com
Organizing Flixel a tad better
« on: Fri, Dec 23, 2011 »
I find that "FlxU" and "FlxG" are far to cluttered, so in a new branch, I rearranged things a little better (adding new classes where needed).
https://github.com/IQAndreas/flixel/tree/dev_organizing_flixel

FlxM (FlixelMath) - Contains all the math functions from FlxU
FlxColor (I didn't abbreviate it) - Contains the color functions from FlxU, and the static color constants from FlxG. Also added a static "getGrey(brightness, alpha)" function, since it is oh so handy!
FlxG.effects - Now in plugin format! Contains those "FlxG.flash", "FlxG.fade" etc functions. New effects can be added by modifying the org.flixel.plugins.FlxEffects class.
FlxG.vcr - Contains static functions for loading/pausing/playing replays.

So far, I have resisted the urge to move the "format" static functions in FlxU to "FlxS" (FlixelString), but if any "region support" for such formatting appears in Flixel, I definitely think that's where the functions should go.

The full list of changes can be viewed here:
https://github.com/IQAndreas/flixel/commits/dev_organizing_flixel


I just organized the code this way because to me it's now more logically arranged and less cluttered. (but of course, it isn't reverse compatible, so any code will need to be updated to use this new version.) I made sure that all changed functions where "infrequently used", so moving them to a separate class wouldn't take a performance hit.

What are your thoughts? Bad idea? Good idea?
Are there any other parts that could be organized better?
« Last Edit: Mon, Jan 9, 2012 by IQAndreas »

axcho

  • Active Member
  • ***
  • Posts: 174
  • Karma: +0/-0
    • View Profile
    • Evolution Live!
Re: Organizing Flixel a tad better
« Reply #1 on: Sat, Dec 24, 2011 »
It's a good idea for some people.

Personally, I much prefer it the other way, just FlxG and FlxU, because it looks cleaner and I don't have to type everything out. FlashDevelop autocomplete for the win! :)