using System; using System.Collections.Generic; using System.Text; using Microsoft.DirectX.Direct3D; using Microsoft.DirectX; namespace SalsaModel { public class ShowBeat : IScene { Timing _timer; Location _loc; Device _dev; public ShowBeat(Timing timer, Location loc) { _timer = timer; _loc = loc; } Message3D[] beats = new Message3D[8]; public void Setup(Device dev) { _dev = dev; for (int i = 0; i < 8; ++i) { beats[i] = new Message3D(dev, (i + 1).ToString()); } } public void Draw() { Matrix oldview = _dev.Transform.View; Matrix oldProj = _dev.Transform.Projection; float angle = (float)-Math.PI / 2.0f; _dev.Transform.View = Matrix.LookAtLH(new Vector3((float)(300 * Math.Cos(angle)), 0, (float)(300 * Math.Sin(angle))), new Vector3(0, 0, 0), new Vector3(0, 1, 0)); //_dev.Transform.Projection = Matrix.OrthoOffCenterLH(, -500f, 500f); double scale = 20; for (int i = 0; i < 8; ++i) { Location iLoc = _loc.Plus((i-4) * scale, -110, 0); if (_timer.Beat() == i + 1) { beats[i].Draw(_dev, iLoc, scale, false); } //else if ((_timer.Beat() - 1) % 8 == (i+1)%8) //{ // beats[i].Draw(_dev, iLoc, scale / (1 + _timer.Percent())); //} //else if ((_timer.Beat() - 1 + 1) % 8 == i) //{ // beats[i].Draw(_dev, iLoc, scale / (2 - _timer.Percent())); //} else { beats[i].Draw(_dev, iLoc, scale / 2); } } _dev.Transform.View = oldview; _dev.Transform.Projection = oldProj; } } }