本文整理汇总了C++中setTextColor函数的典型用法代码示例。如果您正苦于以下问题:C++ setTextColor函数的具体用法?C++ setTextColor怎么用?C++ setTextColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTextColor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: render_level
static void render_level()
{
char highscore_string[20];
char points_string[20];
draw_block( food.x, food.y, 0b11101000);
strcpy (points_string,"Points: ");
strcat (points_string,IntToStr(points,6,0));
strcpy (highscore_string,"HI: ");
strcat (highscore_string,IntToStr(highscore,6,0));
// Display point color based on compare with highscore
if (points<highscore || (points==0 && highscore==0)) {
// Black
setTextColor(0xff,0x00);
} else if (points==highscore) {
// Dark Yellow
setTextColor(0xff,0b11011000);
} else if (points>highscore) {
// Dark Green
setTextColor(0xff,0b00011000);
}
DoString(0,0,points_string);
setTextColor(0xff,0b00000011);
DoString(MAX_X-44,0,highscore_string);
}
开发者ID:cokesme,项目名称:f1rmware,代码行数:27,代码来源:snake.c
示例2: drawField
void drawField(int posX, int posY, int sizeX, int sizeY){
int i, j;
setTextColor(FORE_BLACK | BACKGROUND_BLUE);
for(i = posY; i <= posY + sizeY; i++){
moveCursor(posX, i);
printf("*");
moveCursor(posX + sizeX, i);
printf("*");
}
for(i = posX; i <= posX + sizeX; i++){
moveCursor(i, posY);
printf("*");
moveCursor(i, posY + sizeY );
printf("*");
}
setTextColor(FIELD_COLOR);
for(i = posY + 1; i < posY + sizeY ; i++){
for(j = posX + 1; j < posX + sizeX; j++){
moveCursor( j, i);
printf(" ");
}
}
}
开发者ID:Silchenko-Nikita,项目名称:Silchenko-Nikita-s,代码行数:25,代码来源:main.c
示例3: setPos
void ofxSimpleGuiTitle::draw(float x, float y) {
setPos(x, y);
glPushMatrix();
glTranslatef(x, y, 0);
ofEnableAlphaBlending();
ofFill();
// setTextBGColor(value != NULL);
// ofSetColor(0, 0, 0);
ofSetColor(config->fullActiveColor);
ofRect(0, 0, width, height);
// if a toggle
if(value && (*value) && beToggle) {
setTextColor();
//ofLine(0, 0, box.width, box.height);
//ofLine(box.width, 0, 0, box.height);
}
setTextColor(value != NULL);
ofDrawBitmapString(name, 3, 15);
ofDisableAlphaBlending();
glPopMatrix();
}
开发者ID:mrkhnstn,项目名称:MotorsAndSensors,代码行数:27,代码来源:ofxSimpleGuiTitle.cpp
示例4: setPos
void ofxSimpleGuiButton::draw(float x, float y) {
setPos(x, y);
ofPushStyle();
glPushMatrix();
glTranslatef(x, y, 0);
ofEnableAlphaBlending();
ofFill();
setTextBGColor();
ofRect(0, 0, width, height);
// if a toggle
if((*value) && beToggle) {
setTextColor();
//ofLine(0, 0, box.width, box.height);
//ofLine(box.width, 0, 0, box.height);
}
setTextColor();
ofDrawBitmapString(name, 3, 15);
//ofDisableAlphaBlending();
glPopMatrix();
ofPopStyle();
}
开发者ID:LEDAangela,项目名称:ofxNetworkedParameters,代码行数:28,代码来源:ofxSimpleGuiButton.cpp
示例5: getText
void getText(int posX, int posY, char *pointer, short backColor, short foreColor){
setTextColor(backColor | (backColor == BACK_BLACK ? FORE_WHITE : FORE_BLACK));
moveCursor(posX, posY);
printf(">");
setTextColor(backColor | foreColor);
gets(pointer);
}
开发者ID:Silchenko-Nikita,项目名称:Silchenko-Nikita-s,代码行数:7,代码来源:main.c
示例6: setPos
void ofxSimpleGuiTitle::draw(float x, float y) {
setPos(x, y);
if(hasTitle == false) return;
glPushMatrix();
glTranslatef(x, y, 0);
ofEnableAlphaBlending();
ofFill();
// setTextBGColor(value != NULL);
// ofSetColor(0, 0, 0);
ofSetHexColor(config->fullOverColor);
ofRect(0, 0, width, height);
// if a toggle
if(value && (*value) && beToggle) {
setTextColor();
//ofLine(0, 0, box.width, box.height);
//ofLine(box.width, 0, 0, box.height);
}
setTextColor(value != NULL);
ofSetHexColor(0xFFFFFF);
titleFont.drawString(name, 5, 28);
ofDisableAlphaBlending();
glPopMatrix();
}
开发者ID:sokumura,项目名称:ofxSimpleGuiToo,代码行数:30,代码来源:ofxSimpleGuiTitle.cpp
示例7: setPos
void ofxSimpleGuiToggle::draw(float x, float y) {
// enabled = true;
setPos(x, y);
glPushMatrix();
glTranslatef(x, y, 0);
ofEnableAlphaBlending();
ofFill();
setFullColor(*value);
ofRect(0, 0, height, height);
if((*value)) {
setTextColor();
ofLine(0, 0, height, height);
ofLine(height, 0, 0, height);
}
setTextBGColor();
ofRect(height, 0, width - height, height);
setTextColor();
ofDrawBitmapString(name, height + 15, 15);
ofDisableAlphaBlending();
glPopMatrix();
}
开发者ID:UIKit0,项目名称:msalibs,代码行数:27,代码来源:ofxSimpleGuiToggle.cpp
示例8: setPos
void ofxSimpleGuiToggle::draw(float x, float y) {
// enabled = true;
setPos(x, y);
glPushMatrix();
glTranslatef(x, y, 0);
ofEnableAlphaBlending();
ofFill();
setTextBGColor();
if(bLearning){ofSetColor(255,0,0);}
else if(bLearnt){ofSetColor(0,255,0);}
ofRect(0, 0, width, height);
setFullColor(*value);
ofRect(2, 2, height-4, height-4);
if((*value)) {
setTextColor();
ofLine(2, 2, height-4, height-4);
ofLine(height-4, 2, 2, height-4);
}
//setTextBGColor();
//ofRect(height, 0, width - height, height);
setTextColor();
ofDrawBitmapString(name, height + 15, 12);
ofDisableAlphaBlending();
glPopMatrix();
}
开发者ID:Giladx,项目名称:ofxSimpleGuiToo,代码行数:33,代码来源:ofxSimpleGuiToggle.cpp
示例9: drawMap
void drawMap(void)
{
int i, j;
setTextColor(myColors[BS_SPACE]); //画出移动范围
for (i = 0; i < MAP_HEIGHT; i++)
{
gotoTextPos(MAP_BASE_X*2, MAP_BASE_Y + i);
for (j = 0; j < MAP_WIDTH; j++)
{
printf("%2s", mySharps[BS_SPACE]);
}
}
setTextColor(myColors[BS_BLOCK]); //画出移动范围的边框
for (i=0; i<MAP_HEIGHT; i++)
{
gotoTextPos(MAP_BASE_X*2-2, MAP_BASE_Y -1);
for(j=-1; j<MAP_WIDTH+1; j++)
{
printf("%2s", mySharps[BS_BLOCK ]);
}
gotoTextPos(MAP_BASE_X*2-2, MAP_BASE_Y +i);
printf("%2s", mySharps[BS_BLOCK ]);
gotoTextPos(MAP_BASE_X*2+MAP_WIDTH*2, MAP_BASE_Y +i);
printf("%2s", mySharps[BS_BLOCK ]);
gotoTextPos(MAP_BASE_X*2-2, MAP_BASE_Y+MAP_HEIGHT);
for(j=-1; j<MAP_WIDTH+1; j++)
{
printf("%2s", mySharps[BS_BLOCK ]);
}
}
}
开发者ID:ShipuW,项目名称:snake-C-MySql,代码行数:33,代码来源:snake2.cpp
示例10: errorFunc
/*--------------------------------------
* Function: errorFunc(msg, func_name, line, ...)
*------------------------------------*/
void errorFunc(const string* msg, const string* func_name, int line, ...) {
va_list ap;
string s[1024];
va_start(ap, line);
vsprintf(s, msg, ap);
va_end(ap);
printf("\n----------------------------------------\n");
setTextColor("red");
printf("error: %s\n\tin %s() on line %d.\n\n", s, func_name, line);
setTextColor(NULL);
printf("This program will now exit.\n");
#ifdef _WIN32
printLastErrorWin32();
#endif // _WIN32
#if defined(_DEBUG) && defined(_MSC_VER)
printf("Press ENTER to debug...");
getchar();
__debugbreak();
#else
printf("Press ENTER to exit...");
getchar();
#endif
exit(EXIT_FAILURE);
}
开发者ID:philiparvidsson,项目名称:ral-viz,代码行数:31,代码来源:debug.c
示例11: drawSnake
void drawSnake(int z) //画出蛇身及头尾
{
int i=0,j=0;
if (snakeLength[0] < SNAKE_MIN_LEN)
return;
if(z==1)
if (snakeLength[1] < SNAKE_MIN_LEN)
return;
for(j=0;j<z+1;j++)
{
setTextColor(myColors[BS_SHEAD+7*j]);
gotoTextPos((MAP_BASE_X + mySnake[j][0].x)*2, MAP_BASE_Y + mySnake[j][0].y);
printf(mySharps[BS_SHEAD]);
setTextColor(myColors[BS_SBODY+7*j]);
for (i = 1; i < snakeLength[j] - 1; i++)
{
gotoTextPos((MAP_BASE_X + mySnake[j][i].x)*2, MAP_BASE_Y + mySnake[j][i].y);
printf(mySharps[BS_SBODY]);
}
setTextColor(myColors[BS_STAIL+7*j]);
gotoTextPos((MAP_BASE_X + mySnake[j][snakeLength[j]-1].x)*2, MAP_BASE_Y + mySnake[j][snakeLength[j]-1].y);
printf(mySharps[BS_STAIL]);
}
return;
}
开发者ID:ShipuW,项目名称:snake-C-MySql,代码行数:25,代码来源:snake2.cpp
示例12: setUnderline
void Graphics::drawText(const char_t* text, ulong_t length, const Point& topLeft, bool inverted)
{
FontEffects fx = font_.effects();
PalmUnderlineSetter setUnderline(convertUnderlineMode(fx.underline()));
ScalingSetter setScaling(*this);
uint_t height = fontHeight();
uint_t top=topLeft.y;
if (fx.subscript())
top+=(height/3);
if (inverted)
WinDrawInvertedChars(text, length, topLeft.x, top);
else
WinDrawChars(text, length, topLeft.x, top);
if (fx.strikeOut())
{
uint_t baseline = fontBaseline();
top=topLeft.y + (baseline*2)/3;
uint_t width = FntCharsWidth(text, length);
Color_t color=setTextColor(0);
setTextColor(color); // Quite strange method of querying current text color...
color=setForegroundColor(color);
WinDrawOperation old;
if (inverted)
old=WinSetDrawMode(winInvert);
drawLine(topLeft.x, top, topLeft.x+width, top);
if (inverted)
WinSetDrawMode(old);
setForegroundColor(color);
}
}
开发者ID:kjk,项目名称:ars-framework,代码行数:33,代码来源:PalmGraphics.cpp
示例13: setPosition
void ofxSimpleGuiSlider2d::draw(float x, float y) {
setPosition(x, y);
ofPoint pointv;
pointv.x = ofMap((*value).x, min.x, max.x, x, x+width);
pointv.y = ofMap((*value).y, min.y, max.y, y, y+height-config->slider2DTextHeight);
ofEnableAlphaBlending();
glPushMatrix();
glTranslatef(x, y, 0);
ofFill();
setFullColor();
ofRect(0, 0, width, height - config->slider2DTextHeight);
ofFill();
setTextBGColor();
ofRect(0, height-config->slider2DTextHeight, width, config->slider2DTextHeight);
setTextColor();
ofDrawBitmapString(name+"\nx:"+ofToString(value->x, 2)+"\ny:"+ofToString(value->y, 2), 3, height+15-config->slider2DTextHeight);
setTextColor();
ofCircle(pointv.x-x, pointv.y-y, 2);
setTextColor();
ofLine(pointv.x-x, 0, pointv.x-x, height-config->slider2DTextHeight);
ofLine(0, pointv.y-y,width, pointv.y-y);
glPopMatrix();
ofDisableAlphaBlending();
}
开发者ID:ColoursAndNumbers,项目名称:openFrameworks,代码行数:32,代码来源:ofxSimpleGuiSlider2d.cpp
示例14: setColor
//初始化方法
bool GameOver::init() {
Layer::init();
setColor(Color3B::WHITE);
auto size = Director::getInstance()->getVisibleSize();
//添加一个label 显示结束语
auto lable = Label::create();
lable->setString("Game Over!");
lable->setSystemFontSize(80);
lable->setTextColor(Color4B::WHITE);
lable->setPosition(size.width /2, size.height /2 + 100);
addChild(lable);
//添加另一个label 作为重新开始按钮
auto label_2 = Label::create();
label_2->setString("不服,再来");
label_2->setTextColor(Color4B::WHITE);
label_2->setSystemFontSize(30);
label_2->setPosition(size.width/2 , 100);
addChild(label_2);
//绑定触摸方法
auto listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = [label_2](Touch *touch, Event *event){
if (label_2->getBoundingBox().containsPoint(touch->getLocation())) {
auto game = HelloWorld::createScene();
Director::getInstance()->replaceScene(game);
}
return false;
};
Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);
return true;
}
开发者ID:minbaba,项目名称:cocos2dx-DontTouchWhiteBlock,代码行数:36,代码来源:GameOverScene.cpp
示例15: KPImagesListViewItem
ImgurImageListViewItem::ImgurImageListViewItem(KPImagesListView* const view, const QUrl& url)
: KPImagesListViewItem(view, url)
{
const QColor blue = QColor (0, 0, 255);
setTextColor(3, blue);
setTextColor(4, blue);
}
开发者ID:IlyaSukhanov,项目名称:kipi-plugins,代码行数:8,代码来源:imgurimageslist.cpp
示例16: clear
void BracketedSentenceWidget::updateText()
{
alpinocorpus::CorpusInfo corpusInfo =
alpinocorpus::predefinedCorpusOrFallback(d_corpusReader->type());
if (!d_entry.isEmpty() && d_corpusReader)
{
std::vector<alpinocorpus::LexItem> items = d_corpusReader->sentence(
d_entry.toUtf8().constData(), d_query.toUtf8().constData(),
corpusInfo.tokenAttribute(), MISSING_ATTRIBUTE, corpusInfo);
clear();
// Reset colors.
setTextColor(Qt::black);
setTextBackgroundColor(Qt::white);
bool adoptSpace = false;
size_t prevDepth = 0;
for (std::vector<alpinocorpus::LexItem>::const_iterator iter = items.begin();
iter != items.end(); ++iter)
{
size_t depth = iter->matches.size();
if (depth != prevDepth) {
if (depth == 0)
{
setTextColor(Qt::black);
setTextBackgroundColor(Qt::white);
}
else
{
setTextColor(Qt::white);
d_highlightColor.setAlpha(std::min(85 + 42 * depth,
static_cast<size_t>(255)));
setTextBackgroundColor(d_highlightColor);
}
prevDepth = depth;
}
if (adoptSpace) {
insertPlainText(" ");
adoptSpace = false;
}
insertPlainText(QString::fromUtf8(iter->word.c_str()));
std::vector<alpinocorpus::LexItem>::const_iterator next = iter + 1;
if (next != items.end()) {
if (next->matches.size() < depth)
adoptSpace = true;
else
insertPlainText(" ");
}
}
}
}
开发者ID:evdmade01,项目名称:dact,代码行数:58,代码来源:BracketedSentenceWidget.cpp
示例17: init
bool MainScene::init() {
if (!Layer::init())
return false;
auto director = Director::getInstance();
auto pView = director->getOpenGLView();
pView->setDesignResolutionSize(RESOLUTION_WIDTH, RESOLUTION_HEIGHT, ResolutionPolicy::SHOW_ALL);
Size visibleSize = director->getVisibleSize();
Vec2 origin = director->getVisibleOrigin();
//Title 'Kid Sudoku'
auto labelTitle = Label::createWithTTF("Kid Remember It", "fonts/Marker Felt.ttf", 188);
labelTitle->setTextColor(Color4B(0xe3, 0x54, 0xf4, 0xff));
labelTitle->setPosition(Vec2(origin.x + visibleSize.width / 2,
origin.y + visibleSize.height - labelTitle->getContentSize().height/2 - 40)
);
this->addChild(labelTitle);
//Cool Papa-Legend announcement
auto labelAnn = Label::createWithTTF("Cool Papa-Legend : Produce product for our kids.", "fonts/Marker Felt.ttf", 30);
labelAnn->setTextColor(Color4B(0x00, 0xff, 0x00, 0xff));
labelAnn->setPosition(Vec2(origin.x + visibleSize.width / 2,
labelTitle->getPosition().y - labelTitle->getContentSize().height/2 - 60 - labelAnn->getContentSize().height / 2)
);
this->addChild(labelAnn);
//Campaign Button
auto btnPlay = ui::Button::create("btn-menu-0.png",
"btn-menu-1.png",
"btn-menu-2.png");
btnPlay->setScale9Enabled(true);
btnPlay->setCapInsets(Rect(15, 15, 4, 4));
btnPlay->setTitleText("Play");
btnPlay->setTitleFontSize(40);
btnPlay->setContentSize(Size(300, 90));
btnPlay->setPosition(Vec2(origin.x + visibleSize.width / 2,
labelAnn->getPosition().y - labelAnn->getContentSize().height / 2 - 140 - btnPlay->getContentSize().height/2)
);
btnPlay->addClickEventListener(CC_CALLBACK_1(MainScene::onMenuPlayClicked, this));
this->addChild(btnPlay, 1);
//Exit Button
auto btnExit = ui::Button::create("btn-menu-0.png",
"btn-menu-1.png",
"btn-menu-2.png");
btnExit->setScale9Enabled(true);
btnExit->setCapInsets(Rect(15, 15, 4, 4));
btnExit->setTitleText("Exit");
btnExit->setTitleFontSize(40);
btnExit->setContentSize(Size(300, 90));
btnExit->setPosition(Vec2(origin.x + visibleSize.width / 2,
btnPlay->getPosition().y - btnPlay->getContentSize().height / 2 - 40 - btnExit->getContentSize().height/2)
);
btnExit->addClickEventListener(CC_CALLBACK_1(MainScene::onMenuExitClicked, this));
this->addChild(btnExit, 1);
return true;
}
开发者ID:kerlw,项目名称:kidrememberit,代码行数:58,代码来源:MainScene.cpp
示例18: board_menu_draw
void board_menu_draw(board_t* b)
{
setTextColor(0, 0xff);
setIntFont(&Font_7x8);
const int lineh = getFontHeight();
lcdSetCrsr(0, 0);
lcdPrintln("0xb number game");
lcdPrintln("Push < > ^ v");
lcdPrintln("Add same blocks");
lcdPrint("Try to reach '");
setTextColor(colors[N_COLORS-1].bg, colors[N_COLORS-1].fg);
lcdPrint("b");
setTextColor(0, 0xff);
lcdPrintln("'!");
lcdNl();
for (uint i = 0; i < menu_N; i ++) {
if (i == b->menu_item)
lcdPrint(">> ");
else
lcdPrint(" ");
lcdPrint(menu_str[i]);
switch (i) {
case 3:
// width
lcdPrint(" = ");
lcdPrint(IntToStr(b->w, 2, 0));
break;
case 4:
// height
lcdPrint(" = ");
lcdPrint(IntToStr(b->h, 2, 0));
default:
break;
}
lcdNl();
}
if (b->menu_item == 2) {
lcdPrintln(font_list[b->font]);
if (b->font == FONT_NONE) {
uint w = RESX / N_COLORS;
for (uint8_t i = 0; i < N_COLORS; i++) {
const color_t* col = colors + i;
setTextColor(col->bg, col->fg);
DoRect(i*w, 120, w, 10);
}
}
else {
setExtFont(font_list[b->font]);
lcdPrint("789ab");
}
}
}
开发者ID:cokesme,项目名称:f1rmware,代码行数:57,代码来源:0xb.c
示例19: LogWarning
void ComponentItem::SetText(IComponent *comp)
{
if (ptr.lock().get() != comp)
LogWarning("ComponentItem::SetText: the component given is different than the component this item represents.");
QString compType = IComponent::EnsureTypeNameWithoutPrefix(comp->TypeName());
QString name = QString("%1 %2").arg(compType).arg(comp->Name());
setTextColor(0, QColor(Qt::black));
QString localText = QApplication::translate("ComponentItem", "Local");
QString temporaryText = QApplication::translate("ComponentItem", "Temporary");
QString localOnlyText = QApplication::translate("ComponentItem", "UpdateMode:LocalOnly");
QString disconnectedText = QApplication::translate("ComponentItem", "UpdateMode:Disconnected");
const bool sync = comp->IsReplicated();
const bool temporary = comp->IsTemporary();
QString info;
if (!sync)
{
setTextColor(0, QColor(Qt::blue));
info.append(localText);
}
if (temporary)
{
setTextColor(0, QColor(Qt::red));
if (!info.isEmpty())
info.append(" ");
info.append(temporaryText);
}
if (comp->UpdateMode() == AttributeChange::LocalOnly)
{
if (!info.isEmpty())
info.append(" ");
info.append(localOnlyText);
}
if (comp->UpdateMode() == AttributeChange::Disconnected)
{
if (!info.isEmpty())
info.append(" ");
info.append(disconnectedText);
}
if (!info.isEmpty())
{
info.prepend(" (");
info.append(")");
setText(0, name + info);
}
else
setText(0, name);
}
开发者ID:Pouique,项目名称:naali,代码行数:56,代码来源:SceneTreeWidgetItems.cpp
示例20: textColor
/*!
Sets the label's color to follow the theme.
*/
void SnsrLabel::setThemedTextColor()
{
QColor textColor(HbColorScheme::color(SnsrColors::WidgetColorRole.latin1()));
if (textColor.isValid()) {
setTextColor(textColor);
} else {
// fallback mechanism when color definition is missing in default theme
setTextColor(Qt::white);
}
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:13,代码来源:snsrlabel.cpp
注:本文中的setTextColor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论