static LPC() { FrameTime = SFML.System.Time.FromMilliseconds(100); IdleLoop = new LoopingAnimation(FrameTime, (13 * 10), 1); WalkUp = new LoopingAnimation(FrameTime, (13 * 8), 9); WalkDown = new LoopingAnimation(FrameTime, (13 * 10), 9); WalkLeft = new LoopingAnimation(FrameTime, (13 * 9), 9); WalkRight = new LoopingAnimation(FrameTime, (13 * 11), 9); SlashUp = new Animation(FrameTime, (13 * 12), 6); SlashUpLoop = new LoopingAnimation(FrameTime, (13 * 12)); SlashDown = new Animation(FrameTime, (13 * 14), 6); SlashDownLoop = new LoopingAnimation(FrameTime, (13 * 14), 6); SlashLeft = new Animation(FrameTime, (13 * 13), 6); SlashLeftLoop = new LoopingAnimation(FrameTime, (13 * 13), 6); SlashRight = new Animation(FrameTime, (13 * 15), 6); SlashRightLoop = new LoopingAnimation(FrameTime, (13 * 15), 6); ThrustUp = new Animation(FrameTime, 13 * 4, 8); ThrustUpLoop = new LoopingAnimation(ThrustUp); ThrustDown = new Animation(FrameTime, 13 * 6, 8); ThrustDownLoop = new LoopingAnimation(ThrustDown); ThrustLeft = new Animation(FrameTime, 13 * 5, 8); ThrustLeftLoop = new LoopingAnimation(ThrustLeft); ThrustRight = new Animation(FrameTime, 13 * 7, 8); ThrustRightLoop = new LoopingAnimation(ThrustRight); ShootUp = new Animation(FrameTime, (13 * 16), 13); ShootUpLoop = new LoopingAnimation(ShootUp); ShootDown = new Animation(FrameTime, (13 * 18), 13); ShootDownLoop = new LoopingAnimation(ShootDown); ShootLeft = new Animation(FrameTime, (13 * 17), 13); ShootLeftLoop = new LoopingAnimation(ShootLeft); ShootRight = new Animation(FrameTime, (13 * 19), 13); ShootRightLoop = new LoopingAnimation(ShootRight); SpellcastUp = new Animation(FrameTime, 0, 7); SpellcastUpLoop = new LoopingAnimation(SpellcastUp); SpellcastDown = new Animation(FrameTime, 13 * 1, 7); SpellcastDownLoop = new LoopingAnimation(SpellcastDown); SpellcastLeft = new Animation(FrameTime, 13 * 2, 7); SpellcastLeftLoop = new LoopingAnimation(SpellcastLeft); SpellcastRight = new Animation(FrameTime, 13 * 3, 7); SpellcastRightLoop = new LoopingAnimation(SpellcastRight); StandardFrameHelper = new Graphics.Texels.FrameHelper(64, 64); OversizedFrameHelper = new Graphics.Texels.FrameHelper(64, 64); }
//////////////////////// // Métodos //////////////////////// public void Init() { _logger.Log(LogLevel.Info, " > Configurando aplicación."); // buffer 32 bits de colors ContextSettings contextSettings = new ContextSettings(); contextSettings.DepthBits = 32; // Creamos la ventana principal _logger.Log(LogLevel.Info, " >> Creando ventana principal."); // ventana no redimensionable _window = new RenderWindow(new VideoMode(800, 600), "Galaga ", Styles.Close, contextSettings); // gestor de escenas _logger.Log(LogLevel.Info, " >> Creando gestor de escenas."); _scnManager = new SceneManager(); // Se crea el gestor de recursos y se leen los elementos _logger.Log(LogLevel.Info, " >> Creando gestor de recursos."); _resManager = new ResourcesManager( this.GetType().Assembly.GetManifestResourceStream("Galaga.main.resxml")); _resManager.RegisterLoadFunction("texture", SFMLResourcesManager.LoadTexture); _resManager.RegisterLoadFunction("font", SFMLResourcesManager.LoadFont); // creación del contexto _context = new Scene.Context(_window, _resManager); _timePerFrame = SFML.System.Time.FromSeconds(1f / 40f); // como mínimo 40 frames por segundo _isPaused = false; RegisterDelegates(); RegisterScenes(); // pongo la primera escena en la pila _logger.Log(LogLevel.Info, " >> Push escena principal."); _scnManager.Push((int)SceneID.TITLE); }