本文整理汇总了C++中setLabel函数的典型用法代码示例。如果您正苦于以下问题:C++ setLabel函数的具体用法?C++ setLabel怎么用?C++ setLabel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLabel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: kernelError
//.........这里部分代码省略.........
return (component = NULL);
}
// Get the basic component structure
component = kernelWindowComponentNew(parent, params);
if (!component)
return (component);
component->type = iconComponentType;
// Set the functions
component->draw = &draw;
component->focus = &focus;
component->setData = &setData;
component->mouseEvent = &mouseEvent;
component->keyEvent = &keyEvent;
component->destroy = &destroy;
// If default colors are requested, override the standard component colors
// with the ones we prefer
if (!(component->params.flags & WINDOW_COMPFLAG_CUSTOMFOREGROUND))
{
component->params.foreground.red = 0x28;
component->params.foreground.green = 0x5D;
component->params.foreground.blue = 0xAB;
component->params.flags |= WINDOW_COMPFLAG_CUSTOMFOREGROUND;
}
if (!(component->params.flags & WINDOW_COMPFLAG_CUSTOMBACKGROUND))
{
memcpy((color *) &component->params.background, &COLOR_WHITE,
sizeof(color));
component->params.flags |= WINDOW_COMPFLAG_CUSTOMBACKGROUND;
}
// Always use our font
component->params.font = windowVariables->font.varWidth.small.font;
// Copy all the relevant data into our memory
icon = kernelMalloc(sizeof(kernelWindowIcon));
if (!icon)
{
kernelWindowComponentDestroy(component);
return (component = NULL);
}
component->data = (void *) icon;
// Copy the image to kernel memory
if (kernelImageCopyToKernel(imageCopy, (image *) &icon->iconImage) < 0)
{
kernelWindowComponentDestroy(component);
return (component = NULL);
}
// Icons use pure green as the transparency color
icon->iconImage.transColor.blue = 0;
icon->iconImage.transColor.green = 255;
icon->iconImage.transColor.red = 0;
// When the icon is selected, we do a little effect that makes the image
// appear yellowish.
if (kernelImageCopyToKernel(imageCopy, (image *) &icon->selectedImage) < 0)
{
kernelWindowComponentDestroy(component);
return (component = NULL);
}
// Icons use pure green as the transparency color
icon->selectedImage.transColor.blue = 0;
icon->selectedImage.transColor.green = 255;
icon->selectedImage.transColor.red = 0;
for (count = 0; count < icon->selectedImage.pixels; count ++)
{
pix = &((pixel *) icon->selectedImage.data)[count];
if (!PIXELS_EQ(pix, &icon->selectedImage.transColor))
{
pix->red = ((pix->red + 255) / 2);
pix->green = ((pix->green + 255) / 2);
pix->blue /= 2;
}
}
if (component->params.font)
setLabel(icon, label, (asciiFont *) component->params.font);
// Now populate the main component
component->width = max(imageCopy->width,
((unsigned)(icon->labelWidth + 3)));
component->height = (imageCopy->height + 5);
if (component->params.font)
component->height += (((asciiFont *)
component->params.font)->glyphHeight * icon->labelLines);
component->minWidth = component->width;
component->minHeight = component->height;
return (component);
}
开发者ID:buddywithgol,项目名称:visopsys,代码行数:101,代码来源:kernelWindowIcon.c
示例2: main
int main(void)
{
// seed pseudorandom number generator
srand48(time(NULL));
// instantiate window
GWindow window = newGWindow(WIDTH, HEIGHT);
// instantiate bricks
initBricks(window);
// instantiate ball, centered in middle of window
GOval ball = initBall(window);
// instantiate paddle, centered at bottom of window
GRect paddle = initPaddle(window);
// instantiate scoreboard, centered in middle of window, just above ball
GLabel label = initScoreboard(window);
// number of bricks initially
int bricks = COLS * ROWS;
// number of lives initially
int lives = LIVES;
// number of points initially
int points = 0;
// keep playing until game over
double velocity_x = drand48() * 3;
double velocity_y = 2.5;
double x = getX(ball);
double y = getY(ball);
waitForClick();
while (lives > 0 && bricks > 0)
{
GEvent event = getNextEvent(MOUSE_EVENT);
if (event != NULL)
if(getEventType(event) == MOUSE_MOVED)
{
double x = getX(event) - getWidth(paddle) / 2;
double y = 500;
setLocation(paddle, x, y);
}
move(ball, velocity_x, velocity_y);
if (getY(ball) + getHeight(ball) > getHeight(window))
{
velocity_y = -velocity_y;
}
else if (getY(ball) <= 0)
{
velocity_y = -velocity_y;
}
else if (getX(ball) + getWidth(ball) > getWidth(window))
{
velocity_x = -velocity_x;
}
else if (getX(ball) <= 0)
{
velocity_x = -velocity_x;
}
GObject object = detectCollision(window, ball);
if (object == paddle)
{
velocity_y = -velocity_y;
}
if ((strcmp(getType(object), "GRect") == 0) && (object != paddle))
{
points = points + 1;
removeGWindow(window, object);
velocity_y = -velocity_y;
char s[12];
sprintf(s, "Score: %i", points);
setLabel(label, s);
}
if (points == 50)
{
char s[12];
sprintf(s, "Well Done!");
setLabel(label, s);
pause(10);
break;
}
if (getY(ball) + 95 >= getHeight(window))
{
lives = lives -1;
removeGWindow(window, ball);
waitForClick();
ball = initBall(window);
char t[12];
sprintf(t, "Lives: %i", lives);
//.........这里部分代码省略.........
开发者ID:rennaw,项目名称:breakout,代码行数:101,代码来源:breakout.c
示例3: mTarget
VSceneJumpEvent::VSceneJumpEvent( void ) :
mTarget( String::EmptyString )
{
setLabel( "SceneJumpEvent" );
}
开发者ID:7Sins,项目名称:Verve,代码行数:5,代码来源:VSceneJumpEvent.cpp
示例4: setLabel
void ofxUILabel::setFont(ofxUIFont *_font)
{
font = _font;
setLabel(label);
}
开发者ID:Dewb,项目名称:ofxUI,代码行数:5,代码来源:ofxUILabel.cpp
示例5: setLabel
Axis::Axis( const Name name, const float value, const bool incremental ) : _name{ name }, _inc{ incremental }
{
setLabel( axisName() );
setValue( value );
}
开发者ID:johnerlandsson,项目名称:TNC_Tools,代码行数:5,代码来源:Axis.cpp
示例6: setLabel
void Altimeter::setUnit(DistanceUnit unit) {
units = unit;
setLabel(Units::unitName(units));
repaintPixmap();
}
开发者ID:Nicolou,项目名称:ExtPlane-Panel,代码行数:5,代码来源:altimeter.cpp
示例7: label_
//=============================================================================
Object::Object(const char* label_in, int tracebackModeIn) : label_(0)
{
setLabel(label_in);
tracebackMode = (tracebackModeIn != -1) ? tracebackModeIn : tracebackMode;
}
开发者ID:haripandey,项目名称:trilinos,代码行数:6,代码来源:Teuchos_Object.cpp
示例8: findMidPoint
LMPacket LMHandler::handle(
cv::Point2f borderPoints[ 3 ] ,
MazeData mazeData ,
bool debugMode
)
{
if( debugMode )
{
std::cout << std::endl ;
std::cout << "<!---------------------------------------------" ;
std::cout << std::endl ;
std::cout << "LMHandler.handle() called. handling..." ;
std::cout << std::endl ;
}
if ( IsNull( mazeData ) )
{
std::cerr << "LMHandler: mazeData of type MazeData is Null" ;
std::cerr << std::endl ;
return LMPacketNull ;
}
if ( !mazeData.image.data )
{
std::cerr << "LMHandler: No mazeImage data!" ;
std::cerr << std::endl ;
return LMPacketNull ;
}
// Declare local variables
cv::Mat annotatedImage ;
cv::Mat processingImage ;
cv::Point2f startLocation ;
cv::Point2f endLocation ;
cv::Point2f ballLocation ;
cv::Point2f centerLocation ;
cv::Point2f criticalPoints[ 6 ] ;
float criticalAngles[ 6 ] ;
float zeroAngle ;
float ballAngle ;
int sextantIndex ;
float scalingArray[ 5 ] ;
float normalizedBallAngle ; // our guy!
std::vector< std::vector< cv::Point > > contours ;
std::vector< std::vector< cv::Point > > approxContours ;
std::vector< cv::Vec4i > hierarchy ;
//std::vector< cv::Point > boundingTriangleVertices ;
int boundingTriangleIndex ;
// Initialize local variables
annotatedImage = mazeData.image.clone( ) ;
startLocation = mazeData.mazePoints[ 0 ] ;
endLocation = mazeData.mazePoints[ 1 ] ;
ballLocation = mazeData.mazePoints[ 2 ] ;
centerLocation = startLocation ;
criticalPoints[ 0 ] = borderPoints[ 0 ] ; // one end of upos
criticalPoints[ 2 ] = borderPoints[ 1 ] ; // one end of vpos
criticalPoints[ 4 ] = borderPoints[ 2 ] ; // one end of wpos
criticalPoints[ 1 ] = findMidPoint( criticalPoints[ 0 ] , criticalPoints[ 2 ] ); // one end of wneg
criticalPoints[ 3 ] = findMidPoint( criticalPoints[ 2 ] , criticalPoints[ 4 ] ); // one end of uneg
criticalPoints[ 5 ] = findMidPoint( criticalPoints[ 0 ] , criticalPoints[ 4 ] ); // one end of vneg
for ( int i = 0 ; i < 6 ; i++ )
{
std::stringstream ss;
ss << std::to_string( i ) << std::fixed << std::setprecision( 0 ) << "(";
ss << criticalPoints[ i ].x << "," << criticalPoints[ i ].y << ")";
std::string label = ss.str();
/*
std::string label ;
label.assign( std::to_string( i ) );
label += "- ( ";
label += std::to_string( criticalPoints[ i ].x );
label += " , ";
label += std::to_string( criticalPoints[ i ].y );
label += " )";
*/
setLabel( annotatedImage , label , criticalPoints[ i ] ) ; // start
//.........这里部分代码省略.........
开发者ID:moonlight-company,项目名称:maze-solver-project,代码行数:101,代码来源:LMHandler.cpp
示例9: mPostEffect
VPostEffectToggleTrack::VPostEffectToggleTrack( void ) :
mPostEffect( NULL )
{
setLabel( "PostEffectTrack" );
}
开发者ID:AnteSim,项目名称:Verve,代码行数:5,代码来源:VPostEffectToggleTrack.cpp
示例10: slag
ToolBar::ToolBar(Slag* slag) :
slag(slag),
pattern_box(new QComboBox)
{
setLabel(tr("Playback controls"));
// Play button
QAction* play_action = new QAction(this);
play_action->setAccel( Qt::Key_Space );
play_action->setIconSet( QPixmap(":/icons/play.png") );
addAction(play_action);
connect(play_action, SIGNAL(activated()), slag, SLOT(play()));
// Stop button
QAction* stop_action = new QAction(this);
stop_action->setAccel( Qt::Key_Space );
stop_action->setIconSet( QPixmap(":/icons/stop.png") );
addAction(stop_action);
connect(stop_action, SIGNAL(activated()), slag, SLOT(stop()));
// Pattern choice box
addSeparator();
pattern_box->setMinimumWidth(100);
addWidget(pattern_box);
connect(pattern_box, SIGNAL(activated(const QString &)),
slag, SLOT(patternChange(const QString &)));
// Play mode: pattern or song
QButtonGroup* mode_group = new QButtonGroup;
mode_group->setExclusive(true);
//mode_group->setLineWidth(0);
//mode_group->setInsideMargin(2);
pattern_mode_radio = new QRadioButton;
pattern_mode_radio->setText(tr("Pattern"));
mode_group->addButton(pattern_mode_radio);
connect(pattern_mode_radio, SIGNAL(clicked()),
slag, SLOT(setPatternMode()));
addWidget(pattern_mode_radio);
song_mode_radio = new QRadioButton;
song_mode_radio->setText(tr("Song"));
mode_group->addButton(song_mode_radio);
connect(song_mode_radio, SIGNAL(clicked()),
slag, SLOT(setSongMode()));
addWidget(song_mode_radio);
QCheckBox* loopCheckBox = new QCheckBox(tr("Loop"));
loopCheckBox->setCheckState(Qt::Checked);
connect(loopCheckBox, SIGNAL(stateChanged(int)),
slag, SLOT(setLoopMode(int)));
addWidget(loopCheckBox);
// Tempo box
addSeparator();
tempoControl = new SpinSlider(
tr( "<font size=\"-1\">BPM:</font>" )
);
tempoControl->setMinimum(20);
tempoControl->setMaximum(300);
tempoControl->setValue(slag->song()->tempo());
connect(tempoControl, SIGNAL(valueChanged(int)), slag, SLOT(setTempo(int)));
addWidget(tempoControl);
// Volume box
volumeControl = new SpinSlider(tr( "<font size=\"-1\">Vol:</font>" ) );
volumeControl->setValue(slag->song()->volumePercent());
connect(volumeControl, SIGNAL(valueChanged(int)),
slag, SLOT(setVolume(int)));
addWidget(volumeControl);
}
开发者ID:amarandon,项目名称:slag,代码行数:74,代码来源:ToolBar.cpp
示例11: setLabel
VSceneJumpTrack::VSceneJumpTrack( void )
{
setLabel( "SceneJumpTrack" );
}
开发者ID:AnteSim,项目名称:Verve,代码行数:4,代码来源:VSceneJumpTrack.cpp
示例12: qwttMark
void PlotZozMarker::setFont(const QFont Font)
{
QwtText qwttMark(label());
qwttMark.setFont(Font);
setLabel(qwttMark);
}
开发者ID:Kansept,项目名称:SanPasport,代码行数:6,代码来源:plotzoz.cpp
示例13: setLabel
void GLabel::setText(const std::string& str) {
setLabel(str);
}
开发者ID:jlutgen,项目名称:stanford-cpp-library,代码行数:3,代码来源:gobjects.cpp
示例14: CParamDisplay
CLabel::CLabel (CRect &size, char *text): CParamDisplay (size)
{
strcpy (label, "");
setLabel (text);
}
开发者ID:rjeschke,项目名称:cetonesynths,代码行数:5,代码来源:CetoneEditor.cpp
示例15: setLabel
void DlgUpdate::beginUpdateCheck() {
progress->setMinimum(0);
progress->setMaximum(0);
setLabel("Checking for updates...");
uChecker->check();
}
开发者ID:DINKIN,项目名称:Cockatrice,代码行数:6,代码来源:dlg_update.cpp
注:本文中的setLabel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论