本文整理汇总了C++中setTextColor函数的典型用法代码示例。如果您正苦于以下问题:C++ setTextColor函数的具体用法?C++ setTextColor怎么用?C++ setTextColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTextColor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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(" ");
}
}
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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 ]);
}
}
}
示例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);
}
示例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;
}
示例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);
}
}
示例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();
}
示例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;
}
示例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);
}