void UITextBox::Draw(ID3D10Device * graphicsdevice) { auto camPos = Camera2D::GetInstance()->Position(); if (mBackgroundImage) { mBackgroundImage->Draw(graphicsdevice); } auto uiManager = UIManager::Instance(); unsigned xPadding = 5; float textHeight = 8.0f; // TODO: don't hardcode this Graphics::GetInstance()->DrawDebugText(mDisplayText.c_str(), xPadding + m_bottomLeft.X + uiManager->GetBaseWidth() * 0.5f, (- m_bottomLeft.Y + (uiManager->GetBaseHeight() * 0.5f) - m_dimensions.Y) - textHeight * 0.25f); }
bool cPlayer::CollidesUD(bool *collision_map,std::list<cBicho*> &enemies,bool up) { int tile_x,tile_y; //son las coords en tiles donde esta el bicho despues de dar el paso int width_tiles; //num de tiles en horizontal con las que colisiona tile_x = GetX() / TILE_SIZE; if(up && ((GetY() + GetBaseHeight()) / TILE_SIZE) < SCENE_HEIGHT) tile_y = (GetY() + GetBaseHeight()) / TILE_SIZE; //la comprobacion de SCENE_HEIGHT esta para evitar hacer calculos con posiciones fuera de la matriz de colision else tile_y = GetY() / TILE_SIZE; width_tiles = GetBaseWidth()/TILE_SIZE; if((GetX() % TILE_SIZE) != 0) width_tiles++; //evaluo collisiones contra enemigos, no producen slide for(int j=0;j<width_tiles;j++) { if(CollidesWithEnemy(enemies,(tile_x+j) + (tile_y*SCENE_WIDTH))) return true; } //evaluo collisiones contra el escenario, producen slide for(int j=1;j<(width_tiles-1);j++) { if(collision_map[ (tile_x+j) + (tile_y*SCENE_WIDTH) ]) return true; } //si todas las tiles consultadas menos la ultima son traspasables y tengo potencial para girar a la izquierda, hago slideL if(!collision_map[ (tile_x) + (tile_y*SCENE_WIDTH) ]) { if(collision_map[ (tile_x+(width_tiles-1)) + (tile_y*SCENE_WIDTH) ]) { if(GetState() != STATE_WALKLEFT && GetState() != STATE_WALKRIGHT && GetState() != STATE_SKILLWALKLEFT && GetState() != STATE_SKILLWALKRIGHT /*&& (x % TILE_SIZE) < TILE_SIZE/2*/) SetX(GetX()-step_length); return true; } return false; } //si todas las tiles consultadas menos la primera son traspasables y tengo potencial para girar a la derecha, hago slideR else { if(!collision_map[ (tile_x+(width_tiles-1)) + (tile_y*SCENE_WIDTH) ]) { if(GetState() != STATE_WALKLEFT && GetState() != STATE_WALKRIGHT && GetState() != STATE_SKILLWALKLEFT && GetState() != STATE_SKILLWALKRIGHT /*&& (x % TILE_SIZE) >= TILE_SIZE/2*/) SetX(GetX()+step_length); } return true; } }
bool cPlayer::CollidesLR(bool *collision_map,std::list<cBicho*> &enemies,bool right,bool vertical) { int tile_x,tile_y; //son las coords en tiles donde esta el bicho despues de dar el paso int height_tiles; //num de tiles en vertical con las que colisiona if(right && ((GetX() + GetBaseWidth()) / TILE_SIZE) < SCENE_WIDTH) tile_x = (GetX() + GetBaseWidth()) / TILE_SIZE; else tile_x = GetX() / TILE_SIZE; tile_y = GetY() / TILE_SIZE; height_tiles = GetBaseHeight()/TILE_SIZE; if((GetY() % TILE_SIZE) != 0) height_tiles++; //evaluo collisiones contra enemigos, no producen slide for(int j=0;j<height_tiles;j++) { if(CollidesWithEnemy(enemies,(tile_x) + ((tile_y+j)*SCENE_WIDTH))) return true; } //evaluo collisiones contra el escenario, producen slide for(int j=1;j<(height_tiles-1);j++) { return (collision_map[ (tile_x) + ((tile_y+j)*SCENE_WIDTH) ]); } //si todas las tiles consultadas menos la mas alta son traspasables y tengo potencial para ir hacia abajo, hago slideD if(!collision_map[ (tile_x) + (tile_y*SCENE_WIDTH) ]) { if(collision_map[ (tile_x) + ((tile_y+(height_tiles-1))*SCENE_WIDTH) ]) { if(!vertical /*&& (y % TILE_SIZE) < TILE_SIZE/2*/) SetY(GetY()-step_length); return true; } return false; } //si todas las tiles consultadas menos la mas baja son traspasables y tengo potencial para ir hacia arriba, hago slideU else { if(!collision_map[ (tile_x) + ((tile_y+(height_tiles-1))*SCENE_WIDTH) ]) { if(!vertical /*&& (y % TILE_SIZE) >= TILE_SIZE/2*/) SetY(GetY()+step_length); } return true; } }
double CCourse::GetMaxHeight (double distance) const { return GetBaseHeight (distance) + curr_course->scale; }
ui::Dip Image::GetTop() const { return bottom_ + GetBaseHeight(); }