// Rysuje odblask swiat³a na diodzie void Led::paintBackground(QPainter & painter) { initCoordinateSystem(painter); painter.setPen(Qt::NoPen); QRadialGradient shine(QPointF(-40.0,-40.0),120.0,QPointF(-40,-40)); QColor white1(255,255,255,200); QColor white0(255,255,255,0); shine.setColorAt(0.0,white1); shine.setColorAt(1.0,white0); painter.setBrush(shine); painter.drawEllipse(-147,-147,297,297); }
void ChanWidgetLED::paintBackground(QPainter & painter) { initCoordinateSystem(painter); painter.setPen(Qt::NoPen); QRadialGradient shine(QPointF(-(size-size/10)/7.5,-(size-size/10)/7.5),(size-size/10)/2.5, QPointF(-(size-size/10)/7.5,-(size-size/10)/7.5)); QColor white1(255,255,255,200); QColor white0(255,255,255,0); shine.setColorAt(0.0,white1); shine.setColorAt(1.0,white0); painter.setBrush(shine); painter.drawEllipse(-(size-size/10)/2,-(size-size/10)/2,(size-size/10),(size-size/10)); }
void GameRoad::draw(void) { SPRITE *sp; int c = 0; if(cond == RO_INI) { return; } if(del_block.ok > 0) { SetDrawBlendMode( DX_BLENDMODE_INVSRC, 128); } // 背景 sp = &spd[RO_SP_BG]; DrawGraph(sp->x, sp->y, sp->num, TRUE); // 落ちるブロック描画 sp = &spd[cols[block.col]+block.type]; if(block.ok == 1) { DrawGraph(block.x, roady[block.k], sp->num, TRUE); } // 現在埋まっているブロックを描画 for(int i=0; i<RO_Y_CNT; i++) { for(int j=0; j<RO_X_CNT; j++) { int n = roads[i][j] & ~0xf0; int co = roads[i][j]>>4; if(n!=0) { sp = &spd[cols[co]+(n-1)]; DrawGraph(roadx[j], roady[i], sp->num, TRUE); } } } if(cond == RO_GAMEOVER) { // ゲームオーバー SetDrawBright( 255 , 255 , 255 ); for(int i=RO_SP_LOSE1; i<=RO_SP_LOSE4; i++) { sp = &spd[i]; DrawGraph(sp->x, sp->y, sp->num, TRUE); } SetDrawBright( alpha , alpha , alpha ); alpha -= 8; if(alpha < 128) { alpha = 128; } return; } // いち sp = &spd[RO_SP_ICHI]; DrawGraph(sp->x, sp->y, ichi_num[sp->pat][sp->num], TRUE); sp = &spd[RO_SP_FB]; DrawGraph(sp->x, sp->y, sp->num, TRUE); RO_LEVEL *lv = &levels[now_level]; // 現在レベル // 失敗ブロック描画 if(del_block.ok > 0) { del_block.ok -= 8; SetDrawBlendMode( DX_BLENDMODE_NOBLEND , 0); } if(del_block.ok <= 0) { del_block.ok = 0; } else { int n = del_block.type; sp = &spd[cols[del_block.col] + n]; SetDrawBlendMode( DX_BLENDMODE_ALPHA, del_block.ok ); //ブレンドモード DrawRotaGraph( del_block.x, roady[del_block.k], 1.0, 0.0, sp->num, TRUE ); // エフェクト描画 if(del_block.ok > 184) { sp = &spd[RO_SP_NG1]; } else { sp = &spd[RO_SP_NG2]; } DrawGraph(sp->x, sp->y, sp->num, TRUE); SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0 ); //ブレンドモードをオフ } if(efe_ok > 0) { int e = efe_ok / 8; if( e > 4 ) { efe_ok = 0; return; } sp = &spd[RO_SP_OK1+e]; DrawGraph(sp->x, sp->y, sp->num, TRUE); efe_ok++; } if(cond == RO_GAME_S) { if(stage == 0) { sp = &spd[RO_SP_T1]; } else { sp = &spd[RO_SP_T2]; } shine(sp); SetDrawBlendMode( DX_BLENDMODE_ALPHA, sp->pat); DrawGraph(sp->x, sp->y, sp->num, TRUE); SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0 ); } #ifdef _DEBUG // クリア描画 if(cond == RO_CLEAR) { if(stage == 0) { SetFontSize(24); DrawFormatString( 420 , 8 , GetColor( 0 , 0 , 0 ), "Ichi can walk! (←/↓/↑/→)"); SetFontSize(20); DrawFormatString( 100, 48, GetColor(0, 0, 0), "Let's cross to the opposite shore. Or let's fall from a bridge. " ); DrawFormatString( 100, 76, GetColor(0, 0, 0), "対岸へ渡りましょう。無理なら橋から落ちましょう。" ); } } else if(stage == 0) { DrawString(100, 48+8, "↑/↓:Panel up down", GetColor(0, 0, 0)); DrawString(100, 76+8, "←/→:Panel speed up or down", GetColor(0, 0, 0)); DrawString(100, 104+8,"Enter-key:panel is rotated.", GetColor(0, 0, 0)); DrawString(100, 132+8, "Let's connect a portion without a frame and construct a bridge. ", GetColor(0, 0, 0)); DrawString(100, 160+8, "流れる音のパネルを、左岸か他のパネルにつなげて道を作りましょう。", GetColor(0, 0, 0)); DrawString(100, 188+8, "枠の無い面でのみ、つなげられます。", GetColor(0, 0, 0)); } #else DrawFormatString( 0 , 0 , GetColor( 255, 255, 255 ) , "level:%d",now_level); #endif DrawFormatString( 12 , 32, GetColor(255 , 255 , 255 ) , "time:%d miss:%d",time, miss); DrawFormatString( 12 , 56, GetColor(255 , 0, 0), "red:%d", get_rgb[0]); DrawFormatString( 12 , 80, GetColor(0 , 255, 0),"green:%d", get_rgb[1]); DrawFormatString( 12 , 104, GetColor(0 , 0, 255),"blue:%d", get_rgb[2]); return; }
/** * @brief Tells the led to stop shining */ void Led::turnOff(void) { setColor(Color(0, 0, 0)); shine(); }
/** * @brief Tells the led to shine with a given color * @param color the color the led will shine */ void Led::shine(uint8_t redValue, uint8_t greeValue, uint8_t blueValue) { setColor(Color(redValue, greeValue, blueValue)); shine(); }
/** * @brief Tells the led to shine with a given color * @param color the color the led will shine */ void Led::shine(Color colorValue) { setColor(colorValue); shine(); }