c++/rgb-assembler/commands/Sleep.h
changeset 22 cb2055cdc2f0
parent 20 b9ceffdcaf14
child 29 10d6964e7b4a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/c++/rgb-assembler/commands/Sleep.h	Sat Dec 23 23:42:46 2017 +0100
     1.3 @@ -0,0 +1,25 @@
     1.4 +#pragma once
     1.5 +
     1.6 +#include <wchar.h>
     1.7 +#include <chrono>
     1.8 +#include <thread>
     1.9 +
    1.10 +#include "../Command.h"
    1.11 +
    1.12 +using namespace std;
    1.13 +
    1.14 +namespace commands {
    1.15 +
    1.16 +class Sleep : public Command {
    1.17 +public:
    1.18 +
    1.19 +	void process(octet_t* memory, address_t& index) override {
    1.20 +		sleep_t delay = read<sleep_t>(memory, index);
    1.21 +		wprintf(L"SLEEP %*d ms\n", 4, delay);
    1.22 +		this_thread::sleep_for(chrono::milliseconds(delay));
    1.23 +	}
    1.24 +private:
    1.25 +
    1.26 +};
    1.27 +
    1.28 +}