/** * @file MachineSystemActual.cpp * @author sriram */ #include "pch.h" #include "MachineSystemActual.h" #include "Machine1Factory.h" #include "Machine2Factory.h" /** * constructor * @param resourcesDir * @param audioEngine */ MachineSystemActual::MachineSystemActual(std::wstring resourcesDir, ma_engine* audioEngine): mResourcesDir(resourcesDir), mAudioEngine(audioEngine) { SetMachineNumber(1); } void MachineSystemActual::SetMachineNumber(int machine) { if(mMachineNumber!=machine) { mMachine->ClearMachine(); } if(machine==1) { Machine1Factory factory(mResourcesDir, mAudioEngine); mMachine = factory.CreateMachine(); } else if (machine==2) { Machine2Factory factory(mResourcesDir, mAudioEngine); mMachine = factory.CreateMachine(); } mMachineNumber = machine; } void MachineSystemActual::SetFrameRate(double rate) { mFrameRate = rate; } void MachineSystemActual::SetMachineFrame(int frame) { mFrame = frame; mTime = mFrame/mFrameRate; mMachine->SetTime(mTime); } void MachineSystemActual::SetLocation(wxPoint location) { mLocation = location; } void MachineSystemActual::DrawMachine(std::shared_ptr graphics) { //MachineSystem::DrawMachine(graphics); mMachine->Draw(graphics,mLocation.x,mLocation.y); }