예제 #1
0
        protected override void InitializeService()
        {
            if (Configuration.sounds == false)
            {
                SetupNoSounds();
                return;
            }
            try
            {
                implementation = new FModSounds();

                Collision = new FModSound("res/audio/collision.wav");
                Ui        = new FModSound("res/audio/tsiuh_short.wav");
                Up        = new FModSound("res/audio/up.wav");
                Down      = new FModSound("res/audio/down.wav");
                Up2       = new FModSound("res/audio/up2.wav");
                Down2     = new FModSound("res/audio/down2.wav");
                Hi        = new FModSound("res/audio/ui_blui.wav");
                Lo        = new FModSound("res/audio/lo2.wav");
                Insert    = new FModSound("res/audio/insert.wav");
            }
            catch (System.Exception)
            {
                SetupNoSounds();
                System.Diagnostics.Trace.TraceWarning("Warning: Sounds disabled");
            }
        }
예제 #2
0
 public static void Initialize(
     IConsole console,
     ISurface surface,
     IStyle style,
     IDrawings drawing,
     IShapes shapes,
     IImages images,
     IControls controls,
     ISounds sounds,
     IKeyboard keyboard,
     IMouse mouse,
     ITimer timer,
     IFlickr flickr,
     ISpeech speech,
     CancellationToken token)
 {
     TextWindow.Init(console);
     Desktop.Init(surface);
     GraphicsWindow.Init(style, surface, drawing, keyboard, mouse);
     Shapes.Init(shapes);
     ImageList.Init(images);
     Turtle.Init(surface, drawing, shapes);
     Controls.Init(controls);
     Sound.Init(sounds);
     Timer.Init(timer);
     Stack.Init();
     Flickr.Init(flickr);
     Speech.Init(speech);
     Program.Init(token);
 }
예제 #3
0
파일: _Library.cs 프로젝트: mrange/funbasic
 public static void Initialize(         
  IConsole console,
  ISurface surface,
  IStyle style,
  IDrawings drawing,
  IShapes shapes,
  IImages images,
  IControls controls,
  ISounds sounds,         
  IKeyboard keyboard,
  IMouse mouse,
  ITimer timer,
  IFlickr flickr,
  ISpeech speech,
  CancellationToken token)
 {
     TextWindow.Init(console);
      Desktop.Init(surface);
      GraphicsWindow.Init(style, surface, drawing, keyboard, mouse);
      Shapes.Init(shapes);
      ImageList.Init(images);
      Turtle.Init(surface, drawing, shapes);
      Controls.Init(controls);
      Sound.Init(sounds);
      Timer.Init(timer);
      Stack.Init();
      Flickr.Init(flickr);
      Speech.Init(speech);
      Program.Init(token);
 }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the Ball class.
        /// </summary>
        /// <param name="asyncGraphics">Graphics object reference</param>
        /// <param name="displayWidth">Width of the display</param>
        /// <param name="displayHeight">Height of the display</param>
        /// <param name="backgroundColor">Background color of the display</param>
        /// <param name="paddle">Reference to the game's paddle object</param>
        /// <param name="soundGenerator">Reference to the game's sound generator object</param>
        /// <param name="minimumY">Minimum y coordinate to use the the ball's enclosing rectangle</param>
        /// <param name="scoreKeeper">Reference to the game's scorekeeper object</param>
        public Ball(
            AsyncGraphics asyncGraphics,
            int displayWidth,
            int displayHeight,
            Color backgroundColor,
            Paddle paddle,
            ISounds soundGenerator,
            int minimumY,
            ScoreKeeper scoreKeeper)
        {
            this.asyncGraphics  = asyncGraphics;
            this.soundGenerator = soundGenerator;

            this.scoreKeeper = scoreKeeper;

            this.backgroundColor = backgroundColor;
            this.paddle          = paddle;

            this.displayWidth = displayWidth;
            this.maxX         = displayWidth - this.width;
            this.maxY         = displayHeight - this.height - Paddle.HEIGHT;
            this.minY         = minimumY;
            this.yPosition    = this.minY + 5;

            this.moveTimer.AutoReset = true;
            this.moveTimer.Elapsed  += this.MoveTimer_Elapsed;
        }
예제 #5
0
 private void SetupNoSounds()
 {
     implementation = new NoSounds();
     Collision      = new NoSound();
     Ui             = new NoSound();
     Up             = new NoSound();
     Down           = new NoSound();
     Up2            = new NoSound();
     Down2          = new NoSound();
     Hi             = new NoSound();
     Lo             = new NoSound();
     Insert         = new NoSound();
 }
예제 #6
0
파일: Engine.cs 프로젝트: Jebeli/Tiles
 public Engine(IFileResolver fileResolver, IGraphics graphics, IFontEngine fonts, ISounds sounds = null)
 {
     this.fileResolver = fileResolver;
     this.graphics     = graphics;
     this.fonts        = fonts;
     this.sounds       = sounds;
     if (sounds == null)
     {
         this.sounds = new NoSounds();
     }
     timeProvider    = new StopWatchTimeInfoProvider();
     input           = new BasicInput();
     textureManager  = new ResourceManager <Texture>();
     tileSetManager  = new ResourceManager <TileSet>();
     musicManager    = new ResourceManager <Music>();
     soundManager    = new ResourceManager <Sound>();
     eventManager    = new EventManager(this);
     entityManager   = new EntityManager(this);
     enemyManager    = new EnemyManager(this);
     campaignManager = new CampaignManager();
     currentScreen   = new NullScreen(this);
     mapScreen       = new MapScreen(this);
     loadScreen      = new LoadScreen(this);
     splashScreen    = new SplashScreen(this);
     titleScreen     = new TitleScreen(this);
     exitScreen      = new ExitScreen(this);
     testScreen      = new TestScreen(this);
     map             = MapFactory.MakeNullMap(this);
     camera          = new Camera(this, map);
     frameCounter    = new FrameCounter();
     loaders         = new List <ILoader>();
     loaders.Add(new XmlLoader(this));
     loaders.Add(new IniLoader(this));
     savers = new List <ISaver>();
     savers.Add(new IniSaver(this));
     savers.Add(new XmlSaver(this));
     nextEnemyTemplates = new List <string>();
 }
예제 #7
0
 internal static void Init(ISounds sounds)
 {
     _sounds = sounds;
 }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the MeadowApp class
        /// </summary>
        public MeadowApp()
        {
            MeadowApp.DebugWriteLine("Initializing...");

            this.soundGenerator = new SoundGenerator(
                Device.CreateDigitalInputPort(Device.Pins.D03),
                Device.CreateDigitalInputPort(Device.Pins.D04),
                Device.CreatePwmPort(Device.Pins.D07));

            var config = new SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode3);

            this.rotaryPaddle          = new RotaryEncoderWithButton(Device, Device.Pins.D10, Device.Pins.D09, Device.Pins.D08, debounceDuration: 100);
            this.rotaryPaddle.Rotated += this.RotaryPaddle_Rotated;

            this.st7789 = new St7789(
                device: Device,
                spiBus: Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config),
                chipSelectPin: Device.Pins.D02,
                dcPin: Device.Pins.D01,
                resetPin: Device.Pins.D00,
                width: 240,
                height: 240);

            this.displayWidth  = Convert.ToInt32(this.st7789.Width);
            this.displayHeight = Convert.ToInt32(this.st7789.Height);

            GraphicsLibrary graphics = new GraphicsLibrary(this.st7789)
            {
                Rotation = GraphicsLibrary.RotationType._270Degrees
            };

            this.asyncGraphics = new AsyncGraphics(graphics);

            this.debounceTimer.AutoReset = false;
            this.debounceTimer.Elapsed  += this.DebounceTimer_Elapsed;

            this.backgroundColor = Color.Blue;

            this.scoreBanner = new Banner(this.displayWidth, this.asyncGraphics, fontHeight: 16, this.backgroundColor, color: Color.Yellow, top: 0)
            {
                Text = Banner.SCORE_TEXT
            };

            this.instructionBanner = new Banner(
                displayWidth: this.displayWidth,
                graphics: this.asyncGraphics,
                fontHeight: 16,
                backgroundColor: this.backgroundColor,
                color: Color.White,
                top: Banner.HEIGHT * 2);
            this.ShowInstructionBanner(Banner.START_TEXT);

            this.paddle = new Paddle(this.asyncGraphics, this.displayWidth, this.displayWidth, this.backgroundColor);

            this.scoreKeeper = new ScoreKeeper();
            this.scoreKeeper.ScoreChanged += this.scoreBanner.OnScoreChanged;

            this.ball = new Ball(
                asyncGraphics: this.asyncGraphics,
                displayWidth: this.displayWidth,
                displayHeight: this.displayHeight,
                backgroundColor: this.backgroundColor,
                paddle: this.paddle,
                soundGenerator: this.soundGenerator,
                minimumY: Banner.HEIGHT + 1,
                scoreKeeper: this.scoreKeeper);

            this.ball.ExplosionOccurred += this.OnExplosionOccurred;

            this.rotaryPaddle.Clicked += this.RotaryPaddle_Clicked;

            this.soundGenerator.PlayConstructionCompleteSound();
        }
예제 #9
0
 public PixSound(ISounds staticSoundPlayTable)
 {
     SoundEngine = staticSoundPlayTable;
 }
예제 #10
0
파일: World.cs 프로젝트: Onin1/shootmup
        public World(IGraphics surface, ISounds sounds)
        {
            // init
            Ephemerial = new List <EphemerialElement>();
            int width      = 10000;
            int height     = 10000;
            int numPlayers = 100;

            Menu = new Title()
            {
                Players = numPlayers
            };

            // graphics
            Surface = surface;
            Surface.SetTranslateCoordinates(TranslateCoordinates);
            ZoomFactor = 1;
            Background = new Restriction(width, height);

            // sounds
            Sounds = sounds;

            // create players
            Human = new Player()
            {
                Name = "You"
            };
            int playerPosition = (new Random()).Next() % numPlayers;

            Players = new Player[numPlayers];
            for (int i = 0; i < Players.Length; i++)
            {
                if (i == playerPosition)
                {
                    Players[i] = Human;
                }
                else
                {
                    Players[i] = new SimpleAI()
                    {
                        Name = string.Format("ai{0}", i)
                    }
                };
            }
            Alive = Players.Length;

            // create map
            Map = new Map(width, height, Players, Background, PlayerPlacement.Borders);
            Map.OnEphemerialEvent += AddEphemerialElement;
            Map.OnElementHit      += HitByAttack;
            Map.OnElementDied     += PlayerDied;

            // setup window (based on placement on the map)
            WindowX = Human.X;
            WindowY = Human.Y;

            // start the players in the air
            if (true)
            {
                ParachuteTimers = new Timer[Players.Length];

                ZoomFactor = 0.05f;

                for (int i = 0; i < Players.Length; i++)
                {
                    Players[i].Z       = Constants.Sky;
                    ParachuteTimers[i] = new Timer(PlayerParachute, i, 0, Constants.GlobalClock);
                }
            }

            // startup the timer to drive the AI
            AITimers = new Timer[Players.Length];
            for (int i = 0; i < Players.Length; i++)
            {
                if (Players[i].Id == Human.Id)
                {
                    continue;
                }
                AITimers[i] = new Timer(AIMove, i, 0, Constants.GlobalClock);
            }

            // show the title screen
            ShowMenu();

            // initially render all the elements
            Paint();
        }
예제 #11
0
 public Sound(string name, ISounds sounds)
 {
     this.name   = name;
     this.sounds = sounds;
 }
예제 #12
0
파일: Sound.cs 프로젝트: mrange/funbasic
 internal static void Init(ISounds sounds)
 {
     _sounds = sounds;
 }