void C_Slider::HighLite(SCREEN *surface,UI95_RECT *cliprect) { UI95_RECT clip,tmp; clip.left=GetX() + SX_; clip.top=GetY() + SY_; if(Flags_ & C_BIT_RIGHT) clip.left-=GetW(); else if(Flags_ & C_BIT_HCENTER) clip.left-=GetW()/2; if(Flags_ & C_BIT_BOTTOM) clip.top-=GetH(); else if(Flags_ & C_BIT_VCENTER) clip.top-=GetH()/2; if(!(Flags_ & C_BIT_ABSOLUTE)) { clip.left+=Parent_->VX_[Client_]; clip.top+=Parent_->VY_[Client_]; } clip.right=clip.left+Slider_->Header->w; clip.bottom=clip.top+Slider_->Header->h; if(!Parent_->ClipToArea(&tmp,&clip,cliprect)) return; if(!(Flags_ & C_BIT_ABSOLUTE)) if(!Parent_->ClipToArea(&tmp,&clip,&Parent_->ClientArea_[Client_])) return; Parent_->BlitTranslucent(surface,MouseOverColor_,MouseOverPercent_,&clip,C_BIT_ABSOLUTE,0); }
void Slider::Draw( int relx, int rely ){ int x, y; x = GetX() + relx; y = GetY() + rely; int markerxr = this->ValToPixel( this->val ); int markerx = x + markerxr; // Draw slider background Video::DrawRect( x, y+(GetH()/2)-SLIDER_H/2, GetW(), SLIDER_H, 0.4f, 0.4f, 0.4f); Video::DrawRect( x+1, y+(GetH()/2)-SLIDER_H/2+1, GetW()-2, SLIDER_H-2, 0.15f, 0.15f, 0.15f); Video::DrawRect( x+3, y+(GetH()/2)-SLIDER_H/2+3, markerxr-3, SLIDER_H-6, 0.4f, 0.4f, 0.4f); // Draw marker Video::DrawRect( markerx-SLIDER_MW/2, y, SLIDER_MW, GetH(), 0.4f, 0.4f, 0.4f); Video::DrawRect( markerx-SLIDER_MW/2+1, y+1, SLIDER_MW-2, GetH()-2, 0.15f, 0.15f, 0.15f); // Render the value indicator char value[20]; snprintf(value,20,"%.2f",this->val); SansSerif->Render( markerx, y, value,Font::CENTER,Font::BOTTOM ); }
void C_ListBox::SetSubParents(C_Window *Parent) { LISTBOX *cur; if(!LabelColor_) LabelColor_=NormalColor_; if(BgImage_) BgImage_->SetInfo(); if(DropDown_) { DropDown_->SetXY(GetW()-DropDown_->GetW()-2,GetH()/2-DropDown_->GetH()/2); DropDown_->SetInfo(); DropDown_->SetFlags(GetFlags()); } cur=Root_; while(cur) { cur->Label_->SetParent(Parent); cur->Label_->SetSubParents(Parent); cur->Label_->SetOwner(this); cur=cur->Next; } }
void C_Tile::Refresh() { if(GetFlags() & C_BIT_INVISIBLE || !Ready() || !Parent_) return; Parent_->SetUpdateRect(GetX(),GetY(),GetX()+GetW(),GetY()+GetH(),GetFlags(),GetClient()); }
void Asteroid::CheckHidden(){ if(GetCurrentPosition().y<-GetH()/2 || GetCurrentPosition().x<-GetW()/2 || GetCurrentPosition().x>WIDTH+GetW()/2){ status = OFFSCREEN; } }
bool CRectangle::Contains(const CRectangle& rc) const { int left1, top1, right1, bottom1; int left2, top2, right2, bottom2; left1 = GetX(); top1 = GetY(); right1 = GetX() + GetW(); bottom1 = GetY() + GetH(); left2 = rc.GetX(); top2 = rc.GetY(); right2 = rc.GetX() + rc.GetW(); bottom2 = rc.GetY() + rc.GetH(); // return !(left1 < right2 && right1 > left2 && // top1 > bottom2 && bottom1 < top2); // return (left1 < right2 || right1 > left2 || // top1 > bottom2 || bottom1 < top2); // return ((left1 < right2) || (right1 > left2) || // (top1 > bottom2) || (bottom1 < top2)); // return (!(left1 < right2) || !(right1 > left2) || // !(top1 > bottom2) || !(bottom1 < top2)); // return (!(left1 < right2) && !(right1 > left2) && // !(top1 > bottom2) && !(bottom1 < top2)); bool xOverlap = valueInRange(left1, left2, right2) || valueInRange(left2, left1, right1); bool yOverlap = valueInRange(top1, top2, bottom2) || valueInRange(top2, top1, bottom1); return xOverlap && yOverlap; }
long C_Slider::CheckHotSpots(long relX,long relY) { // check visibility, enabled and ready if((GetFlags() & C_BIT_INVISIBLE) || !(GetFlags() & C_BIT_ENABLED) || !Ready()){ return(0); } if ( /* (relX < (GetX()+SX_)) || (relX > (GetX()+(Slider_->Header->w)+SX_)) || (relY < (GetY()+SY_)) || (relY > (GetY()+(Slider_->Header->h)+SY_))*/ (relX < GetX()) || (relX > (GetX() + GetW())) || (relY < GetY()) || (relY > (GetY() + GetH())) ){ return(0); } switch(GetType()) { case C_TYPE_VERTICAL: SetRelXY(relX-GetX(),relY-GetY()); return(GetID()); break; case C_TYPE_HORIZONTAL: SetRelXY(relX-GetX(),relY-GetY()); return(GetID()); break; } return(0); }
void C_Slider::Refresh() { if(!Ready() || GetFlags() & C_BIT_INVISIBLE || Parent_ == NULL) return; Parent_->SetUpdateRect(GetX()+SX_,GetY()+SY_,GetX()+SX_+GetW()+1,GetY()+SY_+GetH()+1,GetFlags(),GetClient()); }
//-------------------妖精17--------------------------------- CEnemyFairy17::CEnemyFairy17(double x,double y) { this->x = x - GetW()/2; this->y = y - GetH()/2; this->hp = 150; this->color = 5; }
void C_ATO_Package::Refresh() { if(!Ready() || Flags_ & C_BIT_INVISIBLE || Parent_ == NULL) return; Parent_->SetUpdateRect(GetX(),GetY(),GetX()+GetW(),GetY()+GetH(),Flags_,GetClient()); }
void ListedTextItems::ClearEntries() { Rect oldrect = GetBoundingRect(); _items.Clear(); OnItemsClear(); SetDimensions( GetWidth(), GetH() ); }
void C_ServerItem::Refresh() { if(GetFlags() & C_BIT_INVISIBLE || Parent_ == NULL) return; Parent_->SetUpdateRect(GetX(),GetY(),GetX()+GetW(),GetY()+GetH(),GetFlags(),GetClient()); }
void C_Slider::Draw(SCREEN *surface,UI95_RECT *cliprect) { UI95_RECT rect,s; if(!Ready()) return; if(GetFlags() & C_BIT_INVISIBLE) return; rect.left=GetX(); rect.right=rect.left+GetW(); rect.top=GetY(); rect.bottom=rect.top+GetH(); // if(BgImage_) // { // BgImage_->Blit(0,0,BgImage_->Header->w,BgImage_->Header->h,rect.left,rect.top,800,dest); // //Parent_->Blit(BgImage_->Image,&BgImage_->rect,&rect,GetFlags(),GetClient()); // } if(Slider_) { s.left=0; s.top=0; s.right=Slider_->Header->w; s.bottom=Slider_->Header->h; rect.left=GetX()+SX_; rect.top=GetY()+SY_; rect.right=rect.left+Slider_->Header->w; rect.bottom=rect.top+Slider_->Header->h; if(GetFlags() & C_BIT_ABSOLUTE) { if(!Parent_->ClipToArea(&s,&rect,&Parent_->Area_)) return; } else { rect.left+=Parent_->VX_[GetClient()]; rect.top+=Parent_->VY_[GetClient()]; rect.right+=Parent_->VX_[GetClient()]; rect.bottom+=Parent_->VY_[GetClient()]; if(!Parent_->ClipToArea(&s,&rect,&Parent_->ClientArea_[GetClient()])) return; } if(!Parent_->ClipToArea(&s,&rect,cliprect)) return; rect.left+=Parent_->GetX(); rect.top+=Parent_->GetY(); rect.right+=Parent_->GetX(); rect.bottom+=Parent_->GetY(); Slider_->Blit(surface,s.left,s.top,s.right-s.left,s.bottom-s.top,rect.left,rect.top); if(MouseOver_ || (GetFlags() & C_BIT_FORCEMOUSEOVER)) HighLite(surface,cliprect); } }
//-------------------妖精15--------------------------------- CEnemyFairy15::CEnemyFairy15(double x,double y,int c) { this->x = x - GetW()/2; this->y = y - GetH()/2; this->hp = 200; this->color = 5; this->c = c; }
bool BoundingBox::CollidesWith (const ICollidable& other) const { if (GetZ () >= other.GetZ () + other.GetH () || GetZ () + GetH () <= other.GetZ ()) return false; return spatial3Info_.GetRectangle ().intersects (other.GetRectangle ()); }
long C_ServerItem::CheckHotSpots(long relx,long rely) { if(GetFlags() & C_BIT_INVISIBLE || !(GetFlags() & C_BIT_ENABLED) || !Ready()) return(0); if(relx >= GetX() && rely >= GetY() && relx <= (GetX()+GetW()) && rely <= (GetY()+GetH())) return(GetID()); return(0); }
void C_TimerHook::Refresh() { if(!Ready() || (GetFlags() & C_BIT_INVISIBLE)) return; Parent_->SetUpdateRect(GetX(),GetY(),GetX()+GetW(),GetY()+GetH(),GetFlags(),GetClient()); if(RefreshCallback_) (*RefreshCallback_)(GetID(),C_TYPE_TIMER,this); }
void ListedTextItems::Remove(int id) { if (!_items.Empty() && id>-1 && id<_items.Size() ) { _items.Remove(id); OnItemRemove(id); SetDimensions( GetWidth(), GetH() ); } }
void Meter::UpdateContainer() { UINT width = (UINT)GetW(); UINT height = (UINT)GetH(); if (m_ContainerTexture) m_ContainerTexture->Resize(m_Skin->GetCanvas(), width, height); if (m_ContainerContentTexture) m_ContainerContentTexture->Resize(m_Skin->GetCanvas(), width, height); }
void C_Fill::Refresh() { if(GetFlags() & C_BIT_INVISIBLE || Parent_ == NULL) return; F4CSECTIONHANDLE* Leave=UI_Enter(Parent_); Parent_->SetUpdateRect(GetX(),GetY(),GetX()+GetW(),GetY()+GetH(),GetFlags(),GetClient()); UI_Leave(Leave); }
void VideoSystem::drawGrid() { int xstart = 16 - g_Camera->x() % 16; for (int i = 0; i < GetW()/16; i++) { SDL_Rect r; r.x = xstart + i * 16; r.y = 0; r.w = 1; r.h = GetH(); SDL_FillRect(screen, &r, Color(255,0,0)); } for (int i = 0; i < GetH()/16; i++) { SDL_Rect r; r.x = 0; r.y = i*16; r.w = GetW(); r.h = 1; SDL_FillRect(screen, &r, Color(255,0,0)); } }
long C_ListBox::CheckHotSpots(long relX,long relY) { if(GetFlags() & C_BIT_INVISIBLE || !(GetFlags() & C_BIT_ENABLED)) return(0); if(relX < GetX() || relX > (GetX()+GetW()) || relY < GetY() || relY > (GetY()+GetH())) return(0); SetRelXY(relX-GetX(),relY-GetY()); return(GetID()); }
CBossMystiaBase::CBossMystiaBase(){ x = GAME_RIGHT + 80; y = GAME_CENTER_Y - GetH()/2; yami = 0; yami_r = 60; yami_type = 0; CTamaBoid::lTamaBoid.clear(); CTamaBoid::gx1=0, CTamaBoid::gy1=0; CTamaBoid::gx2=0, CTamaBoid::gy2=0; CTamaBoid::gx3=0, CTamaBoid::gy3=0; }
BOOL C_ListBox::Process(long ID,short HitType) { gSoundMgr->PlaySound(GetSound(HitType)); switch(HitType) { case C_TYPE_LMOUSEUP: if(Callback_) (*Callback_)(ID,HitType,this); if(GetFlags() & C_BIT_ABSOLUTE) OpenWindow((short)(Parent_->GetX() + GetX()), (short)(Parent_->GetY() + GetY() + GetH() + 1), (short)GetW(), (short)GetListHeight());//! else OpenWindow((short)(Parent_->GetX() + Parent_->VX_[GetClient()] + GetX()), (short)(Parent_->GetY() + Parent_->VY_[GetClient()] + GetY() + GetH() + 1), (short)GetW(),(short)GetListHeight());//! return(TRUE); break; } return(FALSE); }
void C_ListBox::SetDropDown(long ImageID) { if(ImageID){ if(DropDown_ == NULL){ DropDown_=new O_Output; DropDown_->SetOwner(this); } DropDown_->SetImage(ImageID); DropDown_->SetXY(GetW() - DropDown_->GetW() - 2, GetH()/2 - DropDown_->GetH()/2); DropDown_->SetFlags(GetFlags()); } }
CRectangle CRectangle::operator / (float div) const { int left1, top1, right1, bottom1; int left2, top2, right2, bottom2; left1 = GetX(); top1 = GetY(); right1 = GetW() / div; bottom1 = GetH() / div; CRectangle result(left1, top1, right1, bottom1); return result; }
CPoint CRectangle::Position(const CompassRose& value) const { switch(value) { case CompassRose::Origin: return CPoint(GetX() + GetW() / 2, GetY() + GetH() / 2); case CompassRose::N: return CPoint(GetX() + GetW() / 2, GetY()); case CompassRose::NE: return CPoint(GetX() + GetW(), GetY()); case CompassRose::E: return CPoint((GetX() + GetW()), GetY() + GetH() / 2); case CompassRose::SE: return CPoint(GetX() + GetW(), GetY() + GetH()); case CompassRose::S: return CPoint(GetX() + GetW() / 2, GetY() + GetH()); case CompassRose::SW: return CPoint(GetX(), GetY() + GetH()); case CompassRose::W: return CPoint(GetX(), GetY() + GetH() / 2); case CompassRose::NW: return CPoint(GetX(), GetY()); case CompassRose::CompassRose_END: default: throw std::runtime_error("Illegal CRectangle::CompassRose enum."); } // switch } // CRectangle::Position
void C_Tile::Draw(SCREEN *surface,UI95_RECT *cliprect) { UI95_RECT clip; long x,y; if(GetFlags() & C_BIT_INVISIBLE || !Ready() || !Parent_) return; clip=*cliprect; if(GetFlags() & C_BIT_ABSOLUTE) { if(clip.left < GetX()) clip.left=GetX(); if(clip.top < GetY()) clip.top=GetY(); if(clip.right > (GetX()+GetW())) clip.right=GetX()+GetW(); if(clip.bottom > (GetY()+GetH())) clip.bottom=GetY()+GetH(); } y=0; while(y < GetH()) { x=0; while(x < GetW()) { Image_->SetXY(x,y); Image_->SetInfo(); Image_->Draw(surface,&clip); if(GetFlags() & C_BIT_HORIZONTAL) x+=Image_->GetW(); else x=GetW(); } if(GetFlags() & C_BIT_VERTICAL) y+=Image_->GetH(); else y=GetH(); } }
BOOL C_Slider::MouseOver(long relx,long rely,C_Base *) { // Don't want to do anything here if(GetFlags() & C_BIT_INVISIBLE || !(GetFlags() & C_BIT_ENABLED) || !Ready()) return(FALSE); if(relx >= (GetX()+SX_) && relx < (GetX()+GetW()+SX_) && rely >= (GetY()+SY_) && rely < (GetY()+GetH()+SY_)) { return(TRUE); } return(FALSE); }
PixelColor::Enum PotraceImage::GetPixelAt(image_size_t x, image_size_t y, int shiftX, int shiftY) const { shiftX = (shiftX > 0 ? 0 : -1); shiftY = (shiftY > 0 ? 0 : -1); x += shiftX; y += shiftY; if (x < 0 || x >= GetW() || y < 0 || y >= GetH()) { return PixelColor::White; } else { return pixelMap[y * GetW() + x]; } }