Skip to content

Commit

Permalink
Remove dead code.
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Sep 12, 2024
1 parent 1e81bf0 commit a895619
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 42 deletions.
2 changes: 0 additions & 2 deletions src/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class Menu final
std::pair<unsigned int, unsigned int> mousePosition, InputAction action,
unsigned int currentItem) const;

bool itemPicked(const ALLEGRO_EVENT& event) const;

void redraw(unsigned int currentItem);

unsigned int getLocationOfFirstItem() const;
Expand Down
2 changes: 0 additions & 2 deletions src/PointUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace PointUtils
{
Point pointFromSigned(int x, int y);

bool isValidPoint(int x, int y);

bool isValidPoint(int x, int y, unsigned int objectSize);

bool isValidPoint(Point point);
Expand Down
15 changes: 0 additions & 15 deletions src/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@ void Screen::drawBackground(ResourceType resourceType) const
static_cast<float>(getHeight()), 0);
}

void Screen::drawBitmap(ResourceType resourceType, unsigned int x,
unsigned int y) const
{
ALLEGRO_BITMAP* bitmapToUse{resources_.getBitmap(resourceType)};
al_draw_bitmap(bitmapToUse, static_cast<float>(x), static_cast<float>(y),
0);
}

void Screen::drawScaledSquareBitmap(ResourceType resourceType, unsigned int x,
unsigned int y, unsigned int size) const
{
Expand Down Expand Up @@ -149,11 +141,6 @@ unsigned int Screen::getWidth() const { return width_; }

unsigned int Screen::getHeight() const { return height_; }

std::pair<unsigned int, unsigned int> Screen::getCenter() const
{
return {width_ / 2, height_ / 2};
}

unsigned int Screen::getCenterX() const { return width_ / 2; }

unsigned int Screen::getCenterY() const { return height_ / 2; }
Expand Down Expand Up @@ -189,5 +176,3 @@ void Screen::useWindowedMode()
false);
updateSize();
}

const Resources& Screen::getResources() const { return resources_; }
15 changes: 4 additions & 11 deletions src/Screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct ALLEGRO_FONT;
struct ALLEGRO_BITMAP;
struct ALLEGRO_COLOR;

class Screen final
class Screen
{
public:
explicit Screen(Resources resources);
Expand All @@ -29,9 +29,6 @@ class Screen final

void drawBackground(ResourceType resourceType) const;

void drawBitmap(ResourceType resourceType, unsigned int x,
unsigned int y) const;

void drawScaledSquareBitmap(ResourceType resourceType, unsigned int x,
unsigned int y, unsigned int size) const;

Expand All @@ -53,27 +50,23 @@ class Screen final

unsigned int getBitmapHeight(ResourceType resourceType) const;

static void refresh() ;
static void refresh();

static void showMouse() ;
static void showMouse();

static void hideMouse() ;
static void hideMouse();

void useFullScreenMode();

void useWindowedMode();

const Resources& getResources() const;

unsigned int getWidth() const;

unsigned int getHeight() const;

private:
void updateSize();

std::pair<unsigned int, unsigned int> getCenter() const;

Resources resources_;

unsigned int width_;
Expand Down
2 changes: 0 additions & 2 deletions src/Tank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ bool Tank::isWithin(Point point) const
point.y >= getY() && point.y < getY() + tileSize;
}

void Tank::resetFire() { lastFire_ = TimePoint(); }

void Tank::move(Point point)
{
setX(point.x);
Expand Down
1 change: 0 additions & 1 deletion src/Tank.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class Tank : public Drawable
using TimePoint = std::chrono::time_point<std::chrono::system_clock>;
Bullet fire(TimePoint currentTime);
bool canFire(TimePoint currentTime) const;
void resetFire();

bool hit(unsigned int power);
void move(Point point);
Expand Down
9 changes: 0 additions & 9 deletions test/TankTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,6 @@ TEST_CASE("firing", "[tank]")
tank.fire(firstFireTime);
REQUIRE(tank.canFire(firstFireTime + delay) == true);
}

SECTION("reset fire")
{
Tank tank(TankType::PLAYER_TIER_1, point);
const TimePoint firstFireTime{TimePoint() + delay};
tank.fire(firstFireTime);
tank.resetFire();
REQUIRE(tank.canFire(firstFireTime + delay / 2) == true);
}
}

TEST_CASE("power-ups", "[tank]")
Expand Down

0 comments on commit a895619

Please sign in to comment.