/// <summary> /// Start the application. /// </summary> static void Main(string[] args) { Console.WriteLine("Begin BonEngine demo.."); using (var scene = new WelcomeScene()) BonEngine.Start(scene); Console.WriteLine("Bye!"); }
// load the scene protected override void Load() { // init player sprite _player = new Sprite() { Position = new PointF(500, 500), Origin = new PointF(0.5f, 1.0f), Image = Assets.LoadImage("gfx/player.png") }; // create and register the custom manager _collision = new CollisionManager(); _collision.Init(_player, _targets, OnCollision); BonEngine.RegisterCustomManager(_collision); // load fonts _font = Assets.LoadFont("gfx/OpenSans-Regular.ttf", 22, false); _fontBig = Assets.LoadFont("gfx/OpenSans-Regular.ttf", 42, false); // load spritesheet from file _spritesheet = new SpriteSheet(Assets.LoadConfig("gfx/player_spritesheet.ini")); // load target image _targetImage = Assets.LoadImage("gfx/apple.png"); // create random targets var windowSize = Gfx.WindowSize; Random rand = new Random(); for (var i = 0; i < 100; ++i) { _targets.Add(new Sprite() { Image = _targetImage, Blend = BlendModes.AlphaBlend, Position = new PointF(rand.Next(windowSize.X), rand.Next(windowSize.Y)), Origin = PointF.Half }); } }