ゲーム作りは楽しい

なんか書く

2024-01-01から1年間の記事一覧

【Git】コンフリクトしたら conflict 歌いたかった

はじめに git merge で コンフリクトしたら conflict歌いたくないですか? 色々調べているのですが、たぶんコンフリクトにフックする方法はないので 仕方ないから、コンフリクト後のコミット時にフックで妥協します。 ↑いい方法があったら教えてください。 G…

【C++】コンパイル時 1+1は?みそスープ

1+1がみそスープであることは、コンパイル時にも計算できます。 #include <string_view> consteval bool operator ==(int i , std::string_view str) { return i == 2 && str == "みそスープ"; } consteval bool operator !=(int i , std::string_view str) { return !(i </string_view>…

呼ばれるたびにGet Wildが流れ出すゲッター

こんなゲッターは嫌だ // 男 class Man { public: Man(float height, float weight, int32 wild) : m_height(height) , m_weight(weight) , m_wild(wild) {} // 身長取得 [[nodiscard]] float getHeight() const { return m_height; } // 体重取得 [[nodisca…

ジョンネイピアに感謝しながら相乗平均を計算した

ちょっと相乗平均(幾何平均)を求める必要があったのだが 最初は脳死で定義通りのプログラムを書いた ※例のコードでは空配列の考慮は省略 template<class R> double GeometricMean(const R& ar) { double product = 1; for (const auto& v : ar) { product *= v; } ret</class>…

どっかでみたようなローディングのサークル

# include <Siv3D.hpp> void Main() { Window::Resize({ 300, 300 }); const Vec2 center = Scene::CenterF(); while (System::Update()) { constexpr Duration periodSec = 2s; const double rotateRate = s3d::Periodic::Sawtooth0_1(periodSec * 0.75); const double</siv3d.hpp>…