Example #1
0
        protected override void LoadContent()
        {
            base.LoadContent();

            TestEffect = FeContent.LoadEffect("Ferret/Effects/test.fxb");
            //TestEffect = FeContent.LoadEffect("Ferret/Effects/colorPalette.fxb");

            Material postPro = new Material("Ferret/Effects/Surface/distortion.fxb");

            postPro.SetTexture("_MaskTexture", FeContent.LoadTexture("Ferret/Effects/Res/scanline.png"));
            FeGraphics.PostProcessing.PushLayer(postPro);
        }
Example #2
0
        public PlayerEntity()
        {
            Sprite[] sprites = FeContent.LoadSpriteSheet("character/charAtlas.feAsset");

            Animation           anim  = new Animation(sprites, "walk", .1f);
            AnimationController contr = new AnimationController(anim);

            Renderer          = new SpriteRenderer(sprites[0]);
            Renderer.Material = new Material(SandboxGame.TestEffect);

            AnimationComponent animComponent = new AnimationComponent(Renderer, contr);

            Bind(Renderer);
            Bind(animComponent);



            BoxCollider col = new BoxCollider(sprites[0].Width, sprites[0].Height, Vector2.Zero);

            Bind(col);

            col.OnCollisionEnter += o => FeLog.Debug($"PLAYER ENTER: {this}");
            col.OnCollisionExit  += o => FeLog.Debug($"PLAYER EXIT: {this}");


            ParticleType partType = new ParticleType(FeContent.LoadSprite("box.png"))
            {
                Lifetime       = ParticleLifetime.RandomRange(0.5f, 1f),
                StartAngle     = ParticleAngle.RandomRange(0, 360),
                StartSpeed     = ParticleSpeed.RandomRange(-2f, 2f),
                StartDirection = ParticleDirection.RandomRange(0, 360)
            };

            ParticleEmitter emitter = new ParticleEmitter(partType)
            {
                AutoEmit       = true,
                BurstCunt      = 5,
                EmitDelay      = 3,
                BurstSteps     = 8,
                BurstStepDelay = .1f
            };

            Bind(emitter);



            Bind(new PlayerComponent());
            //Bind(new PlayerComponentGamepad());
        }
Example #3
0
        internal static void LoadContent()
        {
            _graphicsDevice = _game.GraphicsDevice;

            _spriteBatch = new SpriteBatch(_game.GraphicsDevice);

            FeLog.FerretDebug($"Creating Render Target. Size = {Resolution.WindowWidth}x{Resolution.WindowHeight}");
            _renderTarget = new RenderTarget2D(GraphicsDevice, Resolution.WindowWidth, Resolution.WindowHeight);

            _currentMaterial = Material.Default;
            Materials        = new MaterialLibrary();

            Pixel       = Sprite.PlainColor(1, 1, Color.White);
            DefaultFont = FeContent.LoadFont("Ferret/Fonts/MatchupPro.ttf", 12);

            FeDraw.Font  = DefaultFont;
            FeDraw.Color = Color.White;
        }
Example #4
0
        public BoxEntity(Material mat = null)
        {
            if (mat == null)
            {
                mat = Material.Default;
            }

            Sprite sprite = FeContent.LoadSprite("box.png");

            Bind(new SpriteRenderer(sprite)
            {
                Material = mat
            });


            for (int i = 0; i < 8; i++)
            {
                Texture2D tex = new Texture2D(FeGraphics.GraphicsDevice, 24, 24);

                Color[] colors = new Color[24 * 24];
                for (int j = 0; j < 24 * 24; j++)
                {
                    colors[j] = new Color(255, 255, 255, i * 32);
                }
                tex.SetData(colors);

                Bind(new SpriteRenderer(new Sprite(tex))
                {
                    LocalPosition = new Vector2((i + 1) * 32, 0)
                });
            }



            BoxCollider col = new BoxCollider(sprite.Width, sprite.Height, Vector2.Zero);

            Bind(col);

            col.OnCollisionEnter += o => FeLog.Debug($"BOX ENTER: {this}");
            col.OnCollisionExit  += o => FeLog.Debug($"BOX EXIT: {this}");
        }
Example #5
0
 public Material(string effectPath) : this()
 {
     Effect = FeContent.LoadEffect(effectPath);
 }