Skip to content

Commit

Permalink
Snake: Use NonnullRefPtrVector.
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Jun 27, 2019
1 parent 75a24c3 commit d403e56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Games/Snake/SnakeGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void SnakeGame::paint_event(GPaintEvent& event)
painter.fill_rect(bottom_side, Color::from_rgb(0x888800));
}

painter.draw_scaled_bitmap(cell_rect(m_fruit), *m_fruit_bitmaps[m_fruit_type], m_fruit_bitmaps[m_fruit_type]->rect());
painter.draw_scaled_bitmap(cell_rect(m_fruit), m_fruit_bitmaps[m_fruit_type], m_fruit_bitmaps[m_fruit_type].rect());

painter.draw_text(high_score_rect(), m_high_score_text, TextAlignment::TopLeft, Color::from_rgb(0xfafae0));
painter.draw_text(score_rect(), m_score_text, TextAlignment::TopLeft, Color::White);
Expand Down
3 changes: 2 additions & 1 deletion Games/Snake/SnakeGame.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <AK/CircularQueue.h>
#include <AK/NonnullRefPtrVector.h>
#include <LibGUI/GWidget.h>

class SnakeGame : public GWidget {
Expand Down Expand Up @@ -59,5 +60,5 @@ class SnakeGame : public GWidget {
unsigned m_high_score { 0 };
String m_high_score_text;

Vector<NonnullRefPtr<GraphicsBitmap>> m_fruit_bitmaps;
NonnullRefPtrVector<GraphicsBitmap> m_fruit_bitmaps;
};

0 comments on commit d403e56

Please sign in to comment.