text: #include "pch.h"
  #include "KeyBind.h"
  
  VCMP::KeyBind::KeyBind(int Key1, int Key2, int Key3, bool calledonrelease)
  {
  	int id = api->GetKeyBindUnusedSlot();
  	if (id != -1)
  	{
  		this->_valid = true;
  		this->ID = id;
  		api->RegisterKeyBind(this->ID, calledonrelease, Key1, Key2, Key3);
  	}
  	else this->_valid = false;
  }
  
  bool VCMP::KeyBind::Valid()
  {
  	return this->_valid;
  }
  
  int VCMP::KeyBind::Key1()
  {
  	if (this->Valid())
  	{
  		int* useless = nullptr, * key = nullptr;
  		uint8_t* useless2 = nullptr;
  		api->GetKeyBindData(this->ID, useless2, key, useless, useless);
  		return *key;
  	}
  	return 0;
  }
  
  int VCMP::KeyBind::Key2()
  {
  	if (this->Valid())
  	{
  		int* useless = nullptr, * key = nullptr;
  		uint8_t* useless2 = nullptr;
  		api->GetKeyBindData(this->ID, useless2, useless, key, useless);
  		return *key;
  	}
  	return 0;
  }
  
  int VCMP::KeyBind::Key3()
  {
  	if (this->Valid())
  	{
  		int* useless = nullptr, * key = nullptr;
  		uint8_t* useless2 = nullptr;
  		api->GetKeyBindData(this->ID, useless2, useless, useless, key);
  		return *key;
  	}
  	return 0;
  }
  
  bool VCMP::KeyBind::DownOrUp()
  {
  	if (this->Valid())
  	{
  		int* useless = nullptr;
  		uint8_t* v = nullptr;
  		api->GetKeyBindData(this->ID, v, useless, useless, useless);
  		return *v;
  	}
  	return 0;
  }
  
  void VCMP::KeyBind::Destroy()
  {
  	this->_valid = false;
  	api->RemoveKeyBind(this->ID);
  }
  
  bool VCMP::KeyBind::operator==(KeyBind right)
  {
  	return (this->ID == right.ID);
  }
  
  bool VCMP::KeyBind::operator!=(KeyBind right)
  {
  	return (this->ID != right.ID);
  }
  
  VCMP::KeyBind::operator bool()
  {
  	return _valid;
  }
  