本文整理汇总了C++中Sign::segmentCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Sign::segmentCount方法的具体用法?C++ Sign::segmentCount怎么用?C++ Sign::segmentCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sign
的用法示例。
在下文中一共展示了Sign::segmentCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void WavePixels::run(Sign &sign, EffectData &data, uint8_t ci){
uint16_t angle = (millis() % cycleTime[ci])*UINT16_MAX/cycleTime[ci];
int16_t delta_hue = hueA[ci] * sin16(angle)/UINT16_MAX;
uint16_t seg_count = sign.segmentCount();
bool on = (ci == 0);
for(uint8_t i=0; i < seg_count; i++){
Segment *curr_seg = sign.segments[i];
if(curr_seg -> isOn == on){
curr_seg -> setColor(color[ci]);
delta_hue = -delta_hue;
int16_t hue_add = delta_hue;
uint8_t pixel_count = curr_seg -> pixelCount();
for(uint8_t j = 0; j < pixel_count; j++ ){
Pixel *currPixel = curr_seg -> pixels[j];
currPixel -> addHue16(hue_add);
hue_add += delta_hue;
}
}
}
}
示例2: run
void RainbowSegment::run(Sign &sign, uint8_t layer){
if( sign.textChanged ){ this -> signWasUpdated(sign);}
uint8_t segment_count = sign.segmentCount();
CHSV curr_color = color[layer];
if(changeOnBeat && sign.onBeat){
color[layer].hue += beatStep[layer];
}
for(uint8_t i=0; i<segment_count; i++){
Segment* curr_segment = sign.segments[i];
curr_segment -> setColor(layer, curr_color);
curr_color.hue += hueStep[layer];
}
}