Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First iteration for the new plugin system #211

Merged
merged 10 commits into from
Jun 5, 2014

Conversation

Dovyski
Copy link
Member

@Dovyski Dovyski commented May 20, 2014

This is pull request 1 of 3 regarding the new plugin system. Here's what I've done so far:

  • Implemented FlxSignal and FlxG.signals. There are a couple signals already working (e.g. preUpdate);
  • Refactored TimeManager and DebugPathDisplay to use the new plugin architecture;
  • Created a new interface (FlxPlugin) to define the structure of any plugin;

What is missing (next tasks):

  • Some docs;
  • Refactor the record functionality to make it a plugin (_already working on it_).

Please give feedback about the code and the architecture. I've tried to mimic HaxeFlixel API/names/packages when possible. After this pull request gets merged, I will start working on the record plugin.

FlxG.signals is already working. Right now it only has a single signal (reset), dispatched when FlxG.resetGame() is called.
The TimeManager plugin is now based on the new plugin architecture. It uses signals to monitor state switches.

The signal "beforeStateSwitch" was added to FlxG.signals. It is dispatched when the current state is about to be destroyed and the new state is about to be assigned as the current state.
The "postDraw" signal is dispatched after the current state has been drawn. The "preUpdate" signal is dispatched before Flixel updates the current state (and its children).

Those are the signals plugins should subscribe to in order to draw on the screen or update itself along with Flixel.

DebugPathDisplay and TimerManager have been refactored to rely on those signals.
Plugins were required to extend FlxBasic, but that makes not much sense since plugins were never added to the state display list. I've created FlxPlugin, a simple interface that makes more sense to me.

Right now the only required method plugins must implement is destroy(), which is not being invoked, by the way.
@Dovyski Dovyski added this to the Flixel v2.58 milestone May 20, 2014
I just moved all replay code from one place to another. It compiles, but it's not working. The VCR code was slightly modified, but it remains in place.
The code is a mess with hacks everywhere, but I was able to save a replay session, load and play it. Best of all, it WORKED! HA! The VRC UI is not updating, I didn't test pausing/resuming/stopping the replay.
@IQAndreas
Copy link
Member

Is this pull request still in progress, or are you still wanting to add any more commits to it before it is merged?

Sorry I haven't had a chance to have a good luck at your code yet or test it out for myself, but since you have tested it in the Sandbox, when you feel it is at a stable state and you are finished with it, you are welcome to merge it.

@Dovyski
Copy link
Member Author

Dovyski commented Jun 3, 2014

I've started working on the record functionality, which I was planning to do after the pull request got merged. I think I will just add the comments/docs I left behind and merge it.

The record functionality will be broken, but at least the new plugin architecture will be ready to be used by everyone on dev.

I've renamed FlxG_ignoreInput to FlxG.ignoreInput. There was a commented code in FlxGame regarding the VCR replay. It was removed for now and will be incorporate into the replay plugin soon.
@Dovyski
Copy link
Member Author

Dovyski commented Jun 4, 2014

I'm done adding commits to this 😄

The new plugin architecture is stable and ready to be used. I've tested it and it's good to go (excluding FlxReplay, which is broken and will be fixed in another pull request). I will merge this at the end of the day.

Dovyski added a commit that referenced this pull request Jun 5, 2014
First iteration for the new plugin system.

The replay functionality was moved to the new plugin architecture too, but it's not working.
@Dovyski Dovyski merged commit 79450d8 into FlixelCommunity:dev Jun 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants