Пример #1
0
        public override void Create()
        {
            referenceBeat = 0;
            randomGen     = new Random();
            Engine.SetPalette(Palettes.Pico8);

            //SimpleTimingSource testSource = new SimpleTimingSource(60, 100);
            AudioTimingSource testAudioSource = new AudioTimingSource(148, "sample.mp3");

            Debug.WriteLine($"Total Length: {testAudioSource.duration_sec}");

            this._master = new TimingMaster(testAudioSource, 100);

            //SimpleTimingWorker worker = new SimpleTimingWorker(master, "Worker 1");
            SimpleTimingWorker worker2 = new SimpleTimingWorker(this._master, "Worker 2", this.Engine);

            //AsyncSimpleTimingWorker worker3 = new AsyncSimpleTimingWorker(this._master, "Async Worker 3", this.Engine);
            //AsyncSimpleTimingWorker worker4 = new AsyncSimpleTimingWorker(master, "Async Worker 4");

            this.beats = new List <BeatSymbol>();
            this.beats.Add(new BeatSymbol(this.Engine, 1, 5, 1));

            //this._master.RunLoop(this);
            //System.Threading.Thread masterThread = new System.Threading.Thread(this._master.AIORunLoop);
            this._master._timingSource.start();

            // thread out the Timing Loop
            Task.Run(this._master.AIORunLoop);

            //Engine.Frame(new Point(1, 0), new Point(10, 10), 7);
            //masterThread.Start();
            //this._master.AIORunLoop();

            //this._sleeptime = this._master.refreshRate_ms;
            //this._starttime = this._master.LoopStart();
        }
Пример #2
0
 public AsyncSimpleTimingWorker(TimingMaster timingMaster, string workerName) : base(timingMaster)
 {
     this.workerName = workerName;
 }
Пример #3
0
 public AsyncTimingWorker(TimingMaster timingMaster) : base(timingMaster)
 {
 }
Пример #4
0
 public SimpleTimingWorker(TimingMaster timingMaster, string workerName, ConsoleGameEngine.ConsoleEngine engine) : base(timingMaster)
 {
     this.workerName = workerName;
     this.engine     = engine;
 }
Пример #5
0
 public TimingWorker(TimingMaster timingMaster)
 {
     this._timingMaster       = timingMaster;
     this._timingMaster.Beat += this.Beat;
 }