1 #pragma once 2 #include "stdafx.h" 3 #include "DebugBreakHelper.h" 4 #include "Console.h" 5 6 class ConsolePauseHelper 7 { 8 private: 9 unique_ptr<DebugBreakHelper> _breakHelper; 10 shared_ptr<Debugger> _debugger; 11 Console* _console; 12 13 public: ConsolePauseHelper(Console * console)14 ConsolePauseHelper(Console* console) 15 { 16 _console = console; 17 _debugger = console->GetDebugger(false); 18 if(_debugger) { 19 //Pause using the debugger (on the next instruction), when possible 20 _breakHelper.reset(new DebugBreakHelper(_debugger.get())); 21 } else { 22 //If the debugger isn't active, pause at the end of the next frame 23 console->Pause(); 24 } 25 } 26 ~ConsolePauseHelper()27 ~ConsolePauseHelper() 28 { 29 if(!_debugger) { 30 _console->Resume(); 31 } 32 } 33 };