0

My PhysicsHandler class seems to be causing Luxe to quit unexpectedly, and I have no idea why.

Everything runs fine until I declare a class-variable, at which point it crashes a couple of seconds after loading. What's weird is that I have another class (InputHandler) that declares class-variables and runs fine. Not sure whether this is a problem with my code (somehow... ), Luxe, or Flow.

Main class:

import luxe.Input;
import luxe.Parcel;
import luxe.ParcelProgress;

import InputHandler;
import PhysicsHandler;
import Player;

enum GAME_STATE
{
    play;
    pause;
}

class Main extends luxe.Game {

    var INPUT_HANDLER: InputHandler;

    override function ready() {
        var assetsParcel = new Parcel
        ({
            textures:
            [
                { id:"assets/block.png" },
                { id:"assets/background.png" }
            ]
        });

        new ParcelProgress
        ({
            parcel : assetsParcel,
            oncomplete : onAssetsLoaded
        });

        assetsParcel.load();

        INPUT_HANDLER = new InputHandler();
        INPUT_HANDLER.GameState = GAME_STATE.play;
    } 

    private function onAssetsLoaded(_)
    {
        var player = new Player();

        INPUT_HANDLER.setPlayerEntity(player);
    }

    override function update(dt:Float) {
        INPUT_HANDLER.update();
    } 

} 

InputHandler class:

import luxe.Input;
import luxe.Entity;

import Main;

class InputHandler
{
    public var GameState: EnumValue;

    private var player: Entity;

    // functions, etc. below here...

}

PhysicsHandler class (the troublemaker... ):

import Main;

class PhysicsHandler
{
    public var GameState: EnumValue;
}

This is all it takes to crash the game somehow. As you can see, I'm not even instantiating the PhysicsHandler class yet, just importing it.

Gama11
  • 31,714
  • 9
  • 78
  • 100
  • 1
    "It crashes" is not a lot of debugging info to go on. What target is that? If it's cpp, you might want to define `HXCPP_STACK_LINE` and `HXCPP_STACK_TRACE`. – Gama11 Nov 28 '15 at 15:23
  • Without specific info on the crash type, I'm not sure if it's related or not... But did you notice that you are calling `assetsParcel.load()` (which eventually calls `INPUT_HANDLER.setPlayerEntity(player)`) before actually setting your `INPUT_HANDLER` to something other than `null`? – Jonas Malaco Nov 28 '15 at 17:48
  • @Gama11 - the weirdest thing is that everything seems fine when running in debug-mode so I don't think I can be any more specific than that. – agaricaceae Nov 30 '15 at 08:16
  • @jonasmalacofilho - I've moved the `INPUT_HANDLER` instantiation up above the call to `assetsParcel.load()` - good spot. Unfortunately, it's not had any effect on the original problem. – agaricaceae Nov 30 '15 at 08:20

1 Answers1

1

Okay, so I was able to sort this with some help on the Snowkit forums. Apparently, Luxe doesn't play well with the latest version of hxcpp, so downgrading to 3.2.102 worked. Result.