Krypton and Farseer Samples

Nov 16, 2012 at 7:01 PM
Edited Nov 16, 2012 at 7:17 PM

I noticed alot of you guys are using both Krypton and Farseer, so I figured I would give it a try. I loaded up the farseer samples xna project added Krypton Krypton Testbed and Krypton Testbed Content.  I also added KryptonEffect.fx to the farseer Samples Xna Content project. 

I deleted all the samples except AdvancedDemo1 Tested it and everything was good.

So I added a reference to Krypton to Samples XNA. In FarseerPhysicsGame.cs I added

        KryptonEngine krypton;
        private static FarseerPhysicsGame game_object;

        public FarseerPhysicsGame()

            game_object = this;

 I added Three lines for Krypton later in FarseerPhysicsGame() after Coomponents.add(screenmanager) but before FameRateCounter(as I wanted the counter ontop of any lighting)


            this.krypton = new KryptonEngine(this, "KryptonEffect");
            this.krypton.AmbientColor = new Color(255, 255, 255);
            FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager);

 Then I added the following as methods of FarseerPhysicsGame.cs so I could get to Krypton from advancedDemo1

        public static T GetComponent<T>() where T : GameComponent
            foreach (GameComponent gc in game_object.Components) // game_object is my static singleton, assigned in the Game constructor
                if (gc.GetType().Equals(typeof(T)))
                    return (T)gc;

            return null;

        public static T GetService<T>()
            return (T)game_object.Services.GetService(typeof(T));

Now I thought this would just work outright and give me the game just slightly dimmed as I put the ambient light at 255.  Instead I just get a black screen.

What am I doing Wrong?


ps I did try zooming out and moving around too make sure there wasnt light somewhere else.

Oh when the above failed I also tryed adding the following to the loadcontent method of AdvancedDemo1

Krypton.KryptonEngine krypton;

            krypton = FarseerPhysicsGame.GetComponent<Krypton.KryptonEngine>();

            Texture2D texture = Krypton.LightTextureBuilder.CreatePointLight(ScreenManager.GraphicsDevice, 512);

            Krypton.Lights.Light2D light = new Krypton.Lights.Light2D()
                Texture = texture,
                Range = 20000,
                Color = Color.White,
                //Intensity = (float)(this.mRandom.NextDouble() * 0.25 + 0.75),
                Intensity = 10f,
                Angle = MathHelper.TwoPi * 2,
                X = 0,
                Y = 0,

This didnt work either.
PPS I forgot to mention I also tried setting Cullmode to none and clockwiseFace.  That didnt seem to help either.