Add a crosshair.

linux_template
sigonasr2 2 years ago
parent 2016053c6e
commit 16533afa58
  1. BIN
      Faceball2030/assets/crosshair.png
  2. 2
      Faceball2030/main.cpp
  3. 2
      Faceball2030/main.h

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -1284,6 +1284,7 @@ bool FaceBall::OnUserCreate()
life3 = new Decal(new Sprite("assets/life3.png")); life3 = new Decal(new Sprite("assets/life3.png"));
life2 = new Decal(new Sprite("assets/life2.png")); life2 = new Decal(new Sprite("assets/life2.png"));
life1 = new Decal(new Sprite("assets/life1.png")); life1 = new Decal(new Sprite("assets/life1.png"));
crosshair = new Decal(new Sprite("assets/crosshair.png"));
enemy_ShootMe = { "assets/enemies/ShootMe.obj", enemy_ShootMe_tex }; enemy_ShootMe = { "assets/enemies/ShootMe.obj", enemy_ShootMe_tex };
enemy_IShoot = { "assets/enemies/IShoot.obj", enemy_IShoot_tex }; enemy_IShoot = { "assets/enemies/IShoot.obj", enemy_IShoot_tex };
@ -1519,6 +1520,7 @@ void FaceBall::RenderHud(float fElapsedTime) {
DrawStringDecal(vf2d{ 112 + hudOffset+32,4+18 }+hudAdjustment, "Triangles: " + std::to_string(triRenderCount), BLACK, { 2,4 }); DrawStringDecal(vf2d{ 112 + hudOffset+32,4+18 }+hudAdjustment, "Triangles: " + std::to_string(triRenderCount), BLACK, { 2,4 });
std::string hudText = "Tags Left: " + std::to_string(tagsRemaining) + " Lives: " + std::to_string(lives); std::string hudText = "Tags Left: " + std::to_string(tagsRemaining) + " Lives: " + std::to_string(lives);
DrawStringPropDecal(vf2d{ hudOffset + (float)(ScreenWidth() / 2 - GetTextSizeProp(hudText).x * 3 / 2)+32,(float)(ScreenHeight() - 64 - GetTextSizeProp(hudText).y * 6)+18 } + hudAdjustment, hudText, WHITE, { 3,6 }); DrawStringPropDecal(vf2d{ hudOffset + (float)(ScreenWidth() / 2 - GetTextSizeProp(hudText).x * 3 / 2)+32,(float)(ScreenHeight() - 64 - GetTextSizeProp(hudText).y * 6)+18 } + hudAdjustment, hudText, WHITE, { 3,6 });
DrawDecal({ float(ScreenWidth() / 2 - crosshair->sprite->width / 2),float(ScreenHeight() / 2 - crosshair->sprite->height / 2) }, crosshair, { 1,1 }, {255,255,255,128});
} }
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) }); 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) });
GradientFillRectDecal({ float(ScreenWidth()/2),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 ? 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?120:hudShakeTime>0?64:0)}); GradientFillRectDecal({ float(ScreenWidth()/2),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 ? 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?120:hudShakeTime>0?64:0)});

@ -237,7 +237,7 @@ class FaceBall : public PixelGameEngine
Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex, Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex,
*enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_IShoot_tex, *enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_IShoot_tex,
*life4,*life3,*life2,*life1; *life4,*life3,*life2,*life1,*crosshair;
vi2d MAP_SIZE; vi2d MAP_SIZE;
vi2d exitCoords = { 0,0 }; vi2d exitCoords = { 0,0 };
std::vector<std::vector<MapSquare>>map; std::vector<std::vector<MapSquare>>map;

Loading…
Cancel
Save