diff --git a/Library/PAX_GRAPHICA/Circle.hpp b/Library/PAX_GRAPHICA/Circle.hpp index 1288c8228..887d8400e 100644 --- a/Library/PAX_GRAPHICA/Circle.hpp +++ b/Library/PAX_GRAPHICA/Circle.hpp @@ -63,9 +63,9 @@ namespace paxg { } #elif defined(PAXS_USING_DXLIB) void draw(const paxg::Color& c_) const { - //DxLib::DrawBox( - // static_cast(x0), static_cast(y0), static_cast(x0 + w0), static_cast(y0 + h0), - // DxLib::GetColor(c_.r, c_.g, c_.b), TRUE); + DxLib::DrawCircle( + static_cast(x), static_cast(y), static_cast(r), + DxLib::GetColor(c_.r, c_.g, c_.b), TRUE); } #elif defined(PAXS_USING_SFML) void draw(const paxg::Color&) const { diff --git a/Library/PAX_GRAPHICA/Key.hpp b/Library/PAX_GRAPHICA/Key.hpp index 0470f48f3..503f773f5 100644 --- a/Library/PAX_GRAPHICA/Key.hpp +++ b/Library/PAX_GRAPHICA/Key.hpp @@ -232,7 +232,7 @@ namespace paxs { private: // 中央の座標を指定 Coordinate center = Coordinate( - paxs::EquirectangularDeg(paxs::Vector2(/*135.0, 35.0*/128, 37)), + paxs::EquirectangularDeg(paxs::Vector2(135, 35)), // 韓国 128, 37 //paxs::Vector2(135.0, getLatitudeToMercatorY(35.0)), 200.0); // マップ座標の中央 double width = 12.0; // マップの幅 diff --git a/Library/PAX_GRAPHICA/Window.hpp b/Library/PAX_GRAPHICA/Window.hpp index 485aa13cb..b030c13b4 100644 --- a/Library/PAX_GRAPHICA/Window.hpp +++ b/Library/PAX_GRAPHICA/Window.hpp @@ -138,7 +138,7 @@ namespace paxg { // Linux 専用処理 #else // その他の処理 (Windows) - DxLib::GetWindowSize(&width, &height); + DxLib::GetDrawScreenSize(&width, &height); // DxLib::GetWindowSize(&width, &height); #endif return Vec2i{ static_cast(width / 2) ,static_cast(height / 2) }; @@ -168,7 +168,7 @@ namespace paxg { // Linux 専用処理 #else // その他の処理 (Windows) - DxLib::GetWindowSize(&width, &height); + DxLib::GetDrawScreenSize(&width, &height); // DxLib::GetWindowSize(&width, &height); #endif return static_cast(width); @@ -197,7 +197,7 @@ namespace paxg { // Linux 専用処理 #else // その他の処理 (Windows) - DxLib::GetWindowSize(&width, &height); + DxLib::GetDrawScreenSize(&width, &height); // DxLib::GetWindowSize(&width, &height); #endif return static_cast(height); @@ -226,7 +226,7 @@ namespace paxg { // Linux 専用処理 #else // その他の処理 (Windows) - DxLib::GetWindowSize(&width, &height); + DxLib::GetDrawScreenSize(&width, &height); // DxLib::GetWindowSize(&width, &height); #endif return Vec2i{ static_cast(width) ,static_cast(height) }; diff --git a/Library/PAX_MAHOROBA/Calendar.hpp b/Library/PAX_MAHOROBA/Calendar.hpp index ce4655983..5057046fb 100644 --- a/Library/PAX_MAHOROBA/Calendar.hpp +++ b/Library/PAX_MAHOROBA/Calendar.hpp @@ -83,7 +83,7 @@ namespace paxs { bool move_forward_in_time = true; // デバッグ false; // 時間を進めるか bool go_back_in_time = false; // 時間を戻すか - bool is_agent_update = true; // エージェントの更新をするか + bool is_agent_update = false; // エージェントの更新をするか public: /*########################################################################################## @@ -184,23 +184,22 @@ namespace paxs { // 時間を進めている場合(逆行していない場合) if (move_forward_in_time) { if (jdn.cgetDay() != (std::numeric_limits::max)()) { - jdn += 365.2425;//(0.8 / 30.0); //(365.2425 / 12.0);//1.0;// ユリウス日を繰り上げ(次の日にする) + jdn += (365.2425 / 12.0);//365.2425;//(0.8 / 30.0); //1.0;// ユリウス日を繰り上げ(次の日にする) calcDate(); // 日付計算 } //jdn += 365; // ユリウス日を繰り上げ(次の日にする) -#ifdef PAXS_USING_SIMULATOR - // エージェント機能テスト + // + // エージェント機能 if (is_agent_update && simulator.get() != nullptr) { simulator->step(); // シミュレーションを 1 ステップ実行する steps.getDay()++; // ステップ数を増やす return_bool = true; } -#endif } // 時間を逆行している場合 else if (go_back_in_time) { if (jdn.cgetDay() != (std::numeric_limits::max)()) { - jdn -= 365.24252;//(0.8 / 30.0); //(365.2425 / 12.0);//1.0;// ユリウス日を繰り上げ(次の日にする) + jdn -= (365.2425 / 12.0);//365.24252;//(0.8 / 30.0); //1.0;// ユリウス日を繰り上げ(次の日にする) calcDate(); // 日付計算 } } diff --git a/Library/PAX_MAHOROBA/MapViewer.hpp b/Library/PAX_MAHOROBA/MapViewer.hpp index b12e555bf..2fb630f67 100644 --- a/Library/PAX_MAHOROBA/MapViewer.hpp +++ b/Library/PAX_MAHOROBA/MapViewer.hpp @@ -95,11 +95,8 @@ namespace paxs { const SelectLanguage& select_language, const paxs::KoyomiSiv3D& koyomi_siv, paxs::StringViewerSiv3D& string_siv, - std::unique_ptr>& simulator, // コンパイル時の分岐により使わない場合あり -#ifndef PAXS_USING_SIMULATOR - [[maybe_unused]] -#endif - const paxs::Vector2& start_position, // コンパイル時の分岐により使わない場合あり + std::unique_ptr>& simulator, + const paxs::Vector2& start_position, paxs::GraphicVisualizationList& visible, std::size_t& pop_num, // 人口数 std::size_t& sat_num // 集落数 @@ -110,14 +107,12 @@ namespace paxs { // 地図上に画像を描画する texture_location->update(map_view->getCenterX(), map_view->getCenterY(), map_view->getWidth(), map_view->getHeight()); -#ifdef PAXS_USING_SIMULATOR if (agent_location.get() != nullptr && simulator.get() != nullptr) { agent_location->draw(koyomi_siv.jdn.cgetDay(), simulator->getSettlementGrids(), start_position, map_view->getWidth(), map_view->getHeight(), map_view->getCenterX(), map_view->getCenterY(), pop_num, sat_num ); } -#endif #ifdef PAXS_USING_SIV3D //// 線の描画 diff --git a/Library/PAX_MAHOROBA/StringViewer.hpp b/Library/PAX_MAHOROBA/StringViewer.hpp index 693fe8cee..d84f4eeb9 100644 --- a/Library/PAX_MAHOROBA/StringViewer.hpp +++ b/Library/PAX_MAHOROBA/StringViewer.hpp @@ -196,6 +196,13 @@ MurMur3::calcHash("en-US"), MurMur3::calcHash("ja-JP"), MurMur3::calcHash("zh-TW texture_dictionary.emplace(MurMur3::calcHash("texture_stop"), paxg::Texture{ path + "Data/MenuIcon/stop.svg" }); texture_dictionary.emplace(MurMur3::calcHash("texture_playback"), paxg::Texture{ path + "Data/MenuIcon/playback.svg" }); texture_dictionary.emplace(MurMur3::calcHash("texture_reverse_playback"), paxg::Texture{ path + "Data/MenuIcon/reverse-playback.svg" }); + texture_dictionary.emplace(MurMur3::calcHash("texture_1step"), paxg::Texture{ path + "Data/MenuIcon/1Step.svg" }); + texture_dictionary.emplace(MurMur3::calcHash("texture_delete_agent_data"), paxg::Texture{ path + "Data/MenuIcon/DeleteAgentData.svg" }); + texture_dictionary.emplace(MurMur3::calcHash("texture_delete_geographic_data"), paxg::Texture{ path + "Data/MenuIcon/DeleteGeographicData.svg" }); + texture_dictionary.emplace(MurMur3::calcHash("texture_load_agent_data"), paxg::Texture{ path + "Data/MenuIcon/LoadAgentData.svg" }); + texture_dictionary.emplace(MurMur3::calcHash("texture_load_agent_data2"), paxg::Texture{ path + "Data/MenuIcon/LoadAgentData2.svg" }); + texture_dictionary.emplace(MurMur3::calcHash("texture_load_geographic_data"), paxg::Texture{ path + "Data/MenuIcon/LoadGeographicData.svg" }); + texture_dictionary.emplace(MurMur3::calcHash("texture_load_geographic_data2"), paxg::Texture{ path + "Data/MenuIcon/LoadGeographicData2.svg" }); } //koyomi_font = setFont(koyomi_font_size, path8, 2); @@ -223,18 +230,9 @@ MurMur3::calcHash("en-US"), MurMur3::calcHash("ja-JP"), MurMur3::calcHash("zh-TW const paxs::Language& language_text, std::unique_ptr>& simulator, // コンパイル時の分岐により使わない場合あり std::unique_ptr>& old_simulator, // コンパイル時の分岐により使わない場合あり -#ifndef PAXS_USING_SIMULATOR - [[maybe_unused]] -#endif - const paxs::Vector2& start_position, // コンパイル時の分岐により使わない場合あり -#ifndef PAXS_USING_SIMULATOR - [[maybe_unused]] -#endif - const paxs::Vector2& end_position, // コンパイル時の分岐により使わない場合あり -#ifndef PAXS_USING_SIMULATOR - [[maybe_unused]] -#endif - const std::string& path8, // コンパイル時の分岐により使わない場合あり + const paxs::Vector2& start_position, + const paxs::Vector2& end_position, + const std::string& path8, paxs::TouchManager& tm_, paxs::KoyomiSiv3D& koyomi_siv, paxs::GraphicVisualizationList& visible, @@ -264,17 +262,7 @@ MurMur3::calcHash("en-US"), MurMur3::calcHash("ja-JP"), MurMur3::calcHash("zh-TW const int arrow_time_icon_size = 24; // 時間操作アイコンの大きさ const int time_icon_size = 40; // 時間操作アイコンの大きさ int icon_const_start_x = 360; -#ifdef PAXS_USING_DXLIB -#ifndef __ANDROID__ - const int dx_move_x = 400; // 描画ライブラリごとに位置の調整 -#else - const int dx_move_x = 0; // 描画ライブラリごとに位置の調整 -#endif - koyomi_font_x -= dx_move_x; - koyomi_font_en_x -= dx_move_x; - rect_start_x -= dx_move_x; - icon_const_start_x += dx_move_x; -#endif // PAXS_USING_DXLIB + int icon_start_x = icon_const_start_x; int sum_icon_height = arrow_time_icon_size + time_icon_size * 2; @@ -723,8 +711,10 @@ MurMur3::calcHash("en-US"), MurMur3::calcHash("ja-JP"), MurMur3::calcHash("zh-TW // simulator = old_simulator; //} - if (s3d::SimpleGUI::Button(U"Init", s3d::Vec2{ 10, 60 })) { - + texture_dictionary.at(MurMur3::calcHash("texture_load_geographic_data2")).resizedDraw( + time_icon_size, paxg::Vec2i(paxg::Window::width() - 360, 400)); + if (tm_.get(paxg::Rect{ paxg::Vec2i(paxg::Window::width() - 360, 400), paxg::Vec2i(time_icon_size, time_icon_size) }.leftClicked())) { + // if (s3d::SimpleGUI::Button(U"Sim Init (CUI)", s3d::Vec2{ 10, 60 })) { const std::string map_list_path = path8 + "Data/Simulation/MapList.tsv"; const std::string japan_provinces_path = path8 + "Data/Simulation/Japan200-725"; paxs::Vector2 init_start_position(861, 381); @@ -743,12 +733,33 @@ MurMur3::calcHash("en-US"), MurMur3::calcHash("ja-JP"), MurMur3::calcHash("zh-TW //simulator_.init(); koyomi_siv.steps.setDay(0); // ステップ数を 0 にする koyomi_siv.is_agent_update = false; + + koyomi_siv.move_forward_in_time = false; // 一時停止 + koyomi_siv.go_back_in_time = false; } - if (s3d::SimpleGUI::Button(U"Start", s3d::Vec2{ 110, 60 })) { - koyomi_siv.is_agent_update = true; + if (!koyomi_siv.is_agent_update) { + // シミュレーションを再生 + texture_dictionary.at(MurMur3::calcHash("texture_playback")).resizedDraw( + time_icon_size, paxg::Vec2i(paxg::Window::width() - 300, 400)); + if (tm_.get(paxg::Rect{ paxg::Vec2i(paxg::Window::width() - 300, 400), paxg::Vec2i(time_icon_size, time_icon_size) }.leftClicked())) { + // if (s3d::SimpleGUI::Button(U"Sim Start", s3d::Vec2{ 190, 60 })) { + koyomi_siv.is_agent_update = true; + + koyomi_siv.move_forward_in_time = true; // 再生 + koyomi_siv.go_back_in_time = false; + } } - if (s3d::SimpleGUI::Button(U"Stop", s3d::Vec2{ 210, 60 })) { - koyomi_siv.is_agent_update = false; + else { + // シミュレーションを停止 + texture_dictionary.at(MurMur3::calcHash("texture_stop")).resizedDraw( + time_icon_size, paxg::Vec2i(paxg::Window::width() - 300, 400)); + if (tm_.get(paxg::Rect{ paxg::Vec2i(paxg::Window::width() - 300, 400), paxg::Vec2i(time_icon_size, time_icon_size) }.leftClicked())) { + // if (s3d::SimpleGUI::Button(U"Sim Stop", s3d::Vec2{ 330, 60 })) { + koyomi_siv.is_agent_update = false; + + koyomi_siv.move_forward_in_time = false; // 一時停止 + koyomi_siv.go_back_in_time = false; + } } //if (koyomi_siv.is_agent_update && simulator.get() != nullptr) { // simulator->run(1); diff --git a/Library/PAX_SAPIENTICA/RandomSelector.hpp b/Library/PAX_SAPIENTICA/RandomSelector.hpp index f60111eba..c2c5192e4 100644 --- a/Library/PAX_SAPIENTICA/RandomSelector.hpp +++ b/Library/PAX_SAPIENTICA/RandomSelector.hpp @@ -1,4 +1,4 @@ -/*########################################################################################## +/*########################################################################################## PAX SAPIENTICA Library 💀🌿🌏 @@ -62,7 +62,7 @@ namespace paxs { /// @param num_elements_2 The number of elements to select from the second vector. /// @return A vector of selected elements. std::vector> select(const std::size_t num_elements_1, const std::size_t num_elements_2) { - const std::size_t num_elements = std::min(num_elements_1, num_elements_2); + const std::size_t num_elements = (std::min)(num_elements_1, num_elements_2); std::vector> result; std::unordered_set used_indices_1; diff --git a/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp b/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp index 150cafde3..023caba60 100644 --- a/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp @@ -435,7 +435,7 @@ namespace paxs { const std::uint_least32_t set_lifespan = kanakuma_life_span.setAdultLifeSpan(set_gender, *gen); std::uniform_int_distribution<> lifespan_dist{ - std::min(18 * steps_per_year + 1, static_cast(set_lifespan - 1)), + (std::min)(18 * steps_per_year + 1, static_cast(set_lifespan - 1)), static_cast(set_lifespan - 1) }; // 性別の乱数分布 agents.emplace_back(Agent( diff --git a/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp b/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp index fc4193968..97bf05851 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp @@ -368,7 +368,7 @@ namespace paxs { // 配置する集落の人口を決定 paxs::Ryoseikoku ryoseikoku = japan_provinces->cgetRyoseikoku(ryoseikoku_id); int settlement_population = std::uniform_int_distribution<>(ryoseikoku.settlement_population_min_ad200, ryoseikoku.settlement_population_max_ad200)(gen); - settlement_population = std::min(settlement_population, static_cast(ryoseikoku_population_it->second)); + settlement_population = (std::min)(settlement_population, static_cast(ryoseikoku_population_it->second)); // 集落をグリッドに配置 Vector2 grid_position = live_position / grid_length; diff --git a/Library/PAX_SAPIENTICA/UniqueIdentification.hpp b/Library/PAX_SAPIENTICA/UniqueIdentification.hpp index 36378ea2b..d492cc4d7 100644 --- a/Library/PAX_SAPIENTICA/UniqueIdentification.hpp +++ b/Library/PAX_SAPIENTICA/UniqueIdentification.hpp @@ -30,7 +30,7 @@ namespace paxs { /// @brief Generate a unique id. /// @brief ユニークなIDを生成する。 static IdType generate() { - if (counter == std::numeric_limits::max()) { + if (counter == (std::numeric_limits::max)()) { PAXS_WARNING("The counter has reached the maximum value. Resetting the counter."); reset(); }