Skip to content

File evabKeyModifier.h

File List > src > evabKeyModifier.h

Go to the documentation of this file

#pragma once

#include <evaHandler.h>

namespace evab
{

  template <class T, unsigned char kDec, unsigned char kInc>
  class KeyModifier : public T
  {
  public:
    template <typename... Args>
    KeyModifier(Args &&...args)
        : T(args...)
    {
    }

    bool OnKey(Keys aKey) override
    {
      if (T::OnKey(aKey))
        return true;

      if (aKey == kDec)
        T::Increment(-1);
      else if (aKey == kInc)
        T::Increment(+1);
      else
        return false;

      return true;
    }
  };

}