mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:27:45 +00:00
LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
This commit is contained in:
parent
f0409081f5
commit
c7d891765c
131 changed files with 422 additions and 421 deletions
|
@ -43,8 +43,8 @@ private:
|
|||
const float x { 50 };
|
||||
const float radius { 16 };
|
||||
const float starting_y { 200 };
|
||||
const RefPtr<Gfx::Bitmap> falling_bitmap { Gfx::Bitmap::load_from_file("/res/icons/flappybug/falling.png") };
|
||||
const RefPtr<Gfx::Bitmap> flapping_bitmap { Gfx::Bitmap::load_from_file("/res/icons/flappybug/flapping.png") };
|
||||
const RefPtr<Gfx::Bitmap> falling_bitmap { Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/falling.png") };
|
||||
const RefPtr<Gfx::Bitmap> flapping_bitmap { Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/flapping.png") };
|
||||
float y {};
|
||||
float velocity {};
|
||||
|
||||
|
@ -107,9 +107,9 @@ private:
|
|||
|
||||
struct Cloud {
|
||||
const Vector<RefPtr<Gfx::Bitmap>> cloud_bitmaps {
|
||||
Gfx::Bitmap::load_from_file("/res/icons/flappybug/cloud_0.png"),
|
||||
Gfx::Bitmap::load_from_file("/res/icons/flappybug/cloud_1.png"),
|
||||
Gfx::Bitmap::load_from_file("/res/icons/flappybug/cloud_2.png"),
|
||||
Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/cloud_0.png"),
|
||||
Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/cloud_1.png"),
|
||||
Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/cloud_2.png"),
|
||||
};
|
||||
float x {};
|
||||
float y {};
|
||||
|
@ -147,7 +147,7 @@ private:
|
|||
float m_last_score {};
|
||||
float m_difficulty {};
|
||||
float m_restart_cooldown {};
|
||||
const RefPtr<Gfx::Bitmap> m_background_bitmap { Gfx::Bitmap::load_from_file("/res/icons/flappybug/background.png") };
|
||||
const RefPtr<Gfx::Bitmap> m_background_bitmap { Gfx::Bitmap::try_load_from_file("/res/icons/flappybug/background.png") };
|
||||
const Gfx::IntRect m_score_rect { 10, 10, 20, 20 };
|
||||
const Gfx::IntRect m_text_rect { game_width / 2 - 80, game_height / 2 - 40, 160, 80 };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue