Coder Social home page Coder Social logo

robotlegs-utilities-starling's Introduction

RoboStarlegs

Build Status

RoboStarlegs allows you to use Robotlegs with Starling and any other library based on that, like Feathers, in the same fashion you'd use it with the regular Flash display list or Flex.

Introduction

This extension provides a bundle of plugins for Robotlegs that are aimed at mimicking the functionalities we all love on a standard Flash/Flex display list when using Starling/Feathers on Stage3D.

Automatic mediator mapping is not something you will want to use extensively on your games, especially if you're focusign on getting the beste possible performances out of it, but it's incredibly useful for kickstarting the game and handle all the UI operations. It also makes it easier to convert your Flex-based rich application into an incredibly fast performancing app thanks to Feathers.

Releases

You'll find new versions of the extension in the Releases page of the repository.

Usage

From your main class, when you initialize Starling, create a Robotlegs Context and install the StarlingBundle and the ViewProcessMapExtension. You'll to use the right version of the ContextView to pass your Starling instance to the Robotleg's context so mind those imports!

	import robotlegs.starling.bundles.mvcs.StarlingBundle;
	import robotlegs.starling.extensions.contextView.ContextView;
	import robotlegs.starling.extensions.viewProcessorMap.ViewProcessorMapExtension;

	...

	private var context:IContext;
	private var starling:Starling;

	...

	starling = new Starling(Game, this.stage);
	starling.start();

	context = new Context()
				  .install(StarlingBundle, ViewProcessorMapExtension)
				  .configure(GameConfig, new ContextView(starling))

You can now start mapping all your commands and classes like you would in a normal Robotlegs application.

When it comes to views and mediators, there's an extra step to take if you want them to be mapped automatically. The ViewProcessorMap needs to be informed .

In your GameConfig you'll have someting like:

package {

import you.package.views.BaseScreen;

import robotlegs.bender.extensions.matching.TypeMatcher;
import robotlegs.bender.framework.api.IConfig;
import robotlegs.starling.extensions.viewProcessorMap.api.IViewProcessorMap;

public class GameConfig implements IConfig {

	...

    [Inject]
    public var views:IViewProcessorMap;

    public function configure():void {

    	...
        views.mapMatcher(new TypeMatcher().allOf(BaseScreen)).toInjection();
        ...
    }
}
}

Where BaseScreen is an abstract class that all your views are going to extend.

As I said, processing every instance added or remove from the screen could become an expensive process, so you don't want to process more instances then you need: don't go around creating matchers for starling.display.Sprite or some other very generic class, unless you want it to have a big impact on your game's performances ...

Building

In the gradle folder, make a copy of the user.properties.eg file and call it user.properties Edit that file to provide values specific to your system
Use the gradlew script to build the project

Contributing

If you want to contribute to the project refer to the contributing document for guidelines.

robotlegs-utilities-starling's People

Contributors

alebianco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

robotlegs-utilities-starling's Issues

Compatibility with MVCSBundle

Hi. I tried to use StarlingBundle and MVCSBundle in the same context. I got an error from Robotlegs saying that "A context view must be installed if you install the ContextView extension". I am using the root class as the context view:

new Context ()
.install(MVCSBundle)
.install(StarlingBundle)
.configure(MyConfig)
.configure(new robotlegs.bender.extensions.contextView.ContextView (this))
.configure(new robotlegs.starling.extensions.contextView.ContextView (myStarlingInstance));

If I change the order of configurations to this...

new Context ()
.install(MVCSBundle)
.install(StarlingBundle)
.configure(MyConfig)
.configure(new robotlegs.starling.extensions.contextView.ContextView (myStarlingInstance));
.configure(new robotlegs.bender.extensions.contextView.ContextView (this))

...I get a different error: "The Starling instance needs to be ready before assets can be loaded"

Is StarlingBundle compatible with MVCSBundle?

Support for modularity extension

Hi. I can see you commented the ModularityExtensionn in StarlingBundle. Do you have any plans to add support for it?

I am trying to use several screens, each one with its own context. I have some global mappings that need to be used in screens (eg. database layer), but without modularity extension it does not work. Is there another way?

Multiple initialization of Mediator

Hi,
I'm using your latest master commit with Feathers 2.1 BETA and having some issues.
With new StackScreenNavigator when transitioning (let's say Cover transition) to another view, first view is added to temp container (feathers/motion/Cover.as line 289) and at the same time the mediator responsible for that view is initialized for the second time, and so on for every view.

Problem could be in StageObserver line 82 and use of Event.ADDED instead of Event.ADDED_TO_STAGE. This is just assumption.

Please can you check what is the problem.
And also, sorry for my broken English :D

TypeError: Error #1034: Type Coercion failed: cannot convert to robotlegs.starling.extensions.viewProcessorMap.impl.IViewProcessorViewHandler

Hi. I am trying to set up a basic app to try this utility, and once I run it I get this error:

´TypeError: Error #1034: Type Coercion failed: cannot convert  to robotlegs.starling.extensions.viewProcessorMap.impl.IViewProcessorViewHandler.
    at robotlegs.starling.extensions.viewProcessorMap.impl::ViewProcessorMap()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-utilities-starling\src\robotlegs\starling\extensions\viewProcessorMap\impl\ViewProcessorMap.as:45]
    at org.swiftsuspenders.typedescriptions::ConstructorInjectionPoint/createInstance()[/Users/shaun/dev/projects/SwiftSuspenders/src/org/swiftsuspenders/typedescriptions/ConstructorInjectionPoint.as:31]
    at org.swiftsuspenders::Injector/instantiateUnmapped()[/Users/shaun/dev/projects/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:440]
    at org.swiftsuspenders.dependencyproviders::SingletonProvider/createResponse()[/Users/shaun/dev/projects/SwiftSuspenders/src/org/swiftsuspenders/dependencyproviders/SingletonProvider.as:59]
    at org.swiftsuspenders.dependencyproviders::SingletonProvider/apply()[/Users/shaun/dev/projects/SwiftSuspenders/src/org/swiftsuspenders/dependencyproviders/SingletonProvider.as:47]
    at org.swiftsuspenders::Injector/getInstance()[/Users/shaun/dev/projects/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:394]
    at robotlegs.starling.extensions.viewProcessorMap::ViewProcessorMapExtension/beforeInitializing()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-utilities-starling\src\robotlegs\starling\extensions\viewProcessorMap\ViewProcessorMapExtension.as:61]
    at MessageRunner/next()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-framework\src\robotlegs\bender\framework\impl\MessageDispatcher.as:152]
    at MessageRunner/run()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-framework\src\robotlegs\bender\framework\impl\MessageDispatcher.as:135]
    at robotlegs.bender.framework.impl::MessageDispatcher/dispatchMessage()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-framework\src\robotlegs\bender\framework\impl\MessageDispatcher.as:87]
    at robotlegs.bender.framework.impl::LifecycleTransition/enter()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-framework\src\robotlegs\bender\framework\impl\LifecycleTransition.as:191]
    at robotlegs.bender.framework.impl::Lifecycle/initialize()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-framework\src\robotlegs\bender\framework\impl\Lifecycle.as:149]
    at robotlegs.bender.framework.impl::Context/initialize()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-framework\src\robotlegs\bender\framework\impl\Context.as:159]
    at robotlegs.starling.extensions.contextView::StageSyncExtension/initializeContext()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-utilities-starling\src\robotlegs\starling\extensions\contextView\StageSyncExtension.as:98]
    at robotlegs.starling.extensions.contextView::StageSyncExtension/onRootCreated()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\robotlegs-utilities-starling\src\robotlegs\starling\extensions\contextView\StageSyncExtension.as:80]
    at starling.events::EventDispatcher/invokeEvent()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\starling\src\starling\events\EventDispatcher.as:146]
    at starling.events::EventDispatcher/dispatchEvent()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\starling\src\starling\events\EventDispatcher.as:117]
    at starling.events::EventDispatcher/dispatchEventWith()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\starling\src\starling\events\EventDispatcher.as:195]
    at starling.core::Starling/initializeRoot()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\starling\src\starling\core\Starling.as:453]
    at starling.core::Starling/initialize()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\starling\src\starling\core\Starling.as:426]
    at starling.core::Starling/onContextCreated()[E:\Kitchen\Cooking\The Prophecy III\src\workspace\starling\src\starling\core\Starling.as:671]

I have no idea about what is happening there. I just followed the instructions on the README.
I am using Robotlegs 2.2.1, Starling 1.6 and Feathers 2.1.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.