Squashed 'external/gainput/' content from commit 2be0a50
git-subtree-dir: external/gainput git-subtree-split: 2be0a50089eafcc6fccb66142180082e48f27f4c
This commit is contained in:
32
lib/source/gainput/GainputInputState.cpp
Normal file
32
lib/source/gainput/GainputInputState.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
#include <gainput/gainput.h>
|
||||
|
||||
|
||||
namespace gainput
|
||||
{
|
||||
|
||||
InputState::InputState(Allocator& allocator, unsigned int buttonCount) :
|
||||
allocator_(allocator),
|
||||
buttonCount_(buttonCount)
|
||||
{
|
||||
const size_t size = sizeof(Button) * buttonCount_;
|
||||
buttons_ = static_cast<Button*>(allocator_.Allocate(size));
|
||||
GAINPUT_ASSERT(buttons_);
|
||||
memset(buttons_, 0, size);
|
||||
}
|
||||
|
||||
InputState::~InputState()
|
||||
{
|
||||
allocator_.Deallocate(buttons_);
|
||||
}
|
||||
|
||||
InputState&
|
||||
InputState::operator=(const InputState& other)
|
||||
{
|
||||
const size_t size = sizeof(Button) * buttonCount_;
|
||||
memcpy(buttons_, other.buttons_, size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user