summaryrefslogtreecommitdiff
path: root/Games/Snake
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-27 13:46:31 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-27 13:46:31 +0200
commitd403e564949d896a290c3dbd92b460f2572a8e53 (patch)
tree4d1975387cbaddb6882991dd7b48d14dabb1134a /Games/Snake
parent75a24c3a1fe2c9ff36ca950a0de5b2a15a4db204 (diff)
downloadserenity-d403e564949d896a290c3dbd92b460f2572a8e53.zip
Snake: Use NonnullRefPtrVector.
Diffstat (limited to 'Games/Snake')
-rw-r--r--Games/Snake/SnakeGame.cpp2
-rw-r--r--Games/Snake/SnakeGame.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/Games/Snake/SnakeGame.cpp b/Games/Snake/SnakeGame.cpp
index 251367dace..7229895159 100644
--- a/Games/Snake/SnakeGame.cpp
+++ b/Games/Snake/SnakeGame.cpp
@@ -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);
diff --git a/Games/Snake/SnakeGame.h b/Games/Snake/SnakeGame.h
index 19cb36e722..2c03e2541b 100644
--- a/Games/Snake/SnakeGame.h
+++ b/Games/Snake/SnakeGame.h
@@ -1,6 +1,7 @@
#pragma once
#include <AK/CircularQueue.h>
+#include <AK/NonnullRefPtrVector.h>
#include <LibGUI/GWidget.h>
class SnakeGame : public GWidget {
@@ -59,5 +60,5 @@ private:
unsigned m_high_score { 0 };
String m_high_score_text;
- Vector<NonnullRefPtr<GraphicsBitmap>> m_fruit_bitmaps;
+ NonnullRefPtrVector<GraphicsBitmap> m_fruit_bitmaps;
};