Snake: Use NonnullRefPtrVector.
This commit is contained in:
parent
75a24c3a1f
commit
d403e56494
Notes:
sideshowbarker
2024-07-19 13:28:20 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d403e564949
2 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue