Prototype Minimap

pull/1/head
sigonasr2 2 years ago
parent 13b3e08d63
commit b0113e77a2
  1. 25
      Faceball2030/main.cpp

@ -1991,10 +1991,33 @@ void FaceBall::RenderHud(float fElapsedTime) {
SetDrawTarget(mapSpr);
Clear(BLACK);
vf2d center = mapSprSize/2;
vf2d minimapGridSize={16,16};
for (int x=-5;x<=5;x++){
for (int y=-5;y<=5;y++){
try{
MapSquare&square=map.at(y+int(player.GetPos().z)).at(x+int(player.GetPos().x));
vf2d squareLoc = center+vf2d{x*minimapGridSize.x,y*minimapGridSize.y};
if (square.wallN){
DrawLine(squareLoc+vf2d{-0.5f,-0.5f}*minimapGridSize,squareLoc+vf2d{0.5f,-0.5f}*minimapGridSize,WHITE);
}
if (square.wallS){
DrawLine(squareLoc+vf2d{-0.5f,0.5f}*minimapGridSize,squareLoc+vf2d{0.5f,0.5f}*minimapGridSize,WHITE);
}
if (square.wallE){
DrawLine(squareLoc+vf2d{0.5f,-0.5f}*minimapGridSize,squareLoc+vf2d{0.5f,0.5f}*minimapGridSize,WHITE);
}
if (square.wallW){
DrawLine(squareLoc+vf2d{-0.5f,-0.5f}*minimapGridSize,squareLoc+vf2d{-0.5f,0.5f}*minimapGridSize,WHITE);
}
} catch (std::out_of_range const& exc) {
std::cout << exc.what() << '\n';
}
}
}
FillCircle(center,5,GREEN);
SetDrawTarget(nullptr);
mapDecal=new Decal(mapSpr);
DrawRotatedDecal(mapCenter-mapSprSize,mapDecal,-fYaw,mapSprSize/2);
DrawRotatedDecal(mapCenter-mapSprSize,mapDecal,-fYaw-PI/2,mapSprSize/2);
SetDecalMode(DecalMode::NORMAL);
}
GradientFillRectDecal({ 0,0 }, vf2d{ (float)ScreenWidth()/2,(float)ScreenHeight()/2 }, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0) }, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0) }, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime > 0.2f ? 64 : 0) }, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0) });

Loading…
Cancel
Save