//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CAvatarImagePanel::SetPlayer( C_BasePlayer *pPlayer ) { if ( GetImage() ) { ((CAvatarImage*)GetImage())->ClearAvatarSteamID(); } #ifndef NO_STEAM if ( pPlayer && SteamUtils() ) { int iIndex = pPlayer->entindex(); player_info_t pi; if ( engine->GetPlayerInfo(iIndex, &pi) ) { if ( pi.friendsID ) { CSteamID steamIDForPlayer( pi.friendsID, 1, SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual ); if ( !GetImage() ) { CAvatarImage *pImage = new CAvatarImage(); SetImage( pImage ); } ((CAvatarImage*)GetImage())->SetAvatarSteamID( steamIDForPlayer ); // Indent the image. These are deliberately non-resolution-scaling. int iIndent = 2; GetImage()->SetPos( iIndent, iIndent ); GetImage()->SetSize( GetWide()-(iIndent*2), GetTall()-(iIndent*2) ); } } } #endif }
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; }
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; } }
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; }
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(); }
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; } }
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; }
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 ); } } }
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; } }
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 ); }
void ImageView::SetImage(SkBitmap* bm) { if(bm) { SetImage(*bm); } else { SkBitmap t; SetImage(t); } }
void Card::setSelected(bool selected) { this->selected = selected; if(selected) { SetImage(*selectedFrame->image); SetSubRect(selectedFrame->rectangle); } else { SetImage(*unselectedFrame->image); SetSubRect(unselectedFrame->rectangle); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CAvatarImagePanel::SetPlayer( C_BasePlayer *pPlayer ) { if ( GetImage() ) { ((CAvatarImage*)GetImage())->ClearAvatarSteamID(); } if ( pPlayer && steamapicontext->SteamUtils() ) { int iIndex = pPlayer->entindex(); player_info_t pi; if ( engine->GetPlayerInfo(iIndex, &pi) ) { if ( pi.friendsID ) { CSteamID steamIDForPlayer( pi.friendsID, 1, steamapicontext->SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual ); if ( !GetImage() ) { CAvatarImage *pImage = new CAvatarImage(); SetImage( pImage ); } CAvatarImage *pAvImage = ((CAvatarImage*)GetImage()); pAvImage->SetAvatarSteamID( steamIDForPlayer ); // Indent the image. These are deliberately non-resolution-scaling. pAvImage->SetAvatarSize( 32, 32 ); // Deliberately non scaling SetSize( pAvImage->GetWide(), GetTall() ); } } } }
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; }
void CImagePanelUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) { if (_tcscmp(pstrName, _T("width")) == 0) SetWidth(_ttoi(pstrValue)); else if (_tcscmp(pstrName, _T("height")) == 0) SetHeight(_ttoi(pstrValue)); else if (_tcscmp(pstrName, _T("image")) == 0) SetImage(pstrValue); else CControlUI::SetAttribute(pstrName, pstrValue); }
VerticalScrollingLayer::VerticalScrollingLayer(const char* imageFileName, float scrollSpeed, float translucency, float x, float y) { SetPosition(x, y); SetScrollSpeed(scrollSpeed); SetTranslucency(translucency); SetImage(imageFileName); }
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()); } }
Alien::Alien(wsp::Image *img) { SetImage(img); DefineCollisionRectangle(28, 14, 42, 55); resetMotion(); resetPosition(); resetShotCountdown(); }
VerticalScrollingLayer::VerticalScrollingLayer(ImageResource* image, float scrollSpeed, float translucency, float x, float y) { SetPosition(x, y); SetScrollSpeed(scrollSpeed); SetTranslucency(translucency); SetImage(image); }
void Widget::showVideo() { if(ui->openBtn->text()=="Open") { ffmpeg=new QFFmpeg(this); connect(ffmpeg, SIGNAL(GetImage(QImage)), this, SLOT(SetImage(QImage))); ffmpeg->Start(); ffmpeg->SetUrl(ui->urlLineEdit->text()); if (ffmpeg->Init()) { rtsp->setffmpeg(ffmpeg); rtsp->start(); } ui->openBtn->setText("Close"); qDebug()<<"Open"; } else if(ui->openBtn->text()=="Close") { rtsp->stop(); ui->openBtn->setText("Open"); qDebug()<<"Close"; } }
// Constructor ParallaxLayer::ParallaxLayer(const sf::Image &img, float factor_x, bool repeat_x, float offset_x, float factor_y, bool repeat_y, float offset_y){ SetImage(img); // calculamos el ancho y alto de la imagen, esto // nos va a servir para evitar desbordes en el desplazamiento ancho_img=img.GetWidth(); alto_img=img.GetHeight(); // inicializamos las variables internas despl_x=despl_y=0; this->factor_x=factor_x; this->factor_y=factor_y; this->repeat_x=repeat_x; this->repeat_y=repeat_y; this->offset_x=offset_x; this->offset_y=offset_y; // seleccionamos la textura y habilitamos la repeticion // segun corresponda img.Bind(); if(repeat_x) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); if(repeat_y) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // ajustamos la posicion de la capa Sprite::SetPosition(offset_x, offset_y); SetScale(0.5,0.5); }
/******************************************************************* * Function Name: Overlay * Return Type : int * Created On : Jul 7, 2013 * Created By : hrushi * Comments : Overlay * Arguments : const AllDetectedCtrs& Ctrs, bool toDisplay *******************************************************************/ int DetectionImg::Overlay( const AllDetectedCtrs& AllCtrs, bool toDisplay, const Args& args) { ColorImg Img; Img.SetImage(m_data); for( auto Cntur : AllCtrs.Get_vCtrs()) { Img = Overlay(Cntur, false, args ); SetImage( Img.GetDataRef() ); } if( toDisplay ) { if( args.GetRunMode() == OP_DEMO) { Display(0); } else { Display(DISP_DELAY); } } return EXIT_SUCCESS; }
/**\brief Constructor */ Projectile::Projectile(float damageBooster, float angleToFire, Coordinate worldPosition, Coordinate firedMomentum, Weapon* _weapon) { damageBoost=damageBooster; // All Projectiles get these ownerID = 0; targetID = 0; start = Timer::GetTicks(); SetRadarColor (Color(0x55,0x55,0x55)); // These are based off of the Ship firing this projectile SetWorldPosition( worldPosition ); SetAngle(angleToFire); // These are based off of the Weapon weapon = _weapon; secondsOfLife = weapon->GetLifetime(); SetImage(weapon->GetImage()); Trig *trig = Trig::Instance(); Coordinate momentum = GetMomentum(); float angle = static_cast<float>(trig->DegToRad( angleToFire )); momentum = firedMomentum + Coordinate( trig->GetCos( angle ) * weapon->GetVelocity(), -trig->GetSin( angle ) * weapon->GetVelocity() ); SetMomentum( momentum ); }
bool Texture::Load (const string& fn, const string& hintpath) { name = fltk::filename_name(fn.c_str()); glIdent = 0; vector<string> paths; paths.push_back (""); if (!hintpath.empty()) paths.push_back (hintpath); if (!textureLoadDir.empty ()) paths.push_back (textureLoadDir + "/"); bool succes=true; for(uint a=0;a<paths.size();a++) { Image *img = new Image; try { img->Load ( (paths[a] + fn).c_str()); succes = true; } catch(content_error& e) { logger.Print ("Failed to load texture: %s\n", e.errMsg.c_str()); succes = false; delete img; } if (succes) { SetImage(img); break; } } return succes; }
void UIFont::CopyFrom(UIFont *Other) { if (!Other) return; SetFace(Other->GetFace()); SetColor(Other->GetColor()); SetBrush(Other->GetBrush()); QPoint offset; QColor color; int blur; quint16 size; Other->GetShadow(offset, color, blur); SetShadow(Other->HasShadow(), offset, color, blur); Other->GetOutline(color, size); SetOutline(Other->HasOutline(), color, size); SetOffset(Other->GetOffset()); SetRelativeSize(Other->GetRelativeSize()); SetSize(Other->GetFace().pixelSize()); SetStretch(Other->GetStretch()); SetImageFileName(Other->GetImageFileName()); SetImageReady(Other->GetImageReady()); UIImage* image = Other->GetImage(); if (image) { SetImage(image); m_image->UpRef(); } }
void ANDOR885_Camera::setReadMode(int rMode) throw(std::exception) { int errorValue; /* if(value.compare("Multi-track") == 0) { readMode=READMODE_MULTI_TRACK; std::cerr << "Read mode is multi-track" << std::endl; } else if(value.compare("Random-track") == 0) { readMode=READMODE_RANDOM_TRACK; std::cerr << "Read mode is random-track" << std::endl; } else if(value.compare("Single-track") == 0) { readMode=READMODE_SINGLE_TRACK; std::cerr << "Read mode is single-track" << std::endl; } else */ if(rMode == READMODE_IMAGE) { if(readMode != READMODE_IMAGE){ errorValue=SetReadMode(rMode); throwError(errorValue, "Error setting Read Mode"); readMode = READMODE_IMAGE; SetImage(1,1,1,imageWidth,1,imageHeight); } } else { throw ANDOR885_Exception("Unrecognized Read Mode requested"); } }
void C_Tile::Setup(long ID,short Type,long ImageID) { SetID(ID); SetType(Type); SetDefaultFlags(); SetImage(ImageID); }
void cScreenCentreManagement::update_image() { // Draw a girls profile picture and description when selected if (selected_girl) { bool Rand = false; if (lastNum != selection) { string text = g_Girls.GetGirlMood(selected_girl); text += "\n\n"; text += selected_girl->m_Desc; // Added a little feedback here to show what character template a girl is based on --PP // `J` I usually don't care about this so I made it optional if (cfg.debug.log_extradetails()) { text += "\n\nBased on: "; text += selected_girl->m_Name; } EditTextItem(text, girldesc_id); Rand = true; lastNum = selection; } SetImage(girlimage_id, g_Girls.GetImageSurface(selected_girl, IMGTYPE_PROFILE, Rand, ImageNum)); HideImage(girlimage_id, false); } else { selection = lastNum = -1; EditTextItem("No Girl Selected", girldesc_id); HideImage(girlimage_id, true); } }
cMouseCursor :: cMouseCursor( double x, double y ) : cSprite ( NULL, x, y ) { SetImage( GetImage( "game/mouse.png" ) ); HoveredObject.x = 0; HoveredObject.y = 0; HoveredObject.w = 0; HoveredObject.h = 0; Mover_mouse = GetImage( "game/axis_m.png" ); MouseObject = NULL; CopyObject = NULL; mouse_H = 0; mouse_W = 0; fastCopyMode = 0; mover_mode = 0; MousePressed_left = 0; MousePressed_right = 0; clickcounter = 0; active_type = -1; active_number = -1; }
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)); }