Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74479b1
commit 4eb755c
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "NodeCounter.h" | ||
|
||
Counter::Counter(): | ||
HasTrigger | ||
(this){ | ||
}; | ||
Counter::~Counter(){ | ||
registerInput(amount); | ||
|
||
amount = 1.0; | ||
|
||
count = 0.0; | ||
} | ||
|
||
void Counter::onInternalInputChange(BaseInput &internalInput){ | ||
if(&internalInput == &trigger){ | ||
if(isTriggerActive()){ | ||
count += amount.get(); | ||
out.set(count); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef NodeCounter_h_ | ||
#define NodeCounter_h_ | ||
|
||
#include "CommonNodeIncludes.h" | ||
|
||
class Counter: | ||
public Node, | ||
public HasTrigger | ||
{ | ||
public: | ||
|
||
Counter(); | ||
~Counter(); | ||
|
||
Input amount; | ||
|
||
Output out; | ||
|
||
protected: | ||
void onInternalInputChange(BaseInput &internalInput); | ||
|
||
float count; | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters