diff --git a/.gitattributes b/.gitattributes index e26c5d1..aab85bf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,384 +1,3 @@ -res/PNG/Default[[:space:]]size/tankBody_darkLarge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletDark3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/sandbagBeige_open.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBlue_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankDark_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadCrossing.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadSplitN.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/crateWood.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_transitionW.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletBlue2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletBlue3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/oilSpill_large.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel7.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/treeBrown_small.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletDark2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosion1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosion3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadSplitS.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletGreen3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletSand2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBlue_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_huge.png filter=lfs diff=lfs merge=lfs -text -res/Tilesheet/terrainTiles_retina.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel6_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadCornerUL.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBlue_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_red_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadCornerLR.png filter=lfs diff=lfs merge=lfs -text -res/Tilesheet/terrainTiles_default.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tank_blue.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barrelBlack_top.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosionSmoke5.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_blue.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadCrossingRound.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadTransitionE.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barrelRed_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletDark1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletRed3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadTransitionN_dirt.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/shotLarge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel4.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tank_red.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_bigRed_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankDark_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankGreen_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletDark1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tank_blue.png filter=lfs diff=lfs merge=lfs -text -res/Spritesheet/allSprites_default.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/shotOrange.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barrelRust_top.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletDark2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletDark3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBlue_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_green_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/crateMetal.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/crateWood.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_bigRed.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankRed_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankRed_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletBlue2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadSplitS.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletRed2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletSand1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankSand_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankDark_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletSand3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel5.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadCornerUR.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/treeBrown_large.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletRed1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosionSmoke1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBlue_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tank_darkLarge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tracksLarge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletDark1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barrelBlack_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletBlue2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/shotRed.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBlue_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_bigRed.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tank_huge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadCrossingRound.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletSand2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/wireCrooked.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletSand2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankDark_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadCornerLL.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadSplitN.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel6.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/treeGreen_twigs.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletRed3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_sand.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadCrossing.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletSand3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankDark_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankRed_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadSplitN.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barricadeWood.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/crateMetal.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/shotOrange.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel4_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankGreen_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tank_red.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankSand_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barrelRed_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletSand3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_transitionE.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadNorth.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadTransitionE.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadNorth.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/treeGreen_small.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/treeGreen_twigs.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletRed2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/wireStraight.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barrelRust_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletBlue3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosion4.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/fenceRed.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/treeBrown_leaf.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tracksLarge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletGreen2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletRed1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBlue_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_red.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_blue_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_red.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankGreen_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletBlue2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/crateMetal_side.png filter=lfs diff=lfs merge=lfs -text -res/Spritesheet/onlyObjects_retina.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/crateWood_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel4_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_bigRed_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankDark_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadSplitE.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barrelGreen_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletBlue1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/oilSpill_large.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/shotThin.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadCornerLL.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadCornerUR.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadTransitionN_dirt.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_sand.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barrelBlack_top.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosionSmoke5.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel7.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBlue_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_huge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tracksSmall.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadCornerUR.png filter=lfs diff=lfs merge=lfs -text -res/Spritesheet/onlyObjects_default.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/crateWood_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankRed_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_transitionE.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel5.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tracksSmall.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/sandbagBeige_open.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadTransitionW_dirt.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_huge_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankSand_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankSand_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadSplitW.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_transitionS.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletRed2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barrelBlack_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosion2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankGreen_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadTransitionS_dirt.png filter=lfs diff=lfs merge=lfs -text -res/Spritesheet/allSprites_retina.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/shotThin.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/treeGreen_leaf.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barrelGreen_top.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosion4.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadSplitW.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletDark2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosion3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosionSmoke3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadCornerLL.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/treeGreen_small.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_transitionS.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankGreen_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankSand_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel5_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadTransitionS.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadEast.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankGreen_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadCornerUL.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankSand_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletDark1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/treeGreen_leaf.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankGreen_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankDark_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankGreen_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadCornerLR.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel6_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_green_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankGreen_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosion5.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/fenceYellow.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tank_huge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tank_green.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_blue_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadTransitionN.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletRed2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadCornerUR.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barrelGreen_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tank_green.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadTransitionE_dirt.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barrelRed_top.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankRed_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadTransitionW.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_dark.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel4.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_green.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletSand2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankRed_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadTransitionS.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadTransitionW.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletGreen1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosionSmoke1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankDark_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankSand_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_dark_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadTransitionW_dirt.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletGreen2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/oilSpill_small.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/shotLarge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadSplitE.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barricadeWood.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletRed3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_darkLarge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadCrossing.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadCrossingRound.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletSand1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosionSmoke4.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/fenceRed.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankDark_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel5_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_sand_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadNorth.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosionSmoke2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_darkLarge_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankRed_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tank_sand.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosionSmoke2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/sandbagBrown_open.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadTransitionS_dirt.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadNorth.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBlue_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletGreen1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletRed1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/fenceYellow.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankSand_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barrelRust_top.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosion5.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/sandbagBeige.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_darkLarge_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankSand_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadTransitionE_dirt.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadCrossing.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tracksDouble.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosionSmoke4.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tank_bigRed.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadSplitN.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletDark2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/treeBrown_large.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletBlue1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletDark3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletGreen1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tank_dark.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/treeGreen_large.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletBlue1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBody_green.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletBlue3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBlue_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_transitionN.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barrelRust_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barricadeMetal.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/oilSpill_small.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankRed_barrel3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletRed1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel6.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankGreen_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadSplitW.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadSplitE.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBlue_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankBlue_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletSand1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankSand_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/treeBrown_small.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadCornerUL.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_transitionW.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletSand3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankRed_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankSand_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/explosion1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/sandbagBrown.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletGreen2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletBlue1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/shotRed.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadSplitE.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_dark_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_huge_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadCornerLL.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadCornerLR.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankRed_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadTransitionN.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/treeBrown_twigs.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankDark_barrel1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_sand_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadCornerUL.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/treeBrown_leaf.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/sandbagBeige.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tank_bigRed.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/sandbagBrown_open.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/barricadeMetal.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletBlue3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/crateMetal_side.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_dark.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadSplitS.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletDark3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletRed3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankGreen_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadSplitS.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/treeBrown_twigs.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosionSmoke3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_red_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tank_sand.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadEast.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletGreen2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankDark_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_roadEast.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/wireCrooked.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barrelGreen_top.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletGreen3_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadSplitW.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/bulletGreen3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankGreen_barrel2_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/specialBarrel7_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankBody_blue.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletGreen1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletSand1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass1.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankRed_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileGrass_roadCornerLR.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/wireStraight.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tank_dark.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileGrass_transitionN.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tileSand_roadEast.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankRed_barrel3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/bulletGreen3.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tankSand_barrel2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/tracksDouble.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/treeGreen_large.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/explosion2.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/sandbagBrown.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tankDark_barrel1_outline.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tank_darkLarge.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Default[[:space:]]size/tileSand_roadCrossingRound.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/barrelRed_top.png filter=lfs diff=lfs merge=lfs -text -res/PNG/Retina/specialBarrel7_outline.png filter=lfs diff=lfs merge=lfs -text -res/Vector/topdownTanks_vector.svg filter=lfs diff=lfs merge=lfs -text -res/Vector/topdownTanks_vector.swf filter=lfs diff=lfs merge=lfs -text -res/DejaVuSans.ttf filter=lfs diff=lfs merge=lfs -text -res/Sounds/tank_shot.flac filter=lfs merge=lfs -text +res/** filter=lfs diff=lfs merge=lfs -text +*.txt filter= diff= merge=lfs text +*.xml filter= diff= merge=lfs text diff --git a/.github/workflows/macos_clang.yaml b/.github/workflows/macos_clang.yaml index 2c1529c..1999441 100644 --- a/.github/workflows/macos_clang.yaml +++ b/.github/workflows/macos_clang.yaml @@ -24,11 +24,15 @@ jobs: - name: Checkout LFS objects run: git lfs checkout + - name: Install OpenAl audio + run: | + brew install openal-soft + - name: Install vcpkg packages # vcpkg binary can only be compiled using gcc for now (bootstrap step) run: | ./vcpkg/bootstrap-vcpkg.sh - + - name: Create Build Environment run: | cmake -E make_directory ${{runner.workspace}}/build @@ -46,4 +50,4 @@ jobs: working-directory: ${{runner.workspace}}/build shell: bash run: | - cmake --build . --config $BUILD_TYPE + cmake --build . --config $BUILD_TYPE -- -j $(sysctl -n hw.logicalcpu) diff --git a/.github/workflows/ubuntu_gcc.yaml b/.github/workflows/ubuntu_gcc.yaml index 928202a..5822faf 100644 --- a/.github/workflows/ubuntu_gcc.yaml +++ b/.github/workflows/ubuntu_gcc.yaml @@ -70,7 +70,7 @@ jobs: working-directory: ${{runner.workspace}}/build shell: bash # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config $BUILD_TYPE + run: cmake --build . --config $BUILD_TYPE -- -j $(nproc) - name: Test working-directory: ${{runner.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index 1597dc3..f2ba953 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ add_library( src/background/Ground.cpp src/background/RoadGenerator.cpp src/background/SurfaceGenerator.cpp + src/Animation.cpp src/Board.cpp src/Controllers/KeyboardController.cpp src/Controllers/DummyController.cpp @@ -41,7 +42,7 @@ add_library( src/Tank/Tank.cpp src/Tank/TankFactory.cpp src/Tank/TankPart.cpp - src/Tank/TankTower.cpp + src/Tank/TankTurret.cpp src/Tank/TankHealthBar.cpp src/TextureStore.cpp src/Random.cpp @@ -72,9 +73,14 @@ find_package( REQUIRED) find_package(range-v3 REQUIRED) find_package(Microsoft.GSL CONFIG REQUIRED) +if (APPLE) + find_package(OpenAL REQUIRED) + target_link_libraries(tank_bot_fight PRIVATE OpenAL::OpenAL) +endif() target_link_libraries(tank_bot_fight_lib PUBLIC sfml-graphics ${EXTRA_LIBS} Microsoft.GSL::GSL) target_link_libraries(tank_bot_fight PRIVATE tank_bot_fight_lib sfml-graphics sfml-audio) + add_subdirectory(test) diff --git a/Readme.md b/Readme.md index 698dc49..d1f6335 100644 --- a/Readme.md +++ b/Readme.md @@ -29,8 +29,6 @@ You have to remember about two things: - Dependencies are installed via vcpkg - - ## Downloading the repo So, before you start, you must first download checkout git-lfs (https://git-lfs.github.com/) diff --git a/res/License.txt b/res/License.txt index 5b4f8fe..f3130cc 100644 --- a/res/License.txt +++ b/res/License.txt @@ -1,21 +1,21 @@ - - - Top-down Tanks Redux - - by Kenney Vleugels (Kenney.nl) - - ------------------------------ - - License (Creative Commons Zero, CC0) - http://creativecommons.org/publicdomain/zero/1.0/ - - You may use these assets in personal and commercial projects. - Credit (Kenney or www.kenney.nl) would be nice but is not mandatory. - - ------------------------------ - - Donate: http://support.kenney.nl - Request: http://request.kenney.nl - - Follow on Twitter for updates: + + + Top-down Tanks Redux + + by Kenney Vleugels (Kenney.nl) + + ------------------------------ + + License (Creative Commons Zero, CC0) + http://creativecommons.org/publicdomain/zero/1.0/ + + You may use these assets in personal and commercial projects. + Credit (Kenney or www.kenney.nl) would be nice but is not mandatory. + + ------------------------------ + + Donate: http://support.kenney.nl + Request: http://request.kenney.nl + + Follow on Twitter for updates: @KenneyNL \ No newline at end of file diff --git a/res/Sounds/explosion.flac b/res/Sounds/explosion.flac new file mode 100644 index 0000000..fdfd4a9 --- /dev/null +++ b/res/Sounds/explosion.flac @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8449f3e379aaba10003f0ce563dff7f99550727e8c01e25a635992832ab19706 +size 278505 diff --git a/src/Animation.cpp b/src/Animation.cpp new file mode 100644 index 0000000..23b2ec0 --- /dev/null +++ b/src/Animation.cpp @@ -0,0 +1,29 @@ +#include "Animation.hpp" + +#include + +Animation::Animation(const std::string& file_name, int frame_count, double animation_time, + sf::Vector2f position, TextureStore& store) + : mPosition(position), mStore(store) { + for (int i = 1; i <= frame_count; ++i) { + mAnimationFiles.push_back(file_name + std::to_string(i) + ".png"); + } + mDeltaTime = animation_time / frame_count; +} +void Animation::draw(sf::RenderWindow& render_window) { + auto elapsed_time = mClock.getElapsedTime(); + + if (elapsed_time.asMilliseconds() > mDeltaTime) { + mClock.restart(); + mCurrentFrame++; + if (mCurrentFrame >= mAnimationFiles.size()) { + mIsDrawingFinished = true; + return; + } + } + sf::Sprite sprite; + sprite.setTexture(mStore.get().get_texture(mAnimationFiles[mCurrentFrame])); + sprite.setPosition(mPosition - sf::Vector2f{sprite.getGlobalBounds().width / 2, + sprite.getGlobalBounds().height / 2}); + render_window.draw(sprite); +} diff --git a/src/Animation.hpp b/src/Animation.hpp new file mode 100644 index 0000000..8dbb181 --- /dev/null +++ b/src/Animation.hpp @@ -0,0 +1,28 @@ +#pragma once +#include +#include +#include + +#include "TextureStore.hpp" + +class Animation { + public: + Animation(const std::string& file_name, int frame_count, double animation_time, + sf::Vector2f position, TextureStore& store); + void draw(sf::RenderWindow& render_window); + bool is_finished() const { return mIsDrawingFinished; } + + Animation(const Animation&) = delete; + Animation& operator=(const Animation&) = delete; + Animation(Animation&&) = default; + Animation& operator=(Animation&&) = default; + + private: + std::vector mAnimationFiles; + int mCurrentFrame = 0; + bool mIsDrawingFinished = false; + double mDeltaTime = 0; + sf::Clock mClock; + sf::Vector2f mPosition; + std::reference_wrapper mStore; +}; diff --git a/src/Board.cpp b/src/Board.cpp index 2cb612a..089cb2f 100644 --- a/src/Board.cpp +++ b/src/Board.cpp @@ -11,17 +11,19 @@ #include "Tank/TankFactory.hpp" #include "TracesHandler.hpp" -Board::Board() : mWindow(sf::VideoMode(WIDTH, HEIGHT), "TankBotFight"), mBackground(mStore) { +Board::Board() + : mWindow(sf::VideoMode(WIDTH, HEIGHT), "TankBotFight"), + mBackground(mStore), + mTankExplodeSound("explosion.flac") { constexpr float TANK_X = WIDTH / 2.0f; constexpr float TANK_Y = 50.f; constexpr float TANK2_X = WIDTH / 2.0f; constexpr float TANK2_Y = 400.0f; - Sound tank_shot_sound("tank_shot.flac"); mWindow.setFramerateLimit(30); mKeyboardPlayer = std::make_unique( - *this, TankFactory::Random(mStore, TANK_X, TANK_Y, tank_shot_sound)); + *this, TankFactory::Random(mStore, TANK_X, TANK_Y, Sound("tank_shot.flac"))); mDummyPlayer = std::make_unique( - *this, TankFactory::Random(mStore, TANK2_X, TANK2_Y, tank_shot_sound)); + *this, TankFactory::Random(mStore, TANK2_X, TANK2_Y, Sound("tank_shot.flac"))); mFont.loadFromFile(files::asset_path() + "DejaVuSans.ttf"); mText.setFont(mFont); } @@ -40,6 +42,9 @@ void Board::draw() { for (auto& missle : mMissles) { missle.draw(mWindow); } + for (auto& animation : mAnimations) { + animation.draw(mWindow); + }; display_speed(); mWindow.display(); } @@ -100,11 +105,16 @@ void Board::update_players() { } player->get_tank().take_damage((*it).get_damage()); if (!player->get_tank().is_alive()) { + mTankExplodeSound.play(); + mAnimations.push_back( + Animation("explosion", 5, 500, player->get_tank().get_position(), mStore)); player.reset(); } missiles_collided.push_back(*it); }; + std::erase_if(mAnimations, [](const auto& animation) { return animation.is_finished(); }); + update_player_if_hit(mKeyboardPlayer); update_player_if_hit(mDummyPlayer); diff --git a/src/Board.hpp b/src/Board.hpp index 3d102db..94d6918 100644 --- a/src/Board.hpp +++ b/src/Board.hpp @@ -3,16 +3,17 @@ #include #include +#include "Animation.hpp" #include "Missle.hpp" #include "Players/DummyPlayer.hpp" #include "Players/KeyboardPlayer.hpp" #include "background/Background.hpp" - class Board { public: Board(); void register_missile(const Missle& missile); + void register_animation(const Animation& animation); void run(); private: @@ -29,4 +30,6 @@ class Board { std::vector mMissles; sf::Font mFont; sf::Text mText; + Sound mTankExplodeSound; + std::vector mAnimations; }; diff --git a/src/Controllers/DummyController.cpp b/src/Controllers/DummyController.cpp index c36ca4d..a055c57 100644 --- a/src/Controllers/DummyController.cpp +++ b/src/Controllers/DummyController.cpp @@ -31,11 +31,11 @@ void DummyController::update() { break; case DummyMove::TurnLeft: mTank.rotate_body(Rotation::Clockwise); - mTank.rotate_tower(Rotation::Clockwise); + mTank.rotate_turret(Rotation::Clockwise); break; case DummyMove::TurnRight: mTank.rotate_body(Rotation::Counterclockwise); - mTank.rotate_tower(Rotation::Counterclockwise); + mTank.rotate_turret(Rotation::Counterclockwise); break; case DummyMove::Idle: mTank.set_gear(Gear::Neutral); diff --git a/src/Controllers/KeyboardController.cpp b/src/Controllers/KeyboardController.cpp index 8d54bdb..e222963 100644 --- a/src/Controllers/KeyboardController.cpp +++ b/src/Controllers/KeyboardController.cpp @@ -12,17 +12,17 @@ void KeyboardController::update(const sf::Event& event) { switch (event.key.code) { case sf::Keyboard::A: mTank.rotate_body(Rotation::Counterclockwise); - mTank.rotate_tower(Rotation::Counterclockwise); + mTank.rotate_turret(Rotation::Counterclockwise); break; case sf::Keyboard::D: mTank.rotate_body(Rotation::Clockwise); - mTank.rotate_tower(Rotation::Clockwise); + mTank.rotate_turret(Rotation::Clockwise); break; case sf::Keyboard::Left: - mTank.rotate_tower(Rotation::Counterclockwise); + mTank.rotate_turret(Rotation::Counterclockwise); break; case sf::Keyboard::Right: - mTank.rotate_tower(Rotation::Clockwise); + mTank.rotate_turret(Rotation::Clockwise); break; case sf::Keyboard::W: mTank.set_gear(Gear::Drive); @@ -44,11 +44,11 @@ void KeyboardController::update(const sf::Event& event) { case sf::Keyboard::A: case sf::Keyboard::D: mTank.rotate_body(Rotation::None); - mTank.rotate_tower(Rotation::None); + mTank.rotate_turret(Rotation::None); break; case sf::Keyboard::Left: case sf::Keyboard::Right: - mTank.rotate_tower(Rotation::None); + mTank.rotate_turret(Rotation::None); break; case sf::Keyboard::W: case sf::Keyboard::S: diff --git a/src/Missle.hpp b/src/Missle.hpp index 68e38c8..7f35170 100644 --- a/src/Missle.hpp +++ b/src/Missle.hpp @@ -2,6 +2,7 @@ #include #include "MovementState.hpp" + class Missle { public: Missle(sf::Texture& texture, const MovementState& state, unsigned int damage); diff --git a/src/Sound.cpp b/src/Sound.cpp index 617ac13..f694682 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -1,23 +1,15 @@ #include "Sound.hpp" -Sound::Sound(const Sound& sound) { - mBuffer = sound.mBuffer; - mSound = sound.mSound; - mSound.setBuffer(mBuffer); -} +#include Sound::Sound(const std::string& file_name) { - if (load_from_file(file_name)) { - mSound.setBuffer(mBuffer); - } else { + std::string path_to_file = files::asset_path() + "Sounds/" + file_name; + if (!mBuffer.loadFromFile(path_to_file)) { throw std::runtime_error("couldn't load sound"); } } -void Sound::play() { mSound.play(); } - -bool Sound::load_from_file(std::string file_name) { - std::string path_to_file = files::asset_path() + "Sounds/" + file_name; - - return mBuffer.loadFromFile(path_to_file); -} +void Sound::play() { + mSound.setBuffer(mBuffer); + mSound.play(); +} \ No newline at end of file diff --git a/src/Sound.hpp b/src/Sound.hpp index df26749..bb088fe 100644 --- a/src/Sound.hpp +++ b/src/Sound.hpp @@ -6,18 +6,16 @@ class Sound { private: - // sound data is not stored directly in sf::Sound, it is stored in sf::SoundBuffer sf::SoundBuffer mBuffer; - - // to play a sound, sf::Sound instance is needed. sf::Sound mSound; public: - // default constructor is needed for testing - Sound() = default; - Sound(const Sound& sound); + Sound(Sound&&) noexcept = default; + Sound& operator=(Sound&&) noexcept = default; + + Sound(const Sound& sound) = delete; + Sound& operator=(const Sound& sound) = delete; - Sound(const std::string& file_name); + explicit Sound(const std::string& file_name); void play(); - bool load_from_file(std::string file_name); }; diff --git a/src/Tank/Tank.cpp b/src/Tank/Tank.cpp index c8c24cd..b243837 100644 --- a/src/Tank/Tank.cpp +++ b/src/Tank/Tank.cpp @@ -9,39 +9,27 @@ constexpr int TANK_INITIAL_ROTATION = 180; Tank::Tank(float x, float y, const TankTextures &textures, std::unique_ptr &&engine, - const Sound &shot_sound, const TracesHandlerConfig &traces_handler_config, + Sound&& shot_sound, const TracesHandlerConfig &traces_handler_config, const std::chrono::milliseconds &shot_cooldown) : mPos({x, y}), mBody(textures.mBody), - mTower(TankTowerTextures{.mTower = textures.mTower, + mTurret(TankTurretTextures{.mTurret = textures.mTurret, .mShotAnimation = textures.mShot, .mMissile = textures.mMissile}, - shot_cooldown, shot_sound), + shot_cooldown, std::move(shot_sound)), mEngine(std::move(engine)), mTracesHandler(std::make_unique(textures.mTracks, mBody.get_sprite(), mPos, traces_handler_config)) { set_rotation(TANK_INITIAL_ROTATION); mBody.get_sprite().setPosition(mPos); - mTower.set_position(mPos); + mTurret.set_position(mPos); } -Tank::Tank(const Tank &rhs) - : mPos(rhs.mPos), - mCurrentSpeed(rhs.mCurrentSpeed), - mBody(rhs.mBody), - mTower(rhs.mTower), - mEngine(rhs.mEngine->copy()), - mTracesHandler(std::make_unique(rhs.mTracesHandler->get_trace_texture(), - mBody.get_sprite(), mPos, - rhs.mTracesHandler->get_config())), - mHealth(rhs.mHealth), - mHealthBar(rhs.mHealthBar) {} - Tank::Tank(Tank &&rhs) noexcept : mPos(rhs.mPos), mCurrentSpeed(rhs.mCurrentSpeed), mBody(std::move(rhs.mBody)), - mTower(std::move(rhs.mTower)), + mTurret(std::move(rhs.mTurret)), mEngine(std::move(rhs.mEngine)), mTracesHandler(std::make_unique(rhs.mTracesHandler->get_trace_texture(), mBody.get_sprite(), mPos, @@ -49,23 +37,6 @@ Tank::Tank(Tank &&rhs) noexcept mHealth(rhs.mHealth), mHealthBar(std::move(rhs.mHealthBar)) {} -Tank &Tank::operator=(const Tank &rhs) { - if (this == &rhs) { - return *this; - } - mPos = rhs.mPos; - mCurrentSpeed = rhs.mCurrentSpeed; - mBody = rhs.mBody; - mTower = rhs.mTower; - mEngine = rhs.mEngine->copy(); - mTracesHandler = - std::make_unique(rhs.mTracesHandler->get_trace_texture(), mBody.get_sprite(), - mPos, rhs.mTracesHandler->get_config()); - mHealth = rhs.mHealth; - mHealthBar = rhs.mHealthBar; - return *this; -} - Tank &Tank::operator=(Tank &&rhs) noexcept { if (this == &rhs) { return *this; @@ -73,7 +44,7 @@ Tank &Tank::operator=(Tank &&rhs) noexcept { mPos = rhs.mPos; mCurrentSpeed = rhs.mCurrentSpeed; mBody = std::move(rhs.mBody); - mTower = std::move(rhs.mTower); + mTurret = std::move(rhs.mTurret); mEngine = std::move(rhs.mEngine); mTracesHandler = std::make_unique(rhs.mTracesHandler->get_trace_texture(), mBody.get_sprite(), @@ -87,10 +58,10 @@ void Tank::set_gear(Gear gear) { mEngine->set_gear(gear); } void Tank::rotate_body(Rotation r) { mBody.rotate(r); } -void Tank::rotate_tower(Rotation r) { mTower.rotate(r); } +void Tank::rotate_turret(Rotation r) { mTurret.rotate(r); } void Tank::set_rotation(const float angle) { - mTower.set_rotation(angle); + mTurret.set_rotation(angle); mBody.set_rotation(angle); } @@ -108,7 +79,7 @@ sf::FloatRect Tank::get_body_rect() const { return mBody.get_sprite().getGlobalB void Tank::update() { mBody.update(); - mTower.update(); + mTurret.update(); mEngine->update(); update_position(); mTracesHandler->update(); @@ -125,21 +96,19 @@ void Tank::update_position() { mPos.y = new_pos.y; } mBody.get_sprite().setPosition(mPos); - mTower.set_position(mPos); + mTurret.set_position(mPos); mHealthBar.set_position(mPos); } -std::optional Tank::shoot() { return mTower.shoot(); } +std::optional Tank::shoot() { return mTurret.shoot(); } float Tank::get_current_speed() const { return mEngine->get_current_speed(); } bool Tank::is_alive() const { return mHealth > 0; } -float Tank::get_tower_rotation() const { return mTower.get_rotation(); } - void Tank::draw(sf::RenderWindow &window) { mBody.draw(window); - mTower.draw(window); + mTurret.draw(window); draw_tracks(window); mHealthBar.draw(window); } diff --git a/src/Tank/Tank.hpp b/src/Tank/Tank.hpp index 4873faf..5af8977 100644 --- a/src/Tank/Tank.hpp +++ b/src/Tank/Tank.hpp @@ -12,14 +12,14 @@ #include "Sound.hpp" #include "Tank/TankHealthBar.hpp" #include "Tank/TankPart.hpp" -#include "Tank/TankTower.hpp" +#include "Tank/TankTurret.hpp" #include "TracesHandler.hpp" constexpr int TANK_HEALTH = 100; struct TankTextures { std::reference_wrapper mBody; - std::reference_wrapper mTower; + std::reference_wrapper mTurret; std::reference_wrapper mShot; std::reference_wrapper mTracks; std::reference_wrapper mMissile; @@ -28,16 +28,16 @@ struct TankTextures { class Tank { public: Tank(float x, float y, const TankTextures& textures, std::unique_ptr&& engine, - const Sound& shot_sound, const TracesHandlerConfig& traces_handler_config = {}, + Sound&& shot_sound, const TracesHandlerConfig& traces_handler_config = {}, const std::chrono::milliseconds& shot_cooldown = std::chrono::milliseconds{500}); - Tank(const Tank& rhs); + Tank(const Tank& rhs) = delete; Tank(Tank&& rhs) noexcept; - Tank& operator=(const Tank& rhs); + Tank& operator=(const Tank& rhs) = delete; Tank& operator=(Tank&& rhs) noexcept; ~Tank() = default; void rotate_body(Rotation r); - void rotate_tower(Rotation r); + void rotate_turret(Rotation r); void set_rotation(float angle); void take_damage(unsigned int damage); @@ -46,7 +46,6 @@ class Tank { void update(); [[nodiscard]] std::optional shoot(); - [[nodiscard]] float get_tower_rotation() const; [[nodiscard]] sf::Vector2f get_position() const; [[nodiscard]] sf::FloatRect get_body_rect() const; [[nodiscard]] float get_current_speed() const; @@ -60,7 +59,7 @@ class Tank { int mHealth{TANK_HEALTH}; TankPart mBody; - TankTower mTower; + TankTurret mTurret; TankHealthBar mHealthBar{TANK_HEALTH}; std::unique_ptr mEngine; std::unique_ptr mTracesHandler; diff --git a/src/Tank/TankFactory.cpp b/src/Tank/TankFactory.cpp index 91086d4..1c844ef 100644 --- a/src/Tank/TankFactory.cpp +++ b/src/Tank/TankFactory.cpp @@ -7,16 +7,16 @@ #include "TextureStore.hpp" std::unique_ptr TankFactory::Random(TextureStore& store, const float x, const float y, - const Sound& shot_sound) { + Sound&& shot_sound) { using namespace std::string_literals; const sf::IntRect TRACKS_TEXTURE_RECT = {0, 0, 37, 48}; auto& body_texture = store.get_texture(one_of("tankBody_red.png"s, "tankBody_dark.png"s, "tankBody_blue.png"s, "tankBody_green.png"s)); body_texture.setSmooth(true); - auto& tower_texture = + auto& turret_texture = store.get_texture(one_of("tankDark_barrel2_outline.png", "tankRed_barrel2_outline.png", "tankGreen_barrel2_outline.png", "tankBlue_barrel2_outline.png")); - tower_texture.setSmooth(true); + turret_texture.setSmooth(true); auto& shot_texture = store.get_texture("shotOrange.png"); shot_texture.setSmooth(true); auto& tracks_texture = store.get_texture("tracksSmall.png", TRACKS_TEXTURE_RECT); @@ -27,12 +27,12 @@ std::unique_ptr TankFactory::Random(TextureStore& store, const float x, co return std::make_unique(x, y, TankTextures{.mBody = body_texture, - .mTower = tower_texture, + .mTurret = turret_texture, .mShot = shot_texture, .mTracks = tracks_texture, .mMissile = missile_texture}, std::make_unique( SquareRootEngineConfig{.mStepCount = 70, .mMaxSpeed = 5.f}), - shot_sound, + std::move(shot_sound), TracesHandlerConfig{.mMaxTraceAge = 50, .mDecayRate = 0.1f}); } diff --git a/src/Tank/TankFactory.hpp b/src/Tank/TankFactory.hpp index e3b7635..91c2f58 100644 --- a/src/Tank/TankFactory.hpp +++ b/src/Tank/TankFactory.hpp @@ -8,5 +8,5 @@ class Sound; class TankFactory { public: [[nodiscard]] static std::unique_ptr Random(TextureStore& store, float x, float y, - const Sound& shot_sound); + Sound&& shot_sound); }; diff --git a/src/Tank/TankTower.cpp b/src/Tank/TankTurret.cpp similarity index 59% rename from src/Tank/TankTower.cpp rename to src/Tank/TankTurret.cpp index cc27301..70e0161 100644 --- a/src/Tank/TankTower.cpp +++ b/src/Tank/TankTurret.cpp @@ -1,4 +1,4 @@ -#include "TankTower.hpp" +#include "TankTurret.hpp" #include @@ -10,53 +10,53 @@ constexpr std::chrono::milliseconds SHOT_ANIMATION_DURATION = std::chrono::milli constexpr auto SHOT_COOLDOWN = std::chrono::milliseconds{500}; constexpr unsigned int MISSLE_DAMAGE = 20; -TankTower::TankTower(const TankTowerTextures& textures, - const std::chrono::milliseconds& shot_cooldown, const Sound& shot_sound) - : mTower(textures.mTower), +TankTurret::TankTurret(const TankTurretTextures& textures, + const std::chrono::milliseconds& shot_cooldown, Sound&& shot_sound) + : mTurret(textures.mTurret), mShotAnimation(textures.mShotAnimation), mMissileTexture(textures.mMissile), - mShotSound(shot_sound), + mShotSound(std::move(shot_sound)), mShotCooldown(shot_cooldown) {} -void TankTower::set_position(const sf::Vector2f& pos) { - mTower.get_sprite().setPosition(pos); +void TankTurret::set_position(const sf::Vector2f& pos) { + mTurret.get_sprite().setPosition(pos); mShotAnimation.get_sprite().setPosition(calculate_shot_position()); } -sf::Vector2f TankTower::calculate_shot_position() const { - const auto tower_rotation = mTower.get_rotation(); - const auto& [x, y] = mTower.get_sprite().getPosition(); +sf::Vector2f TankTurret::calculate_shot_position() const { + const auto turret_rotation = mTurret.get_rotation(); + const auto& [x, y] = mTurret.get_sprite().getPosition(); return sf::Vector2f{ x + SHOT_ANIMATION_DISTANCE * - gsl::narrow_cast(cos(to_radians(tower_rotation - ROTATION_OFFSET))), + gsl::narrow_cast(cos(to_radians(turret_rotation - ROTATION_OFFSET))), y + SHOT_ANIMATION_DISTANCE * - gsl::narrow_cast(sin(to_radians(tower_rotation - ROTATION_OFFSET)))}; + gsl::narrow_cast(sin(to_radians(turret_rotation - ROTATION_OFFSET)))}; } -void TankTower::set_rotation(float angle) { - mTower.set_rotation(angle); +void TankTurret::set_rotation(float angle) { + mTurret.set_rotation(angle); mShotAnimation.set_rotation(angle); } -void TankTower::rotate(Rotation r) { - mTower.rotate(r); +void TankTurret::rotate(Rotation r) { + mTurret.rotate(r); mShotAnimation.rotate(r); } -void TankTower::draw(sf::RenderWindow& window) { - mTower.draw(window); +void TankTurret::draw(sf::RenderWindow& window) { + mTurret.draw(window); if (mDrawShot) { mShotAnimation.draw(window); } } -void TankTower::update() { - mTower.update(); +void TankTurret::update() { + mTurret.update(); mShotAnimation.update(); update_shot_time(); } -void TankTower::update_shot_time() { +void TankTurret::update_shot_time() { auto now = std::chrono::system_clock::now(); auto elapsed = std::chrono::duration_cast(now - mLastShot); if (elapsed > SHOT_ANIMATION_DURATION) { @@ -64,7 +64,7 @@ void TankTower::update_shot_time() { } } -std::optional TankTower::shoot() { +std::optional TankTurret::shoot() { auto now = std::chrono::system_clock::now(); auto elapsed = std::chrono::duration_cast(now - mLastShot); if (elapsed >= mShotCooldown) { @@ -73,10 +73,10 @@ std::optional TankTower::shoot() { mShotSound.play(); const auto& [x, y] = calculate_shot_position(); return std::make_optional( - mMissileTexture, MovementState{.mX = x, .mY = y, .mAngle = mTower.get_rotation()}, + mMissileTexture, MovementState{.mX = x, .mY = y, .mAngle = mTurret.get_rotation()}, MISSLE_DAMAGE); } return std::nullopt; } -float TankTower::get_rotation() const { return mTower.get_rotation(); } +float TankTurret::get_rotation() const { return mTurret.get_rotation(); } diff --git a/src/Tank/TankTower.hpp b/src/Tank/TankTurret.hpp similarity index 78% rename from src/Tank/TankTower.hpp rename to src/Tank/TankTurret.hpp index a10ff09..ba36023 100644 --- a/src/Tank/TankTower.hpp +++ b/src/Tank/TankTurret.hpp @@ -8,16 +8,16 @@ #include "Sound.hpp" #include "Tank/TankPart.hpp" -struct TankTowerTextures { - std::reference_wrapper mTower; +struct TankTurretTextures { + std::reference_wrapper mTurret; std::reference_wrapper mShotAnimation; std::reference_wrapper mMissile; }; -class TankTower { +class TankTurret { public: - TankTower(const TankTowerTextures& textures, const std::chrono::milliseconds& shot_cooldown, - const Sound& shot_sound); + TankTurret(const TankTurretTextures& textures, const std::chrono::milliseconds& shot_cooldown, + Sound&& shot_sound); void set_position(const sf::Vector2f& pos); void set_rotation(float angle); @@ -33,7 +33,7 @@ class TankTower { sf::Vector2f calculate_shot_position() const; void update_shot_time(); - TankPart mTower; + TankPart mTurret; TankPart mShotAnimation; Sound mShotSound; std::reference_wrapper mMissileTexture; diff --git a/src/TextureStore.hpp b/src/TextureStore.hpp index b1a6bdc..ecaa679 100644 --- a/src/TextureStore.hpp +++ b/src/TextureStore.hpp @@ -8,8 +8,8 @@ class TextureStore { TextureStore() = default; TextureStore(TextureStore&) = delete; TextureStore& operator=(TextureStore&) = delete; - TextureStore(TextureStore&&) = delete; - TextureStore& operator=(TextureStore&&) = delete; + TextureStore(TextureStore&&) = default; + TextureStore& operator=(TextureStore&&) = default; ~TextureStore() = default; [[nodiscard]] sf::Texture& get_texture(const std::string& path, diff --git a/src/main.cpp b/src/main.cpp index 7fe506c..00a54e0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,7 +3,6 @@ #include "Board.hpp" int main() { - std::cout << "t245\n"; Board b; b.run(); return 0; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 217b12e..6ab0ce7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -25,7 +25,7 @@ add_executable(run_tests UtilityTests.cpp TracesHandlerTests.cpp TankPartTests.cpp - TankTowerTests.cpp + TankTurretTests.cpp ) target_include_directories(run_tests PRIVATE diff --git a/test/TankTests.cpp b/test/TankTests.cpp index 3fc604c..1bb9a76 100644 --- a/test/TankTests.cpp +++ b/test/TankTests.cpp @@ -21,13 +21,12 @@ struct EngineMock : Engine { struct TankTestData { std::unique_ptr mBody{create_dummy_texture()}; - std::unique_ptr mTower{create_dummy_texture()}; + std::unique_ptr mTurret{create_dummy_texture()}; std::unique_ptr mShot{create_dummy_texture()}; std::unique_ptr mTracks{create_dummy_texture()}; std::unique_ptr mMissile{create_dummy_texture()}; - Sound emptySound; TankTextures mTextures{.mBody = *mBody, - .mTower = *mTower, + .mTurret = *mTurret, .mShot = *mShot, .mTracks = *mTracks, .mMissile = *mMissile}; @@ -38,12 +37,12 @@ struct TankTestData { std::chrono::milliseconds shot_cooldown = std::chrono::milliseconds{500}; unsigned int health = 100; - Tank create_tank(std::unique_ptr>&& engine) { + Tank create_tank(std::unique_ptr>&& engine) const { return {0, 0, mTextures, std::move(engine), - emptySound, + Sound("tank_shot.flac"), TracesHandlerConfig{.mMaxTraceAge = 10, .mDecayRate = 0.1f}, shot_cooldown}; } @@ -52,8 +51,7 @@ struct TankTestData { struct TankTest : TankTestData, ::testing::Test { Tank mTankSUT{create_tank(std::move(mEngine))}; - float mSpeed{1.f}; - int mAngle{90}; + float mAngle{90}; }; TEST_F(TankTest, GivenAngleRotationWhenUpdateThenShouldCallGetPositionDeltaWithAngleRotation) { @@ -83,12 +81,12 @@ TEST_F(TankTest, GivenMultipleUpdatesWhenGetPositionThenReturnsPositionDeltaSum) expect_vec2f_eq(expected_position, mTankSUT.get_position()); } -TEST_F(TankTest, RotateTower_ShouldntAffectMoving) { +TEST_F(TankTest, RotateTurret_ShouldntAffectMoving) { EXPECT_CALL(*mEngineNiceMock, get_position_delta(to_radians(mAngle))); mTankSUT.set_rotation(mAngle); - mTankSUT.rotate_tower(Rotation::Clockwise); - mTankSUT.rotate_tower(Rotation::Clockwise); + mTankSUT.rotate_turret(Rotation::Clockwise); + mTankSUT.rotate_turret(Rotation::Clockwise); mTankSUT.update(); } diff --git a/test/TankTowerTests.cpp b/test/TankTowerTests.cpp deleted file mode 100644 index 79da99d..0000000 --- a/test/TankTowerTests.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -#include - -#include "Sound.hpp" -#include "Tank/TankTower.hpp" -#include "TestUtility.hpp" - -class TankTowerTest : public ::testing::Test { - public: - std::unique_ptr mTowerTex{create_dummy_texture()}; - std::unique_ptr mShotTex{create_dummy_texture()}; - std::unique_ptr mMissileTex{create_dummy_texture()}; - TankTowerTextures mTextures{ - .mTower = *mTowerTex, .mShotAnimation = *mShotTex, .mMissile = *mMissileTex}; - Sound mShotSound{"tank_shot.flac"}; -}; - -TEST_F(TankTowerTest, Given0MsCooldown_WhenShotCalled_ThenMissileIsAlwaysReturned) { - TankTower mTower{mTextures, std::chrono::milliseconds{0}, mShotSound}; - EXPECT_TRUE(mTower.shoot()); - EXPECT_TRUE(mTower.shoot()); - EXPECT_TRUE(mTower.shoot()); -} - -TEST_F(TankTowerTest, GivenNonZeroCooldown_WhenShotCalled_ThenMissileIsNotAlwaysReturned) { - TankTower mTower{mTextures, std::chrono::milliseconds{500}, mShotSound}; - EXPECT_TRUE(mTower.shoot()); - EXPECT_FALSE(mTower.shoot()); - EXPECT_FALSE(mTower.shoot()); -} diff --git a/test/TankTurretTests.cpp b/test/TankTurretTests.cpp new file mode 100644 index 0000000..d746577 --- /dev/null +++ b/test/TankTurretTests.cpp @@ -0,0 +1,30 @@ +#include + +#include + +#include "Sound.hpp" +#include "Tank/TankTurret.hpp" +#include "TestUtility.hpp" + +class TankTurretTest : public ::testing::Test { + public: + std::unique_ptr mTurretTex{create_dummy_texture()}; + std::unique_ptr mShotTex{create_dummy_texture()}; + std::unique_ptr mMissileTex{create_dummy_texture()}; + TankTurretTextures mTextures{ + .mTurret = *mTurretTex, .mShotAnimation = *mShotTex, .mMissile = *mMissileTex}; +}; + +TEST_F(TankTurretTest, Given0MsCooldown_WhenShotCalled_ThenMissileIsAlwaysReturned) { + TankTurret mTurret{mTextures, std::chrono::milliseconds{0}, Sound{"tank_shot.flac"}}; + EXPECT_TRUE(mTurret.shoot()); + EXPECT_TRUE(mTurret.shoot()); + EXPECT_TRUE(mTurret.shoot()); +} + +TEST_F(TankTurretTest, GivenNonZeroCooldown_WhenShotCalled_ThenMissileIsNotAlwaysReturned) { + TankTurret mTurret{mTextures, std::chrono::milliseconds{500}, Sound{"tank_shot.flac"}}; + EXPECT_TRUE(mTurret.shoot()); + EXPECT_FALSE(mTurret.shoot()); + EXPECT_FALSE(mTurret.shoot()); +}