Wizcorp / Ejecta-X

A Fast, Open Source JavaScript, Canvas & Audio Implementation
http://wizcorp.github.io/Ejecta-X
185 stars 50 forks source link

Phaser/Pixi integration issue #64

Closed petejank closed 9 years ago

petejank commented 10 years ago

Did anyone have any luck integrating Phaser or Pixi with Ejecta-X? Seems that I have pretty much a problem here - every time I run my game on the device I get a black screen. What I did to prepare application for deployment (using Ejecta-X version 0.2.0):

I. Put all JavaScript and asset files (eg. images) in assets/build directory II. Add all JavaScript files to onCanvasCreated method. Eg:

[...]
            public void onCanvasCreated() {
                Log.d("ejecta", "Event: Canvas was created");
                ((EjectaGLSurfaceView)mGLView).loadJavaScriptFile("ejecta.js");
                // General shiet
                ((EjectaGLSurfaceView)mGLView).loadJavaScriptFile("vendor/phaser/build/phaser.js");
                ((EjectaGLSurfaceView)mGLView).loadJavaScriptFile("vendor/lodash.min.js");
                ((EjectaGLSurfaceView)mGLView).loadJavaScriptFile("index.js");
                // Controllers
                ((EjectaGLSurfaceView)mGLView).loadJavaScriptFile("app/controller/GameInputController.js");
                ((EjectaGLSurfaceView)mGLView).loadJavaScriptFile("app/controller/MeteorSpawnController.js");
                ((EjectaGLSurfaceView)mGLView).loadJavaScriptFile("app/controller/FoodSpawnController.js");
[...]

III. Build the application

Index.js in my example contains standard Phaser booting (with stripped window.onload = ...):

'use strict';

var GameSpace = {};

    GameSpace.game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO);
    GameSpace.game.state.add('Boot', GameSpace.BootState);
    GameSpace.game.state.add('Preload', GameSpace.PreloadState);
    GameSpace.game.state.add('Menu', GameSpace.MenuState);
    GameSpace.game.state.add('Game', GameSpace.GameState);

    GameSpace.game.state.start('Boot');

I'm using Phaser version 1.1.3 (issue occurs also for 2.0.3).

It's worth mentioning that the sample provided with Ejecta-X works fine for me.

Any idea would be greatly appreciated. Cheers.

aogilvie commented 10 years ago

It would be very cool to get Phaser working with Ejecta-X, I'm not aware of the inner workings of that framework though. Do you have any error logs?

petejank commented 9 years ago

Och man, sorry for the delay in answer. I'll take a look next week and give a response about it

f0rmiga commented 9 years ago

Are your images power of two? I had this problem in the past not with Ejecta-X, but it is realted to OpenGL ES in Android I guess... not sure...

petejank commented 9 years ago

Sorry guys for lack of response, but during that time I've decided to rewrite my project to Unity3D due to overall JavaScript native export issues ;(

weepy commented 9 years ago

ah ! what to you mean by "native export issues" ?

On Mon Dec 01 2014 at 9:11:08 AM Peter Jankowski notifications@github.com wrote:

Sorry guys for lack of response, but during that time I've decided to rewrite my project to Unity3D due to overall JavaScript native export issues ;(

— Reply to this email directly or view it on GitHub https://github.com/Wizcorp/Ejecta-X/issues/64#issuecomment-65037034.

aogilvie commented 9 years ago

Closing for now