本文整理汇总了C++中SetImage函数的典型用法代码示例。如果您正苦于以下问题:C++ SetImage函数的具体用法?C++ SetImage怎么用?C++ SetImage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetImage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cMushroom
cMushroom :: cMushroom( double x, double y, int ntype ) : cPowerUp( x, y )
{
visible = 1;
massive = 0;
if( ntype == TYPE_MUSHROOM_DEFAULT )
{
SetImage( GetImage( "game/items/mushroom_red.png" ) );
}
else if( ntype == TYPE_MUSHROOM_LIVE_1 )
{
SetImage( GetImage( "game/items/mushroom_green.png" ) );
}
else
{
printf( "Warning Unknown Mushroom type : %d\n", ntype );
visible = 0;
}
type = ntype;
SetPos( x, y );
velx = 3;
}
示例2: SetImage
void cScreenTown::do_walk()
{
if (g_WalkAround)
{
g_MessageQue.AddToQue(gettext("You can only do this once per week."), 2);
return;
}
sGirl *girl = g_Girls.GetRandomGirl(); // let's get a girl for the player to meet
if (girl == 0) // if there's no girl, no meeting
{
g_MessageQue.AddToQue(walk_no_luck(), 0);
return;
}
// most of the time, you're not going to find anyone unless you're cheating, of course.
int meet_chance = cfg.initial.girl_meet();
if (!g_Dice.percent(meet_chance) && !g_Cheats)
{
g_MessageQue.AddToQue(walk_no_luck(), 1);
return;
}
if (girlimage_id != -1)
{
if (girl)
{
SetImage(girlimage_id, g_Girls.GetImageSurface(girl, IMGTYPE_PROFILE, true, ImageNum));
if (g_Girls.IsAnimatedSurface(girl, IMGTYPE_PROFILE, ImageNum))
SetImage(girlimage_id, g_Girls.GetAnimatedSurface(girl, IMGTYPE_PROFILE, ImageNum));
HideImage(girlimage_id, false);
}
else HideImage(girlimage_id, true);
}
// I'd like to move this to the handler script - once scripts are stable
string message = "You go out searching around town for any new girls. You notice a potential new girl and walk up to her.";
g_MessageQue.AddToQue(message, 2);
int v[2] = { 0, -1 };
cTrigger* trig = 0;
DirPath dp;
string filename;
cScriptManager sm;
if (!(trig = girl->m_Triggers.CheckForScript(TRIGGER_MEET, false, v)))
{
dp = DirPath() << "Resources" << "Scripts" << "MeetTownDefault.script"; // no, so trigger the default one
}
else
{
if (cfg.folders.configXMLch())
dp = DirPath() << cfg.folders.characters() << girl->m_Name << trig->m_Script;
else
dp = DirPath() << "Resources" << "Characters" << girl->m_Name << trig->m_Script; // trigger the girl-specific one
}
eventrunning = true;
sm.Load(dp, girl);
return;
}
示例3: switch
void DragonView::MessageReceived( BMessage *msg )
{
switch( msg->what ) {
case B_MOVE_TARGET:
// Drag-n-drop: our bitmap was dropped somewhere, and it wants the
// image moved
_CopyTarget( msg );
SetImage( MENU_IMAGE_NONE );
break;
case B_COPY_TARGET:
// Drag-n-drop: our bitmap was dropped somewhere, and it wants the
// image copied
_CopyTarget( msg );
break;
case B_TRASH_TARGET:
// Drag-n-drop: our bitmap was dropped somewhere, and it wants the
// image deleted
SetImage( MENU_IMAGE_NONE );
break;
case B_SIMPLE_DATA:
// Drag-n-drop: someone is dropping data onto us; if msg has "refs"
// it was a file drop.
if( msg->HasRef( "refs" ) ) {
_SimpleDataFile( msg );
} else {
_SimpleData( msg );
}
break;
case B_MIME_DATA:
// Drag-n-drop: this is the payload of data we've requested from
// a drag message dropped on our view
_MimeData( msg );
break;
case B_REFS_RECEIVED:
msg->PrintToStream();
break;
default:
// If it's not one of those, we don't know how to handle it... maybe
// our parent class does.
BView::MessageReceived( msg );
break;
}
}
示例4: SetImage
void TextObject::SetText(string text, color c, int maxWidth)
{
mText = text;
mMaxWidth = maxWidth;
mColor = c;
if (!mFont || text.empty())
{
SetImage(NULL);
return;
}
else
{
rect r = mFont->GetTextRect(text, true, maxWidth);
Image* img = resman->NewImage(r.w, r.h, color(255,0,255,0), true);
// Since we used NewImage, gotta do a little slower-rendering to get alpha right,
// because SDL is a bitch about RGBA->RGBA
mFont->UseAlphaBlending(true);
mFont->Render(img, 0, 0, text, mColor, maxWidth);
mFont->UseAlphaBlending(false);
// Done creating, let StaticObject do its stuff to the image
SetImage(img);
}
UpdateCollisionAndOrigin();
}
示例5: SetScale
void ActorJudgment::ChangeJudgment(Judgment New)
{
AnimTime = AnimDuration;
SetScale(1.3f);
Alpha = 1;
switch (New)
{
case Excellent:
SetImage(GameState::GetInstance().GetSkinImage("judge-excellent.png"));
break;
case Perfect:
SetImage(GameState::GetInstance().GetSkinImage("judge-perfect.png"));
break;
case Great:
SetImage(GameState::GetInstance().GetSkinImage("judge-great.png"));
break;
case Bad:
SetImage(GameState::GetInstance().GetSkinImage("judge-bad.png"));
break;
case Miss:
SetImage(GameState::GetInstance().GetSkinImage("judge-miss.png"));
break;
case None:
break;
}
}
示例6: velocity
Enemy::Enemy(sf::Vector2i Position, int _value, bool _isX, std::string fileName,
float Velocity , float PullRange)
: velocity(Velocity),pullRange(PullRange), myPosition(Position),value(_value),isX(_isX)
{
isX = false;
if( value == 10 )
SetImage( fileName );
else if( value >= -9 && value <=9 )
SetImage( Util::int2str( abs( value ) ) + ".PNG" );
else
{
value = -9 + rand()%19;
if( value == 0 ) value = 1;
isX = true;
SetImage( "x.PNG" );
}
if( value < 0 )
isMinus = true;
else
isMinus = false;
mySprite.setType( "enemy" );
mySprite.setCircleMask(20,20,20);
sign = sf::Shape::Rectangle(0.0,0.0,10.0,4.0,sf::Color(0,0,0));
sign.SetCenter(sign.GetPosition().x/2,sign.GetPosition().y/2);
exponent.SetText( Util::int2str( value ) );
exponent.SetSize( 25.0 );
exponent.SetPosition( sf::Vector2f( (float) Position.x, (float) Position.y ) );
exponent.SetColor( sf::Color( 0,0,0) );
startPosition = Position;
pathFinderPoint = Position;
target = Position;
MovementVector.x = MovementVector.y = 64;//150
frameCount = 0;
pathSearched = false;
myAI = PATHWALK;
inMove = false;
targetReached = false;
attacking = false;
pathNumber = 0;
escapeRange = 400;
waitTimeCounter = 0;
waitTime = 50;
numberOfRandomPathPoints = 5;
randomPatrolPath = new std::vector<sf::Vector2i>[numberOfRandomPathPoints] ;
myWeapon = new Weapon(YellowBall);
myWeapon->PutScreenSize(GameEngine::SCREEN_WIDTH,GameEngine::SCREEN_HEIGHT );
myID = GameEngine::getInstance()->pathfinder->AddNewMobID();
std::cout<<"mob"<<myID<<": Is ready for action !\n";
generated = false;
}
示例7: SetImage
void Enemy::TypeSwichColliding()
{
if( !isX )
{
if( GameEngine::getInstance()->DetectCollision(&mySprite,"Derivative.PNG") )
{
value = 0;
isMinus = false;
SetImage( value );
myAI = DEAD;
}else
if( GameEngine::getInstance()->DetectCollision(&mySprite,"Integral.PNG" ) )
{
value = 1;
isX = true;
SetImage( "x.PNG" );
exponent.SetText( Util::int2str( value ) );
}
}else
{
if( value == 0 )
{
isX = false;
value = 1;
SetImage( value );
}
}
}
示例8: switch
void TextureButton::OnUpdateMesh()
{
switch (mButtonState)
{
case ButtonState::Normal:
if (mNormalTextureName.IsValid())
{
SetImage(mNormalTextureName.ToRef());
}
break;
case ButtonState::Selected:
if (mSelectedTextureName.IsValid())
{
SetImage(mSelectedTextureName.ToRef());
}
break;
case ButtonState::Disabled:
if (mDisabledTextureName.IsValid())
{
SetImage(mDisabledTextureName.ToRef());
}
break;
case ButtonState::DisabledSelected:
if (mDisabledSelectedTextureName.IsValid())
{
SetImage(mDisabledSelectedTextureName.ToRef());
}
break;
}
}
示例9: Update
void cFirePlant :: Update( void )
{
if( !visible )
{
return;
}
counter += Framerate.speedfactor;
if( (int)counter < (int)( DESIRED_FPS/2 ) )
{
SetImage( images[1] );
}
else if( (int)counter < DESIRED_FPS )
{
SetImage( images[0] );
}
else
{
counter = 0;
}
if( CollideBoundingBox( &rect, &pPlayer->rect ) )
{
visible = 0;
pPlayer->Get_Item( TYPE_FIREPLANT );
pointsdisplay->AddPoints( 700, (int)posx + image->w/2,(int)posy );
}
Draw( screen );
}
示例10: SetImage
void ImageView::SetImage(SkBitmap* bm)
{
if(bm)
{
SetImage(*bm);
}
else
{
SkBitmap t;
SetImage(t);
}
}
示例11: SetImage
void Card::setSelected(bool selected)
{
this->selected = selected;
if(selected)
{
SetImage(*selectedFrame->image);
SetSubRect(selectedFrame->rectangle);
}
else
{
SetImage(*unselectedFrame->image);
SetSubRect(unselectedFrame->rectangle);
}
}
示例12: SetImage
void wxExListItem::Update()
{
SetImage(m_FileName.GetStat().IsOk() ? wxExGetIconID(m_FileName): -1);
m_ListView->SetItem(*this);
SetReadOnly(m_FileName.GetStat().IsReadOnly());
if (
m_ListView->InReportView() &&
m_FileName.GetStat().IsOk())
{
const unsigned long size = m_FileName.GetStat().st_size; // to prevent warning
SetItem(_("Type"),
(wxFileName::DirExists(m_FileName.GetFullPath()) ? // IsDir not ok
m_FileSpec:
m_FileName.GetExt()));
SetItem(_("In Folder"), m_FileName.GetPath());
SetItem(_("Size"),
(!wxFileName::DirExists(m_FileName.GetFullPath()) ? // IsDir not ok
(wxString::Format("%lu", size)):
wxString(wxEmptyString)));
SetItem(_("Modified"), m_FileName.GetStat().GetModificationTime());
}
}
示例13: Build
bool LatexPreviewWindow::Rebuild(bool switch_to_log)
{
wxBitmap img;
execution_info info;
bool success = Build(
m_control_input->GetValue(),
m_control_template->GetValue(),
img,
info);
m_control_log_operation->ChangeValue(info.cmd);
m_control_log_exitcode->ChangeValue(wxString::Format(wxT("%i") , info.exitcode));
m_control_log->ChangeValue(info.out);
if (success) {
SetImage(img);
m_panel_log->Show(false);
}
else {
m_panel_log->Show(true);
if (switch_to_log)
m_notebook->ChangeSelection(2); // to do: => ShowLog
}
m_control_input->DiscardEdits();
return success;
}
示例14: SetPosition
VerticalScrollingLayer::VerticalScrollingLayer(ImageResource* image, float scrollSpeed, float translucency, float x, float y)
{
SetPosition(x, y);
SetScrollSpeed(scrollSpeed);
SetTranslucency(translucency);
SetImage(image);
}
示例15: init_clara
void
init_clara()
{
at_32 n,handle;
C(GetAvailableCameras(&n));
C(GetCameraHandle(n-1,&handle));
C(SetCurrentCamera(handle));
C(Initialize("/usr/local/etc/andor"));
// C(SetTriggerMode(1 /*external*/));
C(SetTriggerMode(0 /*internal*/));
C(SetExposureTime(.001));
C(SetReadMode(4 /*image*/));
C(SetAcquisitionMode(1 /*single scan*/));
C(CoolerON());
C(SetADChannel(1 /*fast*/));
C(SetFastExtTrigger(1));
C(SetFrameTransferMode(1));
int h=512, w=512;
clara_h=h;
clara_w=w;
//C(SetIsolatedCropMode(1,h,w,1,1));
C(SetImage(1,1,1,w,1,h));
C(GetSizeOfCircularBuffer(&clara_circ_buf_size));
clara_buf=malloc(sizeof(*clara_buf)*
h*w*clara_circ_buf_size);
if(!clara_buf)
printf("can't allocate memory for pictures\n");
//C(SetAcquisitionMode(5 /*run till abort*/));
C(SetTemperature(-15));
}