| 70 | } |
| 71 | |
| 72 | void ClickButton::Render() |
| 73 | { |
| 74 | ofPushStyle(); |
| 75 | |
| 76 | float w, h; |
| 77 | GetDimensions(w, h); |
| 78 | |
| 79 | ofColor color, textColor; |
| 80 | IUIControl::GetColors(color, textColor); |
| 81 | |
| 82 | ofFill(); |
| 83 | ofSetColor(0, 0, 0, gModuleDrawAlpha * .5f); |
| 84 | ofRect(mX + 1, mY + 1, w, h); |
| 85 | DrawBeacon(mX + w / 2, mY + h / 2); |
| 86 | float press = ofClamp((1 - (gTime - mClickTime) / 200), 0, 1); |
| 87 | color.r = ofLerp(color.r, 0, press); |
| 88 | color.g = ofLerp(color.g, 0, press); |
| 89 | color.b = ofLerp(color.b, 0, press); |
| 90 | ofSetColor(color); |
| 91 | ofRect(mX, mY, w, h); |
| 92 | |
| 93 | if (mDisplayStyle == ButtonDisplayStyle::kText) |
| 94 | { |
| 95 | ofSetColor(textColor); |
| 96 | DrawTextNormal(GetDisplayName(), mX + 2, mY + 12); |
| 97 | } |
| 98 | else if (mDisplayStyle == ButtonDisplayStyle::kPlay) |
| 99 | { |
| 100 | ofSetColor(textColor); |
| 101 | ofFill(); |
| 102 | ofTriangle(mX + 5, mY + 2, mX + 5, mY + 12, mX + 15, mY + 7); |
| 103 | } |
| 104 | else if (mDisplayStyle == ButtonDisplayStyle::kPause) |
| 105 | { |
| 106 | ofSetColor(textColor); |
| 107 | ofFill(); |
| 108 | ofRect(mX + 5, mY + 2, 4, 10, 0); |
| 109 | ofRect(mX + 11, mY + 2, 4, 10, 0); |
| 110 | } |
| 111 | else if (mDisplayStyle == ButtonDisplayStyle::kStop) |
| 112 | { |
| 113 | ofSetColor(textColor); |
| 114 | ofFill(); |
| 115 | ofRect(mX + 5, mY + 2, 10, 10, 0); |
| 116 | } |
| 117 | else if (mDisplayStyle == ButtonDisplayStyle::kGrabSample) |
| 118 | { |
| 119 | ofSetColor(textColor); |
| 120 | for (int i = 0; i < 5; ++i) |
| 121 | { |
| 122 | float height = (i % 2 == 0) ? 6 : 10; |
| 123 | float x = mX + 4 + i * 3; |
| 124 | ofLine(x, mY + 7 - height / 2, x, mY + 7 + height / 2); |
| 125 | } |
| 126 | } |
| 127 | else if (mDisplayStyle == ButtonDisplayStyle::kSampleIcon) |
| 128 | { |
| 129 | ofSetColor(textColor); |
nothing calls this directly
no test coverage detected