/* ============================== ============================== */ vec4 TwLimb::GetColor() const { int c[4]; TwGetParam(bar, 0, "color", TW_PARAM_INT32, 3, c); TwGetParam(bar, 0, "alpha", TW_PARAM_INT32, 1, &c[3]); return vec4(float(c[0])/255.0f, float(c[1])/255.0f, float(c[2])/255.0f, float(c[3])/255.0f); }
void TweakRivers::redisplay(double t, double dt, bool &needUpdate) { if (currentBar != NULL) { TwGetParam(currentBar, "Flow", "opened", TW_PARAM_INT32, 1, &(barStates[0])); TwGetParam(currentBar, "Display", "opened", TW_PARAM_INT32, 1, &(barStates[1])); TwGetParam(currentBar, "Other", "opened", TW_PARAM_INT32, 1, &(barStates[2])); TwGetParam(currentBar, "riverManager", "opened", TW_PARAM_INT32, 1, &(barStates[3])); } needUpdate = false; }
/* ============================== ============================== */ ivec2 TwLimb::GetSize() const { ivec2 size; TwGetParam(bar, 0, "size", TW_PARAM_INT32, 2, &size); return size; }
/* ============================== ============================== */ ivec2 TwLimb::GetPos() const { ivec2 pos; TwGetParam(bar, 0, "position", TW_PARAM_INT32, 2, &pos); return pos; }
/* * @brief Centers the TwBar by the specified name. */ void TW_CALL Ui_CenterBar(void *data) { const char *name = (const char *) data; TwBar *bar = TwGetBarByName(name); if (bar) { double size[2], position[2]; TwGetParam(bar, NULL, "size", TW_PARAM_DOUBLE, 2, size); position[0] = (r_context.width - size[0]) / 2.0; position[1] = (r_context.height - size[1]) / 2.0; if (position[0] < (r_pixel_t) 0) position[0] = (r_pixel_t) 0; if (position[1] < (r_pixel_t) 0) position[1] = (r_pixel_t) 0; position[0] = (r_pixel_t) position[0]; position[1] = (r_pixel_t) position[1]; // Com_Debug("%s: %4f, %4f\n", name, position[0], position[1]); TwSetParam(bar, NULL, "position", TW_PARAM_DOUBLE, 2, position); } }
void Toolbar::getBarVisibility(bool *value, TwBar* bar) { qint32 visible = 0; TwGetParam(bar, nullptr, "visible", TW_PARAM_INT32, 1, &visible); *value = visible; }
bool InterfaceGl::isVisible() const { int32_t visibleInt; TwGetParam( mBar.get(), NULL, "visible", TW_PARAM_INT32, 1, &visibleInt ); return visibleInt != 0; }