//----------------------------------------------------------
void ofGLRenderer::setColor(const ofColor & color){
	setColor(color.r,color.g,color.b,color.a);
}
Esempio n. 2
0
void draw_desktop()
{
    setColor(180, 180, 180);
    drawRect(0, 0, 800, 600);
}
Esempio n. 3
0
bool OpningScene::init(){
    
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    
    //背景色のグラデーション
    auto bgGradient = LayerGradient::create(Color4B(255,255,255,255), Color4B(255,255,255,255));
    this -> addChild(bgGradient);

    //ドーンのスプライト
    Sprite *topSprite = Sprite::create("done.png");

    topSprite -> setPosition(Vec2(selfFrame.width/2 , selfFrame.height/3*2 ));
    topSprite -> setScale(0.2f);
    
    this -> addChild(topSprite);
    
    auto action1 = ScaleBy::create(0.4,1.3);
    auto action2 = ScaleBy::create(0.4,0.76923077);
    auto sequence = Sequence::create(action1,action2,NULL);
    
    auto repeatForever = RepeatForever::create(sequence);
    
    topSprite -> runAction(repeatForever);
    
    
    //スタートボタン
    start = Sprite::create();
    start -> setTextureRect(cocos2d::Rect(0, 0, selfFrame.width/1.8, selfFrame.width/4));
    start -> setColor(Color3B::WHITE);
    start -> setPosition(Vec2(selfFrame.width/2, selfFrame.height/5*2));
    
    //ラベル作成
    Label *startLabel = Label::createWithSystemFont("開始!","KouzanBrushFont",80);
    startLabel -> setPosition(Vec2(start->getContentSize().width / 2, start->getContentSize().height / 2));
    startLabel ->setColor(Color3B::BLACK);
    
    start -> addChild(startLabel);
    
    this->addChild(start);

    //ゲームセンターへのログイン
    GameCenterBridge::loginGameCenter();
    
    
    //ランキング
    ranking = Sprite::create();
    ranking -> setTextureRect(cocos2d::Rect(0, 0, selfFrame.width/1.8, selfFrame.width/4));
    ranking -> setColor(Color3B::WHITE);
    ranking -> setPosition(Vec2(selfFrame.width/2, selfFrame.height/5));
    
    //ラベル作成
    Label *rankingLabel = Label::createWithSystemFont("序列!","KouzanBrushFont",80);
    rankingLabel -> setPosition(Vec2(ranking->getContentSize().width / 2, ranking->getContentSize().height / 2));
    rankingLabel ->setColor(Color3B::BLACK);
    
    ranking -> addChild(rankingLabel);
    
    this->addChild(ranking);
    
    /************** ドッチイベント設定  ******************/
    
    //シングルタップ用リスナーを用意する
    auto listener = EventListenerTouchOneByOne::create();
    //listener -> setSwallowTouches(_swallowsTouches);

    //各イベントの割り当て
    listener -> onTouchBegan = CC_CALLBACK_2(OpningScene::onTouchBegan,this);
    listener -> onTouchEnded = CC_CALLBACK_2(OpningScene::onTouchEnded,this);
    listener -> onTouchMoved = CC_CALLBACK_2(OpningScene::onTouchMoved,this);

    
    //イベントディスパッチャようにリスナーを追加する
    _eventDispatcher -> addEventListenerWithSceneGraphPriority(listener, this);
    
    /*************  ドッチイベント設定  終 ****************/
    
    
    //エフェクトプリロード
    CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect("SOIYA.mp3");
    
    //BGM再生
    CocosDenshion::SimpleAudioEngine::getInstance()->setBackgroundMusicVolume(0.1);
    CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("hueloop.mp3",true);
    
    //nend(本番用)
    char apiKey[] = "33f7cda082e680f88ea5537bb4f24d3f16818379";
    char spotID[] = "264071";

    //nend(テスト用)
//char apiKey[] = "a6eca9dd074372c898dd1df549301f277c53f2b9";
//char spotID[] = "3172";
    
    
    NendModule::createNADViewBottom(apiKey, spotID);
    
    //appCloud
//    AppCCloudPlugin::Ad::showSimpleView(AppCCloudPlugin::BOTTOM);
    
    
    //ハイスコアを取る
    //初回は表示させないようにする
    
    UserDefault *userDef = UserDefault::getInstance();

    if(userDef->getIntegerForKey("score") != 0){
        
        auto score = userDef->getIntegerForKey("score");
        
        //秒数を取り出す
        unsigned long sec = score / 100;
        //ミリ秒を取り出す
        unsigned long mSec = (score % 100);
        //分を作る
        unsigned long min = (int)sec / 60;


        auto scoreLabel = Label::createWithSystemFont(StringUtils::format("最速演舞:%02lu:%02lu:%02lu",min,sec,mSec), "KouzanBrushFont", 35);
        
        scoreLabel->setColor(Color3B::BLACK);
        
        scoreLabel->setPosition(Vec2(0+scoreLabel->getContentSize().width/2,selfFrame.height-scoreLabel->getContentSize().height));
                                
                                this->addChild(scoreLabel);

    }
    

    
    return true;
}
Esempio n. 4
0
//button !
void GameScene::button_giveUp(Object * pSender){
	



	auto screenSize = Director::getInstance()->getWinSize();//获取屏幕尺寸




	//CCLOG("button give up touched !");
	if (player_num > 1){
		player_num = player_num - 1;
	}
	else{
		CCLOG("==error==,player num <1 !");// 玩家数必须大于等于1
	}
	//CCLOG("player num = %d", player_num);
	player_me->setOnTable(false);

	//决定是否弃牌,若玩家数<=1,则游戏结束
	// 先写玩家的操作,电脑AI的操作最后在写
	if (player_num < 2){
		//game over 
		Player * p1, *p2; // p1 win ,p2 lose
		if (player_me->isOnTable() == false){
			p1 = player01;
			p2 = player_me;
		}
		else{// 不是我赢就是电脑赢
			p1 = player_me;
			p2 = player01;
		}

		//显示玩家的牌,并且重新开始游戏,谁获胜
		//CCLOG("create GameEnd Sprite");
		auto GameEnd = Sprite::create("show_tips.png");
		GameEnd->setPosition(screenSize.width / 2, screenSize.height / 2);
		this->addChild(GameEnd,7);

		auto giveup_title = Label::createWithSystemFont("some player give up", "Arial", 26);
		giveup_title->setPosition(400, 440);
		giveup_title->setColor(ccc3(0, 0, 0));
		GameEnd->addChild(giveup_title);



		//button in gameover游戏结束按钮!!!
		auto reGame = MenuItemImage::create(
			"button01.png",
			"button02.png", CC_CALLBACK_1(GameScene::button_gameEnd, this));
		reGame->setPosition(400, 30);

		auto reGameMenu = Menu::create(reGame, NULL);
		reGameMenu->setPosition(Point::ZERO);

		GameEnd->addChild(reGameMenu, 1);

		//按钮上添加文字(暂时的功能,后期完善可以删掉)
		auto button_label01 = Label::createWithSystemFont("ReStart", "Arial", 17);
		button_label01->setPosition(Point(48, 20));
		reGame->addChild(button_label01, 2);


		//显示弃牌之后,两个玩家的牌都是什么?谁赢?
		/////赢家
		auto winner = Label::createWithSystemFont("Winner", "Arial", 20);
		winner->setPosition(200, 350);
		winner->setColor(ccc3(0, 0, 0));
		GameEnd->addChild(winner);
		
		auto winner_pic = Sprite::create(p1->getPhoto());
		winner_pic->setPosition(200, 280);
		GameEnd->addChild(winner_pic);

		//2张底牌,n张公共牌,n可以为0
		char poker_file_name[20] = "poker_pic/";
		char temp[9];
		sprintf(temp, "%d", p1->getCard01());
		strcat(poker_file_name, temp);
		strcat(poker_file_name, ".png");// error some time
		CCLOG("[email protected]____poker file name = %s", poker_file_name);
		auto p1_1 = Sprite::create(poker_file_name);
		p1_1->setPosition(280, 280);
		p1_1->setScale(0.5);
		GameEnd->addChild(p1_1);

		char poker_file_name2[20] = "poker_pic/";
		sprintf(temp, "%d", p1->getCard02());
		strcat(poker_file_name2, temp);
		strcat(poker_file_name2, ".png");
		auto p1_2 = Sprite::create(poker_file_name2);
		p1_2->setPosition(300, 280);
		p1_2->setScale(0.5);
		GameEnd->addChild(p1_2);



		//////输家
		auto loser = Label::createWithSystemFont("Loser", "Arial", 20);
		loser->setPosition(200, 170);
		loser->setColor(ccc3(0, 0, 0));
		GameEnd->addChild(loser);

		auto loser_pic = Sprite::create(p2->getPhoto());
		loser_pic->setPosition(200, 100);
		GameEnd->addChild(loser_pic);
		
		//dipai 2
		char poker_file_name3[20] = "poker_pic/";
		sprintf(temp, "%d", p2->getCard01());
		strcat(poker_file_name3, temp);
		strcat(poker_file_name3, ".png");
		auto p2_1 = Sprite::create(poker_file_name3);
		p2_1->setPosition(280, 100);
		p2_1->setScale(0.5);
		GameEnd->addChild(p2_1);

		char poker_file_name4[20] = "poker_pic/";
		sprintf(temp, "%d", p2->getCard02());
		strcat(poker_file_name4, temp);
		strcat(poker_file_name4, ".png");
		auto p2_2 = Sprite::create(poker_file_name4);
		p2_2->setPosition(300, 100);
		p2_2->setScale(0.5);
		GameEnd->addChild(p2_2);



		//显示一遍公共牌? 
		Point p[5];
		p[0] = Point(400, 190);
		p[1] = Point(450, 190);
		p[2] = Point(500, 190);
		p[3] = Point(550, 190);
		p[4] = Point(600, 190);
		CCLOG("card_num = %d", card_num);
		for (int i = 0; i < card_num ; i++){ //减掉底牌就是公共牌数  ???肯定是哪里不对了,目前程序对

			char poker_file_name5[20] = "poker_pic/";
			sprintf(temp, "%d", gongGongCard[i]);
			strcat(poker_file_name5, temp);
			strcat(poker_file_name5, ".png");
			auto gonggongcard = Sprite::create(poker_file_name5);
			gonggongcard->setScale(0.7);
			gonggongcard->setPosition(p[i]);
			GameEnd->addChild(gonggongcard);
			CCLOG("giveup_gonggong %d = %s", i, poker_file_name5);
		}

	}//end IF



	//game end


}
Esempio n. 5
0
void GameScene::button_xiaZhu(Object * pSender){
	//CCLOG("button jiazhu touched !");
	//当点击了下注,则所有玩家的经济变化(AI默认为下注)
	//第一轮下注后,则发三张牌,
	if (game_round == 1){
		gongGongCard[0] = getOneNumber();
		gongGongCard[1] = getOneNumber();
		gongGongCard[2] = getOneNumber();

		card_num = card_num + 3;

		//CCLOG("gonggong card 0 1 2 = %d %d %d", gongGongCard[0], gongGongCard[1], gongGongCard[2]);
		//创建3张牌并显示
		char poker_file_name[20] = "poker_pic/";
		char  temp[9];
		sprintf(temp, "%d", gongGongCard[0]);
		strcat(poker_file_name, temp);
		strcat(poker_file_name, ".png");
		auto gonggong01 = Sprite::create(poker_file_name);
		gonggong01->setPosition(80, 370);
		gonggong01->setScale(0.6);
		this->addChild(gonggong01);

		char poker_file_name1[20] = "poker_pic/";
		
		sprintf(temp, "%d", gongGongCard[1]);
		strcat(poker_file_name1, temp);
		strcat(poker_file_name1, ".png");
		auto gonggong02 = Sprite::create(poker_file_name1);
		gonggong02->setPosition(160, 370);
		gonggong02->setScale(0.6);
		this->addChild(gonggong02);

		char poker_file_name2[20] = "poker_pic/";
		
		sprintf(temp, "%d", gongGongCard[2]);
		strcat(poker_file_name2, temp);
		strcat(poker_file_name2, ".png");
		auto gonggong03 = Sprite::create(poker_file_name2);
		gonggong03->setPosition(240, 370);
		gonggong03->setScale(0.6);
		this->addChild(gonggong03);

		game_round = 2;//设置为第一轮已经结束
		player01->addDebt(XIAZHU);//下注200
		player_me->addDebt(XIAZHU);
		return;
	}
	//第二轮下注后,发一张

	if (game_round == 2){
		gongGongCard[3] = getOneNumber();
		card_num++;
		//CCLOG("gong gong card [3] = %d", gongGongCard[3]);
		char poker_file_name[20] = "poker_pic/";
		char  temp[9];
		sprintf(temp, "%d", gongGongCard[3]);
		strcat(poker_file_name, temp);
		strcat(poker_file_name, ".png");
		auto gonggong04 = Sprite::create(poker_file_name);
		gonggong04->setPosition(320, 370);
		gonggong04->setScale(0.6);
		this->addChild(gonggong04);

		game_round = 3;
		player01->addDebt(XIAZHU);//下注200
		player_me->addDebt(XIAZHU);
		return;
	}
	//最后一轮下注后,发一张
	if (game_round == 3){
		gongGongCard[4] = getOneNumber();
		card_num++;
		//CCLOG("gong gong card [4] = %d", gongGongCard[4]);
		char poker_file_name[20] = "poker_pic/";
		char  temp[9];
		sprintf(temp, "%d", gongGongCard[4]);
		strcat(poker_file_name, temp);
		strcat(poker_file_name, ".png");
		auto gonggong05 = Sprite::create(poker_file_name);
		gonggong05->setPosition(400, 370);
		gonggong05->setScale(0.6);
		this->addChild(gonggong05);

		game_round = 4;
		player01->addDebt(XIAZHU);//下注200
		player_me->addDebt(XIAZHU);
		return;
	}
	//牌发完后,还可以下注


	if (game_round == 4){
		int  me = checkFinal(player_me);// just test
		int ai = checkFinal(player01);

		CCLOG("check final Player_me = %d", me);
		CCLOG("check final Player_01 = %d", ai);

		//写一个跳转的函数
		//this->scheduleOnce(schedule_selector(GameScene::jump2final), 2);//延时5秒 



		//===============================================================
		auto screenSize = Director::getInstance()->getWinSize();//获取屏幕尺寸
		Player * p1, *p2; // p1 win ,p2 lose

		


		if (me == ai && me<100 && ai<100){
			//两种牌型都相同
			//则继续比较牌面大小
			if (getGaoPai(player01) < getGaoPai(player_me)){
				p1 = player_me;
				p2 = player01;
			}
			else{
				p1 = player01;
				p2 = player_me;
			}
			
		}
		else{
			if (me > 100 && ai > 100){
				//若两个都是高牌
				if (me < ai){
					p1 = player01;
					p2 = player_me;
				}
				else{//  问题?  高牌都相同时无法判断谁赢,应该事平局,但是默认时有输赢的
					p1 = player_me;
					p2 = player01;
				}
			}
			else{//有对应的牌型,或者高牌,最小的牌型最大
				if (me < ai){
					p1 = player_me;
					p2 = player01;
				}
				else{
					p1 = player01;
					p2 = player_me;
				}
			}
		}
		//game over 
			
			

			//显示玩家的牌,并且重新开始游戏,谁获胜
			//CCLOG("create GameEnd Sprite");
			auto GameEnd = Sprite::create("show_tips.png");
			GameEnd->setPosition(screenSize.width / 2, screenSize.height / 2);
			this->addChild(GameEnd, 7);

			//button in gameover游戏结束按钮!!!
			auto reGame = MenuItemImage::create(
				"button01.png",
				"button02.png", CC_CALLBACK_1(GameScene::button_gameEnd, this));
			reGame->setPosition(400,30);

			auto reGameMenu = Menu::create(reGame,NULL);
			reGameMenu->setPosition(Point::ZERO);

			GameEnd->addChild(reGameMenu, 1);

			//按钮上添加文字(暂时的功能,后期完善可以删掉)
			auto button_label01 = Label::createWithSystemFont("ReStart", "Arial", 17);
			button_label01->setPosition(Point(48,20));
			reGame->addChild(button_label01, 2);

			///============================================================
			auto giveup_title = Label::createWithSystemFont("game over!", "Arial", 26);
			giveup_title->setPosition(400, 440);
			giveup_title->setColor(ccc3(0, 0, 0));
			GameEnd->addChild(giveup_title);


			//显示弃牌之后,两个玩家的牌都是什么?谁赢?
			/////赢家
			auto winner = Label::createWithSystemFont("Winner", "Arial", 20);
			winner->setPosition(200, 350);
			winner->setColor(ccc3(0, 0, 0));
			GameEnd->addChild(winner);

			auto winner_pic = Sprite::create(p1->getPhoto());
			winner_pic->setPosition(200, 280);
			GameEnd->addChild(winner_pic);

			//2张底牌,n张公共牌,n可以为0
			char poker_file_name[20] = "poker_pic/";
			char temp[9];
			sprintf(temp, "%d", p1->getCard01());
			strcat(poker_file_name, temp);
			strcat(poker_file_name, ".png");// error some time
			CCLOG("[email protected]____poker file name = %s", poker_file_name);
			auto p1_1 = Sprite::create(poker_file_name);
			p1_1->setPosition(280, 280);
			p1_1->setScale(0.5);
			GameEnd->addChild(p1_1);

			char poker_file_name2[20] = "poker_pic/";
			sprintf(temp, "%d", p1->getCard02());
			strcat(poker_file_name2, temp);
			strcat(poker_file_name2, ".png");
			auto p1_2 = Sprite::create(poker_file_name2);
			p1_2->setPosition(300, 280);
			p1_2->setScale(0.5);
			GameEnd->addChild(p1_2);



			//////输家
			auto loser = Label::createWithSystemFont("Loser", "Arial", 20);
			loser->setPosition(200, 170);
			loser->setColor(ccc3(0, 0, 0));
			GameEnd->addChild(loser);

			auto loser_pic = Sprite::create(p2->getPhoto());
			loser_pic->setPosition(200, 100);
			GameEnd->addChild(loser_pic);

			//dipai 2
			char poker_file_name3[20] = "poker_pic/";
			sprintf(temp, "%d", p2->getCard01());
			strcat(poker_file_name3, temp);
			strcat(poker_file_name3, ".png");
			auto p2_1 = Sprite::create(poker_file_name3);
			p2_1->setPosition(280, 100);
			p2_1->setScale(0.5);
			GameEnd->addChild(p2_1);

			char poker_file_name4[20] = "poker_pic/";
			sprintf(temp, "%d", p2->getCard02());
			strcat(poker_file_name4, temp);
			strcat(poker_file_name4, ".png");
			auto p2_2 = Sprite::create(poker_file_name4);
			p2_2->setPosition(300, 100);
			p2_2->setScale(0.5);
			GameEnd->addChild(p2_2);



			//显示一遍公共牌? 
			Point p[5];
			p[0] = Point(400, 190);
			p[1] = Point(450, 190);
			p[2] = Point(500, 190);
			p[3] = Point(550, 190);
			p[4] = Point(600, 190);
			CCLOG("card_num = %d", card_num);
			for (int i = 0; i < card_num; i++){ //减掉底牌就是公共牌数  ???肯定是哪里不对了,目前程序对

				char poker_file_name5[20] = "poker_pic/";
				sprintf(temp, "%d", gongGongCard[i]);
				strcat(poker_file_name5, temp);
				strcat(poker_file_name5, ".png");
				auto gonggongcard = Sprite::create(poker_file_name5);
				gonggongcard->setScale(0.7);
				gonggongcard->setPosition(p[i]);
				GameEnd->addChild(gonggongcard);
				CCLOG("giveup_gonggong %d = %s", i, poker_file_name5);
			}


			//显示对应牌型的名称
			auto paixing1 = Label::createWithSystemFont(getPaiXing(checkFinal(p2)), "Arial", 20);
			paixing1->setPosition(300, 170);//对应输家的牌型
			paixing1->setColor(ccc3(0, 0, 0));
			GameEnd->addChild(paixing1);

			auto paixing2 = Label::createWithSystemFont(getPaiXing(checkFinal(p1)), "Arial", 20);
			paixing2->setPosition(300, 350);//对应赢家
			paixing2->setColor(ccc3(0, 0, 0));
			GameEnd->addChild(paixing2);

		}//end IF(game_round == 4)

	
}
Esempio n. 6
0
void MainWindow::on_pbOff_clicked()
{
    setColor(QColor(0, 0, 0));
}
Esempio n. 7
0
void TextField::onCursorEnter() {
    setColor(getColor() - mouse_over_dim);
}
////////////////////////////////////////////////////////
//
// ParticleMainScene
//
////////////////////////////////////////////////////////
void ParticleMainScene::initWithSubTest(int asubtest, int particles)
{
    //srandom(0);

    subtestNumber = asubtest;
    auto s = Director::getInstance()->getWinSize();

    lastRenderedCount = 0;
    quantityParticles = particles;

    MenuItemFont::setFontSize(65);
    auto decrease = MenuItemFont::create(" - ", [&](Ref *sender) {
		quantityParticles -= kNodesIncrease;
		if( quantityParticles < 0 )
			quantityParticles = 0;

		updateQuantityLabel();
		createParticleSystem();
	});
    decrease->setColor(Color3B(0,200,20));
    auto increase = MenuItemFont::create(" + ", [&](Ref *sender) {
		quantityParticles += kNodesIncrease;
		if( quantityParticles > kMaxParticles )
			quantityParticles = kMaxParticles;

		updateQuantityLabel();
		createParticleSystem();
	});
    increase->setColor(Color3B(0,200,20));

    auto menu = Menu::create(decrease, increase, NULL);
    menu->alignItemsHorizontally();
    menu->setPosition(Vec2(s.width/2, s.height/2+15));
    addChild(menu, 1);

    auto infoLabel = Label::createWithTTF("0 nodes", "fonts/Marker Felt.ttf", 30);
    infoLabel->setColor(Color3B(0,200,20));
    infoLabel->setPosition(Vec2(s.width/2, s.height - 90));
    addChild(infoLabel, 1, kTagInfoLayer);

    // particles on stage
    auto labelAtlas = LabelAtlas::create("0000", "fps_images.png", 12, 32, '.');
    addChild(labelAtlas, 0, kTagLabelAtlas);
    labelAtlas->setPosition(Vec2(s.width-66,50));

    // Next Prev Test
    auto menuLayer = new ParticleMenuLayer(true, TEST_COUNT, s_nParCurIdx);
    addChild(menuLayer, 1, kTagMenuLayer);
    menuLayer->release();

    // Sub Tests
    MenuItemFont::setFontSize(40);
    auto pSubMenu = Menu::create();
    for (int i = 1; i <= 6; ++i)
    {
        char str[10] = {0};
        sprintf(str, "%d ", i);
        auto itemFont = MenuItemFont::create(str, CC_CALLBACK_1(ParticleMainScene::testNCallback, this));
        itemFont->setTag(i);
        pSubMenu->addChild(itemFont, 10);

        if (i <= 3)
        {
            itemFont->setColor(Color3B(200,20,20));
        }
        else
        {
            itemFont->setColor(Color3B(0,200,20));
        }
    }
    pSubMenu->alignItemsHorizontally();
    pSubMenu->setPosition(Vec2(s.width/2, 80));
    addChild(pSubMenu, 2);

    auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32);
    addChild(label, 1);
    label->setPosition(Vec2(s.width/2, s.height-50));

    updateQuantityLabel();
    createParticleSystem();

    schedule(schedule_selector(ParticleMainScene::step));
}
void
GUILaneWrapper::drawGL(const GUIVisualizationSettings& s) const {
    glPushMatrix();
    const bool isInternal = getLane().getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL;
    bool mustDrawMarkings = false;
    const bool drawDetails =  s.scale * s.laneWidthExaggeration > 5;
    if (isInternal) {
        // draw internal lanes on top of junctions
        glTranslated(0, 0, GLO_JUNCTION + 0.1);
    } else {
        glTranslated(0, 0, getType());
    }
    // set lane color
    if (!MSGlobals::gUseMesoSim) {
        setColor(s);
        glPushName(getGlID()); // do not register for clicks in MESOSIM
    }
    // draw lane
    // check whether it is not too small
    if (s.scale * s.laneWidthExaggeration < 1.) {
        GLHelper::drawLine(myShape);
        if (!MSGlobals::gUseMesoSim) {
            glPopName();
        }
        glPopMatrix();
    } else if (isRailway(getLane().getPermissions())) {
        // draw as railway
        const SUMOReal halfRailWidth = 0.725;
        GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, halfRailWidth * s.laneWidthExaggeration);
        glColor3d(1, 1, 1);
        glTranslated(0, 0, .1);
        GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, (halfRailWidth - 0.2) * s.laneWidthExaggeration);
        drawCrossties(s);
        if (!MSGlobals::gUseMesoSim) {
            glPopName();
        }
        glPopMatrix();
    } else {
        const SUMOReal laneWidth = isInternal ? myQuarterLaneWidth : myHalfLaneWidth;
        mustDrawMarkings = !isInternal;
        GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, laneWidth * s.laneWidthExaggeration);
        if (!MSGlobals::gUseMesoSim) {
            glPopName();
        }
        glPopMatrix();
        // draw ROWs (not for inner lanes)
        if (!isInternal && drawDetails) {
            glPushMatrix();
            glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape
            GUINet* net = (GUINet*) MSNet::getInstance();
            glTranslated(0, 0, .2);
            drawLinkRules(*net);
            if (s.showLinkDecals) {
                drawArrows();
            }
            if (s.showLane2Lane) {
                // this should be independent to the geometry:
                //  draw from end of first to the begin of second
                drawLane2LaneConnections();
            }
            glTranslated(0, 0, .1);
            if (s.drawLinkJunctionIndex) {
                drawLinkNo();
            }
            if (s.drawLinkTLIndex) {
                drawTLSLinkNo(*net);
            }
            glPopMatrix();
        }
    }
    if (mustDrawMarkings && drawDetails) { // needs matrix reset
        drawMarkings(s);
    }
    // draw vehicles
    if (s.scale > s.minVehicleSize) {
        // retrieve vehicles from lane; disallow simulation
        const MSLane::VehCont& vehicles = myLane.getVehiclesSecure();
        for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
            static_cast<const GUIVehicle* const>(*v)->drawGL(s);
        }
        // allow lane simulation
        myLane.releaseVehicles();
    }
}
Esempio n. 10
0
caStripPlot::caStripPlot(QWidget *parent): QwtPlot(parent)
{
    timerID = false;
    thisXaxisType = TimeScale;
    HISTORY = 60;
    thisUnits = Second;
    thisPeriod = 60;
    NumberOfCurves = MAXCURVES;
    onInit = true;
    timeInterval = 1.0;
    setAutoReplot(false);
    setAutoFillBackground(true);
    Start = true;

    // define a grid
    plotGrid = new QwtPlotGrid();
    plotGrid->attach(this);

    plotLayout()->setAlignCanvasToScales(true);

    // define our axis
    if(thisXaxisType == TimeScale) {
        setAxisScale(QwtPlot::xBottom, 0, HISTORY);
    } else {
        setAxisScale(QwtPlot::xBottom, -HISTORY, 0);
    }

    setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom);
    setAxisScale(QwtPlot::yLeft, 0, 1000);

    if(thisXaxisType == TimeScale) {
        // due to time scale we need some distance
        scaleWidget = axisWidget(QwtPlot::xBottom);
        const int fmh = QFontMetrics(scaleWidget->font()).height();
        scaleWidget->setMinBorderDist(fmh * 2, fmh * 2);
        // define time axis
        QTime timeNow= QTime::currentTime();
        setAxisScaleDraw ( QwtPlot::xBottom, new TimeScaleDraw ( timeNow ) );
    }

    // define our curves
    for(int i=0; i< MAXCURVES; i++) {
        curve[i] = new QwtPlotCurve();
        errorcurve[i] = new QwtPlotIntervalCurve();
        fillcurve[i] = new QwtPlotIntervalCurve();
        if(i>0) {
            curve[i]->setZ(curve[i]->z() - i);
            fillcurve[i]->setZ(fillcurve[i]->z() - i);
            errorcurve[i]->setZ(errorcurve[i]->z() - i);
        }
        curve[i]->attach(this);
        errorcurve[i]->attach(this);
        fillcurve[i]->attach(this);
        showCurve(i, false);

        thisYaxisLimitsMax[i] = 100;
        thisYaxisLimitsMin[i] = 0;
    }

    // default colors and styles
    setTitlePlot("");
    setTitleX("");
    setTitleY("");
    setBackground(Qt::black);
    setForeground(QColor(133, 190, 232));
    setScaleColor(Qt::black);
    setGrid(true);
    setGridColor(Qt::gray);
    for(int i=0; i< MAXCURVES; i++) setStyle(Lines, i);
    setColor(Qt::white, 0);
    setColor(Qt::red, 1);
    setColor(Qt::yellow, 2);
    setColor(Qt::cyan, 3);
    setColor(Qt::magenta, 4);
    setColor(Qt::green, 5);
    setColor(Qt::blue, 6);

    setXaxisEnabled(true);
    setYaxisEnabled(true);
    setLegendEnabled(true);

    setAxisFont(QwtPlot::xBottom, QFont("Arial", 10));
    setAxisFont(QwtPlot::yLeft, QFont("Arial", 10));

    installEventFilter(this);

    // display timer
    Timer = new QTimer(this);
    Timer->setInterval(1000);
    connect(Timer, SIGNAL(timeout()), this, SLOT(TimeOut()));

    // data collection thread
    timerThread = new stripplotthread();
    timerThread->start();
    timerThread->threadSetTimer(100);
    timerThread->setPriority(QThread::HighPriority);
    connect(this, SIGNAL(timerThreadStop()), timerThread, SLOT(runStop()));
    connect(timerThread, SIGNAL(update()), this, SLOT(TimeOutThread()),  Qt::DirectConnection);
}
Esempio n. 11
0
void caStripPlot::setStyle(curvStyle s, int number)
{
    if(number < 0 || number > (MAXCURVES-1)) return;
    thisStyle[number] = s;
    setColor(thisLineColor[number], number);
}
Esempio n. 12
0
//----------------------------------------------------------
void ofGLRenderer::setHexColor(int hexColor){
	int r = (hexColor >> 16) & 0xff;
	int g = (hexColor >> 8) & 0xff;
	int b = (hexColor >> 0) & 0xff;
	setColor(r,g,b);
}
Esempio n. 13
0
//----------------------------------------------------------
void ofGLRenderer::setColor(int gray){
	setColor(gray, gray, gray);
}
Esempio n. 14
0
//----------------------------------------------------------
void ofGLRenderer::setColor(const ofColor & color, int _a){
	setColor(color.r,color.g,color.b,_a);
}
Esempio n. 15
0
void MainWindow::on_pbGreen_clicked()
{
    setColor(QColor(0, 170, 0));
}
KonvergoWindow::KonvergoWindow(QWindow* parent) : QQuickWindow(parent), m_debugLayer(false)
{
  // NSWindowCollectionBehaviorFullScreenPrimary is only set on OSX if Qt::WindowFullscreenButtonHint is set on the window.
  setFlags(flags() | Qt::WindowFullscreenButtonHint);

  m_eventFilter = new MouseEventFilter(this);
  installEventFilter(m_eventFilter);

  m_infoTimer = new QTimer(this);
  m_infoTimer->setInterval(1000);

  connect(m_infoTimer, &QTimer::timeout, this, &KonvergoWindow::updateDebugInfo);

#ifdef TARGET_RPI
  // On RPI, we use dispmanx layering - the video is on a layer below Konvergo,
  // and during playback the Konvergo window is partially transparent. The OSD
  // will be visible on top of the video as part of the Konvergo window.
  setColor(QColor("transparent"));
#else
  setColor(QColor("#111111"));
#endif

  loadGeometry();

  connect(SettingsComponent::Get().getSection(SETTINGS_SECTION_MAIN), &SettingsSection::valuesUpdated,
          this, &KonvergoWindow::updateMainSectionSettings);

  connect(this, &KonvergoWindow::visibilityChanged,
          this, &KonvergoWindow::onVisibilityChanged);

  connect(this, &KonvergoWindow::enableVideoWindowSignal,
          this, &KonvergoWindow::enableVideoWindow, Qt::QueuedConnection);

//  connect(QGuiApplication::desktop(), &QDesktopWidget::screenCountChanged,
//              this, &KonvergoWindow::onScreenCountChanged);

  connect(&PlayerComponent::Get(), &PlayerComponent::windowVisible,
          this, &KonvergoWindow::playerWindowVisible);

  connect(&PlayerComponent::Get(), &PlayerComponent::playbackStarting,
          this, &KonvergoWindow::playerPlaybackStarting);

  // this is using old syntax because ... reasons. QQuickCloseEvent is not public class
  connect(this, SIGNAL(closing(QQuickCloseEvent*)), this, SLOT(closingWindow()));

  // make sure that we handle some of the host commands that can be emitted
  connect(&InputComponent::Get(), &InputComponent::receivedHostCommand,
          this, &KonvergoWindow::handleHostCommand);

  connect(qApp, &QCoreApplication::aboutToQuit, this, &KonvergoWindow::saveGeometry);

#ifdef Q_OS_MAC
    // this is such a hack. But I could not get it to enter into fullscreen
    // mode if I didn't trigger this after a while.
    //
    QTimer::singleShot(500, [=]() {
        updateFullscreenState();
    });
#else
    if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "fakefullscreen").toBool())
      updateFullscreenState();
    else if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "fullscreen").toBool() || SystemComponent::Get().isOpenELEC())
      setWindowState(Qt::WindowFullScreen);
#endif

  emit enableVideoWindowSignal();
}
Esempio n. 17
0
void MainWindow::on_pbRed_clicked()
{
    setColor(QColor(170, 0, 0));
}
Esempio n. 18
0
void iALookupTable::setColor(size_t colInd, QColor const & col)
{
	assert(m_isInitialized);
	double rgba[NumberOfColorComponents] = { col.redF(), col.greenF(), col.blueF(), col.alphaF() };
	setColor(colInd, rgba);
}
Esempio n. 19
0
void TextField::onCursorLeave() {
    setColor(getColor() + mouse_over_dim);
}
Esempio n. 20
0
int TPatternBrick::setAttribute (const string& rktNAME, NAttribute nVALUE, EAttribType eTYPE)
{

  if ( rktNAME == "color" )
  {
    if ( eTYPE == FX_COLOR )
    {
      setColor (*((TColor*) nVALUE.pvValue));
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else if ( rktNAME == "base_color" )
  {
    if ( eTYPE == FX_COLOR )
    {
      setBaseColor (*((TColor*) nVALUE.pvValue));
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else if ( rktNAME == "zoom" )
  {
    if ( eTYPE == FX_VECTOR )
    {
      tZoomOriginal = *((TVector*) nVALUE.pvValue);

      tZoom.set (1.0 / tZoomOriginal.x(), 1.0 / tZoomOriginal.y(), 1.0 / tZoomOriginal.z());
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else if ( rktNAME == "width" )
  {
    if ( eTYPE == FX_REAL )
    {
      tBrickWidth = nVALUE.dValue;
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else if ( rktNAME == "height" )
  {
    if ( eTYPE == FX_REAL )
    {
      tBrickHeight = nVALUE.dValue;
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else if ( rktNAME == "mortar" )
  {
    if ( eTYPE == FX_REAL )
    {
      tMortarThickness = nVALUE.dValue;
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }  
  else
  {
    return TPattern::setAttribute (rktNAME, nVALUE, eTYPE);
  }

  return FX_ATTRIB_OK;

}  /* setAttribute() */
bool GameJoltLoginLayer::init(std::function<void()> closeFunc) {
    
    if (!LayerColor::initWithColor(ccc4(0, 0, 0, kOverlayOpacity)))
        return false;
    
    _closeFunc = closeFunc;
    
    Size inputSize = CCSizeMake(this->getContentSize().width * 0.3f, 40);
    
    auto gjLogo = Sprite::create("gamejolt_logo.png");
    gjLogo->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.75f));
    gjLogo->getTexture()->setAliasTexParameters();

    EditBox *loginEditBox = EditBox::create(inputSize, Scale9Sprite::create("editboxbg.png"));
    loginEditBox->setAnchorPoint(ccp(0.5f, 0.5f));
    loginEditBox->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.62f));
    loginEditBox->setFontColor(ccBLACK);
    loginEditBox->setPlaceHolder("Username");
    loginEditBox->setReturnType(kKeyboardReturnTypeDone);
    //_loginEditBox->setDelegate(this);
    
    EditBox *tokenEditBox = EditBox::create(inputSize, Scale9Sprite::create("editboxbg.png"));
    tokenEditBox->setAnchorPoint(ccp(0.5f, 0.5f));
    tokenEditBox->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.52f));
    tokenEditBox->setFontColor(ccBLACK);
    tokenEditBox->setPlaceHolder("Token");
    tokenEditBox->setReturnType(kKeyboardReturnTypeDone);
    //_tokenEditBox->setDelegate(this);
    
    if (UserDefault::sharedUserDefault()->getBoolForKey("Logged", false)) {
        string loggedUser = UserDefault::sharedUserDefault()->getStringForKey("LoggedUser");
        string loggedToken = UserDefault::sharedUserDefault()->getStringForKey("LoggedToken");
        loginEditBox->setText(loggedUser.c_str());
        tokenEditBox->setText(loggedToken.c_str());
    }
    
    auto loginLabel = LabelBMFont::create("Login", "MainFont.fnt", 100, kTextAlignmentCenter);
    auto cancelLabel = LabelBMFont::create("Cancel", "MiniFont.fnt", 100, kTextAlignmentCenter);
    auto logoutLabel = LabelBMFont::create("Logout", "MiniFont.fnt", 100, kTextAlignmentCenter);
    
    loginLabel->setColor(greenLabelColor);
    cancelLabel->setColor(yellowLabelColor);
    logoutLabel->setColor(redLabelColor);
    
    auto loginMenuItem = MenuItemLabel::create(loginLabel, [this, loginEditBox, tokenEditBox](Object *object) {
        
        GameJolt::getInstance()->login(loginEditBox->getText(), tokenEditBox->getText());
        this->getCloseFunc()();
        this->removeFromParentAndCleanup(true);
        
    });
    
    auto cancelMenuItem = MenuItemLabel::create(cancelLabel, [this](Object *object) {
        
        this->getCloseFunc()();
        this->removeFromParentAndCleanup(true);
        
    });
    
    auto logoutMenuItem = MenuItemLabel::create(logoutLabel, [this](Object *object) {
        
        GameJolt::getInstance()->logout();
        this->getCloseFunc()();
        this->removeFromParentAndCleanup(true);
        
    });
    
    auto menu = Menu::create(cancelMenuItem, loginMenuItem, logoutMenuItem, NULL);
    menu->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.4f));
    menu->alignItemsHorizontallyWithPadding(80);
    
    auto notice = LabelBMFont::create("Warning:\nThe token is NOT your password.\nGet yours on GameJolt.com!", "MiniFont.fnt", this->getContentSize().width, kTextAlignmentCenter);
    notice->setPosition(ccp(this->getContentSize().width * 0.5f, this->getContentSize().height * 0.11f));
    
    this->addChild(gjLogo);
    this->addChild(loginEditBox);
    this->addChild(tokenEditBox);
    this->addChild(menu);
    this->addChild(notice);
    
    return true;
}
Esempio n. 22
0
WoodTexture3D::WoodTexture3D(Float persistence, int octaves, int size, int thr)
	:PerlinNoiseTexture3D(persistence, octaves, size, size, size), threshold(thr)
{
	detailNoise.setData(persistence * 0.5, octaves, size * 40, size * 40, size * 40);
	setColor(COLOR_SADDLE_BROWN, COLOR_BLACK);
}
Esempio n. 23
0
bool GameScene::init(){
	if (!Layer::init())
	{
		return false;
	}


	//游戏数据初始化
	card_num = 0;
	debt_num = 0;



	//先添加桌面背景,在最下面
	auto * table = Sprite::create("table.png");
	this->addChild(table);
	auto screenSize = Director::getInstance()->getWinSize();//获取屏幕尺寸  
	table->setPosition(screenSize.width/2,screenSize.height/2-30);
	table->setScale(1.1);//设置缩放级别
	
	//add buttons
	//按钮上的文字后期用ps来制作

	auto giveUpMenuItem = MenuItemImage::create(
		"button01.png",
		"button02.png", CC_CALLBACK_1(GameScene::button_giveUp, this));
	giveUpMenuItem->setPosition(Point(60, 40));

	auto genZhuMenuItem = MenuItemImage::create(
		"button01.png",
		"button02.png", CC_CALLBACK_1(GameScene::button_xiaZhu, this));
	genZhuMenuItem->setPosition(Point(190, 40));

	auto yiLvMenuItem = MenuItemImage::create(
		"button01.png",
		"button02.png", CC_CALLBACK_1(GameScene::button_jiaZhu, this));
	yiLvMenuItem->setPosition(Point(320, 40));

	auto starMenu = Menu::create(giveUpMenuItem, genZhuMenuItem,yiLvMenuItem,NULL);
	starMenu->setPosition(Point::ZERO);
	
	this->addChild(starMenu, 1);

	//按钮上添加文字(暂时的功能,后期完善可以删掉)
	auto button_label01 = Label::createWithSystemFont("giveUp", "Arial", 17);
	button_label01->setPosition(Point(60, 40));
	this->addChild(button_label01,2);
	//按钮上添加文字(暂时的功能,后期完善可以删掉)
	auto button_label02 = Label::createWithSystemFont("xiaZhu", "Arial", 17);
	button_label02->setPosition(Point(190, 40));
	this->addChild(button_label02,2);
	//按钮上添加文字(暂时的功能,后期完善可以删掉)
	auto button_label03 = Label::createWithSystemFont("jiaZhu", "Arial", 17);
	button_label03->setPosition(Point(320, 40));
	this->addChild(button_label03,2);




	// your codes here 
	
	/*

	char str[] = "poker_pic/13.png";
	auto test_card = Sprite::create(str);
	this->addChild(test_card);
	test_card->setPosition(screenSize.width / 2, screenSize.height -400);
	test_card->setScale(0.6);

	auto my_testCard = Card::create("roomgirl.png");  // auto == Card
	my_testCard->setPosition(screenSize.width / 2, screenSize.height - 200);
	my_testCard->setScale(0.6);
	my_testCard->setCardID(23);
	this->addChild(my_testCard);
	CCLOG("my_testCard->ID = %d .", my_testCard->getCardID());//会得到log:my_testCard->ID = 23 .

	*/

	//test_end

	//显示玩家头像,玩家筹码等信息,荷官的片,
	auto roomgirl = Sprite::create("roomgirl.png");
	this->addChild(roomgirl);
	roomgirl->setPosition(screenSize.width/2, screenSize.height-70);
	roomgirl->setScale(1);

	
	player_num = 2;//设置为2名玩家

	//添加游戏玩家(other players)
	auto player01 = addNewPlayer("player01", 50000);

	int my_total = 50000;
	char *my_name = "player_me";
	//添加自己的游戏数据========
	player_me = Player::create("default_player.png");//创建纹理,并且显示在屏幕的正下方
	player_me->setPhoto("default_player.png");
	player_me->setPosition(screenSize.width/2,170);
	player_me->setDebt(0); //set to 0
	player_me->setTotal(my_total);
	player_me->setOnTable(true);
	this->addChild(player_me);
	player01->setPlayerName(my_name);
	player01->setTotal(my_total);

	//show player name
	auto player_me_name = Label::createWithSystemFont(my_name, "Arial", 17);
	player_me_name->setPosition(screenSize.width/2, 215);
	this->addChild(player_me_name);

	//show player total money
	char tmp[9];
	sprintf(tmp, "%d",my_total);
	auto player_me_total = Label::createWithSystemFont(tmp, "Arial", 17);
	player_me_total->setPosition(screenSize.width/2,120);
	this->addChild(player_me_total);


	

	//下底注(后期可以用ps来制作一张图来支持中文)
	//show tips
	auto tips = Sprite::create("show_tips.png");
	tips->setScale(0.3);
	tips->setPosition(screenSize.width / 2, screenSize.height / 2);
	tips->setOpacity(200);
	this->addChild(tips, 0, 100);// set tag 100
	auto tips_label = Label::createWithSystemFont("XiaDiZhu", "SimSun", 30);
	tips_label->setPosition(screenSize.width / 2, screenSize.height / 2);
	tips_label->setColor(ccc3(0, 0, 0));//color black
	this->addChild(tips_label, 0, 101);// set tag 101
	this->scheduleOnce(schedule_selector(GameScene::showTips), 1);//调用回调函数来删掉刚刚创建的tips 
	
	
	player01->addDebt(DIZHU);
	player_me->addDebt(DIZHU);

	debt_num = DIZHU * 2;
	//CCLOG为调试信息
	CCLOG("player01.debt = %d ,total = %d", player01->getDebt(), player01->getTotal());
	CCLOG("player_me.debt = %d ,total = %d", player_me->getDebt(), player_me->getTotal());


	//发底牌(2张底牌)保证不相同
	srand((unsigned)time(NULL)); //初始化随机数种子

	int t1 = getOneNumber();//两名玩家共4张底牌
	int t2 = getOneNumber();
	int t3 = getOneNumber();
	int t4 = getOneNumber();
	CCLOG("DIPAI  == %d %d %d %d",t1,t2,t3,t4);
	player01->setCards(t1,t2);
	player_me->setCards(t3,t4);

	//CCLOG("PLAYER01 c1 = %d, c2 = %d ,PLAYER_ME  c3 = %d, c4 =%d ", player01->getCard01(), player01->getCard02(), player_me->getCard01(), player_me->getCard02());


	//显示玩家得到的底牌(可以添加动画效果)
	char poker_file_name[20]="poker_pic/";
	char temp[9];
	sprintf(temp, "%d", player_me->getCard01());
	strcat(poker_file_name,temp);
	strcat(poker_file_name, ".png");
	//CCLOG("poker_file_name 1 = %s", poker_file_name);
	auto dipai01 = Card::create(poker_file_name);
	dipai01->setRotation(-13);//旋转角度 
	dipai01->setScale(0.5);
	dipai01->setPosition(320, 165);
	this->addChild(dipai01);

	//重新创建一个变量
	char poker_file_name2[20] = "poker_pic/";
	sprintf(temp, "%d", player_me->getCard02());
	strcat(poker_file_name2, temp);
	strcat(poker_file_name2, ".png");
	//CCLOG("poker_file_name 2 = %s", poker_file_name2);
	auto dipai02 = Card::create(poker_file_name2);
	dipai02->setRotation(9);//旋转角度 
	dipai02->setScale(0.5);
	dipai02->setPosition(340, 165);
	this->addChild(dipai02);

	//添加背面的牌:
	auto hand_card_R = Sprite::create("hand_card_back.png");
	hand_card_R->setScale(0.6);
	hand_card_R->setPosition(22, 470);
	this->addChild(hand_card_R);

	//刚发过底牌,设置一个标签,来定义玩到了什么进度
	game_round = 1;//刚发过底牌,设置为1
	
	//若不弃牌,则下注,下注之后可选加注


	//庄家下注,玩家跟注?加注?

	//发第一张公共牌

	//发第二张公共牌

	//...

	//...直到发最后一张公共牌,是否加注?判断游戏输赢
	
	//以上内容写在了按钮中,通过读取变量值来知道是第几个回合

	return true;//init函数执行成功,返回真
}
Esempio n. 24
0
void MainWindow::on_pbYellow_clicked()
{
    setColor(QColor(170, 100, 0));
}
Esempio n. 25
0
void MarkerSymbol::setColor(int r, int g, int b, int a)
{
    setColor(QColor(r, g, b, a));
}
Esempio n. 26
0
void MainWindow::on_pbViolet_clicked()
{
    setColor(QColor(100, 0, 170));
}
Esempio n. 27
0
void UTFT::InitLCD(byte orientation)
{
	orient=orientation;
	_hw_special_init();

	sbi(P_RST, B_RST);
	delay(5); 
	cbi(P_RST, B_RST);
	delay(15);
	sbi(P_RST, B_RST);
	delay(15);

	cbi(P_CS, B_CS);

	switch(display_model)
	{
#ifndef DISABLE_HX8347A
	#include "tft_drivers/hx8347a/initlcd.h"
#endif
#ifndef DISABLE_ILI9327
	#include "tft_drivers/ili9327/initlcd.h"
#endif
#ifndef DISABLE_SSD1289
	#include "tft_drivers/ssd1289/initlcd.h"
#endif
#ifndef DISABLE_ILI9325C
	#include "tft_drivers/ili9325c/initlcd.h"
#endif
#ifndef DISABLE_ILI9325D
	#include "tft_drivers/ili9325d/initlcd.h"
#endif
#ifndef DISABLE_HX8340B_8
	#include "tft_drivers/hx8340b/8/initlcd.h"
#endif
#ifndef DISABLE_HX8340B_S
	#include "tft_drivers/hx8340b/s/initlcd.h"
#endif
#ifndef DISABLE_ST7735
	#include "tft_drivers/st7735/initlcd.h"
#endif
#ifndef DISABLE_PCF8833
	#include "tft_drivers/pcf8833/initlcd.h"
#endif
#ifndef DISABLE_S1D19122
	#include "tft_drivers/s1d19122/initlcd.h"
#endif
#ifndef DISABLE_HX8352A
	#include "tft_drivers/hx8352a/initlcd.h"
#endif
#ifndef DISABLE_SSD1963_480
	#include "tft_drivers/ssd1963/480/initlcd.h"
#endif
#ifndef DISABLE_SSD1963_800
	#include "tft_drivers/ssd1963/800/initlcd.h"
#endif
#ifndef DISABLE_SSD1963_800ALT
	#include "tft_drivers/ssd1963/800alt/initlcd.h"
#endif
#ifndef DISABLE_S6D1121
	#include "tft_drivers/s6d1121/initlcd.h"
#endif
#ifndef DISABLE_ILI9320
	#include "tft_drivers/ili9320/initlcd.h"
#endif
#ifndef DISABLE_ILI9481
	#include "tft_drivers/ili9481/initlcd.h"
#endif
	}

	sbi (P_CS, B_CS); 

	setColor(255, 255, 255);
	setBackColor(0, 0, 0);
	cfont.font=0;
	_transparent = false;
}
Esempio n. 28
0
void MainWindow::on_pbBlue_clicked()
{
    setColor(QColor(0, 0, 170));
}
Esempio n. 29
0
//------------------------------------------------------------------
//
// RadiusMode2
//
//------------------------------------------------------------------
void RadiusMode2::onEnter()
{
    ParticleDemo::onEnter();

    setColor(ccBLACK);
    removeChild(m_background, true);
    m_background = NULL;

    m_emitter = new CCParticleSystemQuad();
    m_emitter->initWithTotalParticles(200);
    addChild(m_emitter, 10);
    m_emitter->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/stars-grayscale.png"));

    // duration
    m_emitter->setDuration(kCCParticleDurationInfinity);

    // radius mode
    m_emitter->setEmitterMode(kCCParticleModeRadius);

    // radius mode: start and end radius in pixels
    m_emitter->setStartRadius(100);
    m_emitter->setStartRadiusVar(0);
    m_emitter->setEndRadius(kCCParticleStartRadiusEqualToEndRadius);
    m_emitter->setEndRadiusVar(0);

    // radius mode: degrees per second
    m_emitter->setRotatePerSecond(45);
    m_emitter->setRotatePerSecondVar(0);


    // angle
    m_emitter->setAngle(90);
    m_emitter->setAngleVar(0);

    // emitter position
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    m_emitter->setPosition(ccp(size.width/2, size.height/2));
    m_emitter->setPosVar(CCPointZero);

    // life of particles
    m_emitter->setLife(4);
    m_emitter->setLifeVar(0);

    // spin of particles
    m_emitter->setStartSpin(0);
    m_emitter->setStartSpinVar(0);
    m_emitter->setEndSpin(0);
    m_emitter->setEndSpinVar(0);

    // color of particles
    ccColor4F startColor = {0.5f, 0.5f, 0.5f, 1.0f};
    m_emitter->setStartColor(startColor);

    ccColor4F startColorVar = {0.5f, 0.5f, 0.5f, 1.0f};
    m_emitter->setStartColorVar(startColorVar);

    ccColor4F endColor = {0.1f, 0.1f, 0.1f, 0.2f};
    m_emitter->setEndColor(endColor);

    ccColor4F endColorVar = {0.1f, 0.1f, 0.1f, 0.2f};
    m_emitter->setEndColorVar(endColorVar);

    // size, in pixels
    m_emitter->setStartSize(32);
    m_emitter->setStartSizeVar(0);
    m_emitter->setEndSize(kCCParticleStartSizeEqualToEndSize);

    // emits per second
    m_emitter->setEmissionRate(m_emitter->getTotalParticles() / m_emitter->getLife());

    // additive
    m_emitter->setIsBlendAdditive(false);
}
Esempio n. 30
0
void PersonShape::setColor( float r, float g, float b, float a )
{
  setColor(Ogre::ColourValue(r, g, b, a));
}