本文整理汇总了C++中setColor函数的典型用法代码示例。如果您正苦于以下问题:C++ setColor函数的具体用法?C++ setColor怎么用?C++ setColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setColor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setColor
//----------------------------------------------------------
void ofGLRenderer::setColor(const ofColor & color){
setColor(color.r,color.g,color.b,color.a);
}
开发者ID:YeongJoo-Kim,项目名称:openFrameworks,代码行数:4,代码来源:ofGLRenderer.cpp
示例2: draw_desktop
void draw_desktop()
{
setColor(180, 180, 180);
drawRect(0, 0, 800, 600);
}
开发者ID:Bartosh-R,项目名称:lodoovka,代码行数:5,代码来源:Lodoovka.c
示例3: Color4B
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";
//.........这里部分代码省略.........
开发者ID:momororo,项目名称:dodon,代码行数:101,代码来源:OpningScene.cpp
示例4: CCLOG
//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);
//////输家
//.........这里部分代码省略.........
开发者ID:cuizuoli,项目名称:TexusPoker,代码行数:101,代码来源:GameScene.cpp
示例5: getOneNumber
//.........这里部分代码省略.........
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);
开发者ID:cuizuoli,项目名称:TexusPoker,代码行数:67,代码来源:GameScene.cpp
示例6: setColor
void MainWindow::on_pbOff_clicked()
{
setColor(QColor(0, 0, 0));
}
开发者ID:CMon,项目名称:arduinoWifiRemote,代码行数:4,代码来源:mainwindow.cpp
示例7: setColor
void TextField::onCursorEnter() {
setColor(getColor() - mouse_over_dim);
}
开发者ID:sainteos,项目名称:project-spero,代码行数:3,代码来源:text_field.cpp
示例8: updateQuantityLabel
////////////////////////////////////////////////////////
//
// 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));
}
开发者ID:289997171,项目名称:cocos2d-x,代码行数:88,代码来源:PerformanceParticleTest.cpp
示例9: glPushMatrix
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();
}
}
开发者ID:nnaren1902,项目名称:Secure-Vehicle-Platoon,代码行数:84,代码来源:GUILaneWrapper.cpp
示例10: QwtPlot
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);
}
开发者ID:boiarino17,项目名称:epics,代码行数:99,代码来源:castripplot.cpp
示例11: setColor
void caStripPlot::setStyle(curvStyle s, int number)
{
if(number < 0 || number > (MAXCURVES-1)) return;
thisStyle[number] = s;
setColor(thisLineColor[number], number);
}
开发者ID:boiarino17,项目名称:epics,代码行数:6,代码来源:castripplot.cpp
示例12: QQuickWindow
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();
}
开发者ID:speedst3r,项目名称:plex-media-player,代码行数:67,代码来源:KonvergoWindow.cpp
示例13: assert
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);
}
开发者ID:3dct,项目名称:open_iA,代码行数:6,代码来源:iALookupTable.cpp
示例14: setColor
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() */
开发者ID:bartholomule,项目名称:panorama,代码行数:79,代码来源:pat_brick.cpp
示例15: CCSizeMake
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;
}
开发者ID:bassarisse,项目名称:OfficeRampage,代码行数:82,代码来源:GameJoltLoginLayer.cpp
示例16: threshold
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);
}
开发者ID:ShenyaoKe,项目名称:Kaguya,代码行数:6,代码来源:Texture3D.cpp
示例17: CC_CALLBACK_1
//.........这里部分代码省略.........
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);
开发者ID:cuizuoli,项目名称:TexusPoker,代码行数:67,代码来源:GameScene.cpp
示例18: setColor
void MarkerSymbol::setColor(int r, int g, int b, int a)
{
setColor(QColor(r, g, b, a));
}
开发者ID:yudjin87,项目名称:tour_du_monde,代码行数:4,代码来源:MarkerSymbol.cpp
示例19: _hw_special_init
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;
}
开发者ID:SamSalonen,项目名称:iReef,代码行数:76,代码来源:UTFT.cpp
示例20: setColor
void PersonShape::setColor( float r, float g, float b, float a )
{
setColor(Ogre::ColourValue(r, g, b, a));
}
开发者ID:Karsten1987,项目名称:nao_interaction,代码行数:4,代码来源:person_shape.cpp
注:本文中的setColor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论