diff --git a/Library/PAX_SAPIENTICA/Calendar/Calendars.hpp b/Library/PAX_SAPIENTICA/Calendar/Calendars.hpp new file mode 100644 index 000000000..cc3fb2df5 --- /dev/null +++ b/Library/PAX_SAPIENTICA/Calendar/Calendars.hpp @@ -0,0 +1,57 @@ +/*########################################################################################## + + PAX SAPIENTICA Library 💀🌿🌏 + + [Planning] 2023 As Project + [Production] 2023 As Project + [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA + [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ + +##########################################################################################*/ + +#ifndef PAX_SAPIENTICA_CALENDAR_CALENDARS_HPP +#define PAX_SAPIENTICA_CALENDAR_CALENDARS_HPP + +/*########################################################################################## + Define a structure that handles the year, month, and day. + 年月日を扱う構造体を定義する。 +##########################################################################################*/ + +// TODO:改修必須 + +#include +#include + +#include +#include + +namespace paxs::cal { + + // 暦 + using Calendars = std::variant< + JDN_S32 // ユリウス通日 (S32) + , JDN_S64 // ユリウス通日 (S64) + , JDN_F64 // ユリウス通日 (F64) + , JulianDate // ユリウス暦 + , GregorianDate // グレゴリオ暦 + , IslamicDate // ヒジュラ暦 + , JapanDate // 和暦 + , CalBP // 較正年代 + , SimulationSteps// シミュレーションのステップ数 + >; + + enum CalendarsType : std::size_t { + jdn_s32_type // ユリウス通日 (S32) + , jdn_s64_type // ユリウス通日 (S64) + , jdn_f64_type // ユリウス通日 (F64) + , julian_date_type // ユリウス暦 + , gregorian_date_type// グレゴリオ暦 + , islamic_date_type // ヒジュラ暦 + , japan_date_type // 和暦 + , calbp_type // 較正年代 + , simulation_steps_type// シミュレーションのステップ数 + }; + +} + +#endif // !PAX_SAPIENTICA_CALENDAR_CALENDARS_HPP \ No newline at end of file diff --git a/Library/PAX_SAPIENTICA/Calendar/Date.hpp b/Library/PAX_SAPIENTICA/Calendar/Date.hpp index 36827d954..200126573 100644 --- a/Library/PAX_SAPIENTICA/Calendar/Date.hpp +++ b/Library/PAX_SAPIENTICA/Calendar/Date.hpp @@ -13,38 +13,193 @@ #define PAX_SAPIENTICA_CALENDAR_DATE_HPP /*########################################################################################## - 日付の構造体 + Define a structure that handles the year, month, and day. + 年月日を扱う構造体を定義する。 ##########################################################################################*/ -namespace paxs { +// TODO:改修必須 - // 名年月日の暦 - // 例:和暦、中国暦 - template - struct Date3N { - N name{}; - Y year{}; - M month{}; - D day{}; +#include + +namespace paxs::cal { + + // 暦の出力形式 + enum class DateOutputType { + name_and_ymd // 暦名 & 年月日(例:グレゴリオ暦1年1月1日) + ,name_and_value // 暦名 & 値 }; - // 年月日の暦 - // 例:グレゴリオ暦、ユリウス暦 - template - struct Date3 { - Y year{}; - M month{}; - D day{}; + using DateGengo = std::int_least32_t; + using DateYear = std::int_least32_t; + using DateMonth = std::uint_least8_t; + using DateDay = std::uint_least8_t; + // シミュレーションのステップ数 + class SimulationSteps { + private: + std::uint_least32_t day{ 0 }; + public: + SimulationSteps() = default; + SimulationSteps(const std::uint_least32_t day_) + :day(day_) {} + constexpr void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) + constexpr void setYear(const DateYear) const {} // 何もしない( Variant に用いているため定義) + constexpr void setMonth(const DateMonth) const {} // 何もしない( Variant に用いているため定義) + constexpr void setDay(const std::int_least32_t day_) { day = day_; } + constexpr void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) + constexpr DateGengo getGengo() const { return 0; } + constexpr DateYear getYear() const { return 0; } + constexpr DateMonth getMonth() const { return 0; } + constexpr std::uint_least32_t& getDay() { return day; } + constexpr DateGengo cgetGengo() const { return 0; } + constexpr DateYear cgetYear() const { return 0; } + constexpr DateMonth cgetMonth() const { return 0; } + constexpr std::uint_least32_t cgetDay() const { return day; } + constexpr static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) + constexpr static DateOutputType getDateOutputType() { return DateOutputType::name_and_value; } // 暦名&年月日形式( Variant に用いているため定義) + }; + // 較正年代 + class CalBP { + private: + std::int_least32_t day{}; + public: + CalBP() = default; + CalBP(const std::int_least32_t day_) + :day(day_) {} + constexpr void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) + constexpr void setYear(const DateYear) const {} // 何もしない( Variant に用いているため定義) + constexpr void setMonth(const DateMonth) const {} // 何もしない( Variant に用いているため定義) + constexpr void setDay(const std::int_least32_t day_) { day = day_; } + constexpr void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) + constexpr DateGengo getGengo() const { return 0; } + constexpr DateYear getYear() const { return 0; } + constexpr DateMonth getMonth() const { return 0; } + constexpr std::int_least32_t& getDay() { return day; } + constexpr DateGengo cgetGengo() const { return 0; } + constexpr DateYear cgetYear() const { return 0; } + constexpr DateMonth cgetMonth() const { return 0; } + constexpr std::int_least32_t cgetDay() const { return day; } + constexpr static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) + constexpr static DateOutputType getDateOutputType() { return DateOutputType::name_and_value; } // 暦名&年月日形式( Variant に用いているため定義) }; - // 日の暦 - // 例:グレゴリオ暦、ユリウス暦 - template - struct Date1 { - D day{}; + // 年月日 + class IslamicDate { + private: + DateYear year{}; + DateMonth month{}; + DateDay day{}; + public: + // ヒジュラ暦の日付から絶対年代(日付)を計算 + constexpr operator int() const { + return (day + 29 * (month - 1) + month / 2 + + 354 * (year - 1) // 前年の閏日以外の日 + + (3 + (11 * year)) / 30 // 前年の閏日 + + 227014); // カレンダーの開始日の前日 + } + + IslamicDate() = default; + IslamicDate(const DateYear year_, const DateMonth month_, const DateDay day_) + :year(year_), month(month_), day(day_) {} + constexpr void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) + constexpr void setYear(const DateYear year_) { year = year_; } + constexpr void setMonth(const DateMonth month_) { month = month_; } + constexpr void setDay(const DateDay day_) { day = day_; } + constexpr void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) + constexpr DateGengo getGengo() const { return 0; } + constexpr DateYear& getYear() { return year; } + constexpr DateMonth& getMonth() { return month; } + constexpr DateDay& getDay() { return day; } + constexpr DateGengo cgetGengo() const { return 0; } + constexpr DateYear cgetYear() const { return year; } + constexpr DateMonth cgetMonth() const { return month; } + constexpr DateDay cgetDay() const { return day; } + constexpr static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) + constexpr static DateOutputType getDateOutputType() { return DateOutputType::name_and_ymd; } // 暦名&年月日形式( Variant に用いているため定義) }; + // 年月日 + class GregorianDate { + private: + DateYear year{}; + DateMonth month{}; + DateDay day{}; + public: + GregorianDate() = default; + GregorianDate(const DateYear year_, const DateMonth month_, const DateDay day_) + :year(year_), month(month_), day(day_) {} + constexpr void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) + constexpr void setYear(const DateYear year_) { year = year_; } + constexpr void setMonth(const DateMonth month_) { month = month_; } + constexpr void setDay(const DateDay day_) { day = day_; } + constexpr void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) + constexpr DateGengo getGengo() const { return 0; } + constexpr DateYear& getYear() { return year; } + constexpr DateMonth& getMonth() { return month; } + constexpr DateDay& getDay() { return day; } + constexpr DateGengo cgetGengo() const { return 0; } + constexpr DateYear cgetYear() const { return year; } + constexpr DateMonth cgetMonth() const { return month; } + constexpr DateDay cgetDay() const { return day; } + constexpr static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) + constexpr static DateOutputType getDateOutputType() { return DateOutputType::name_and_ymd; } // 暦名&年月日形式( Variant に用いているため定義) + }; + // 年月日 + class JulianDate { + private: + DateYear year{}; + DateMonth month{}; + DateDay day{}; + public: + JulianDate() = default; + JulianDate(const DateYear year_, const DateMonth month_, const DateDay day_) + :year(year_), month(month_), day(day_) {} + constexpr void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) + constexpr void setYear(const DateYear year_) { year = year_; } + constexpr void setMonth(const DateMonth month_) { month = month_; } + constexpr void setDay(const DateDay day_) { day = day_; } + constexpr void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) + constexpr DateGengo getGengo() const { return 0; } + constexpr DateYear& getYear() { return year; } + constexpr DateMonth& getMonth() { return month; } + constexpr DateDay& getDay() { return day; } + constexpr DateGengo cgetGengo() const { return 0; } + constexpr DateYear cgetYear() const { return year; } + constexpr DateMonth cgetMonth() const { return month; } + constexpr DateDay cgetDay() const { return day; } + constexpr static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) + constexpr static DateOutputType getDateOutputType() { return DateOutputType::name_and_ymd; } // 暦名&年月日形式( Variant に用いているため定義) + }; + + + // 日本の年月日 + class JapanDate { + private: + DateGengo gengo{}; + DateYear year{}; + DateMonth month{}; + DateDay day{}; + bool is_leap_month = false; // 閏月かどうか + public: + JapanDate() = default; + JapanDate(const DateGengo gengo_, const DateYear year_, const DateMonth month_, const DateDay day_, const bool is_leap_month_ = false) + :gengo(gengo_), year(year_), month(month_), day(day_), is_leap_month(is_leap_month_){} + constexpr void setGengo(const DateGengo gengo_) { gengo = gengo_; } + constexpr void setYear(const DateYear year_) { year = year_; } + constexpr void setMonth(const DateMonth month_) { month = month_; } + constexpr void setDay(const DateDay day_) { day = day_; } + constexpr void setLeapMonth(const bool leap_month_) { is_leap_month = leap_month_; } + constexpr DateGengo& getGengo() { return gengo; } + constexpr DateYear& getYear() { return year; } + constexpr DateMonth& getMonth() { return month; } + constexpr DateDay& getDay() { return day; } + constexpr DateGengo cgetGengo() const { return gengo; } + constexpr DateYear cgetYear() const { return year; } + constexpr DateMonth cgetMonth() const { return month; } + constexpr DateDay cgetDay() const { return day; } + constexpr bool isLeapMonth() const { return is_leap_month; } + constexpr static DateOutputType getDateOutputType() { return DateOutputType::name_and_ymd; } // 暦名&年月日形式( Variant に用いているため定義) + }; } diff --git a/Library/PAX_SAPIENTICA/Calendar/JulianDayNumber.hpp b/Library/PAX_SAPIENTICA/Calendar/JulianDayNumber.hpp index 55def33ba..98fa65068 100644 --- a/Library/PAX_SAPIENTICA/Calendar/JulianDayNumber.hpp +++ b/Library/PAX_SAPIENTICA/Calendar/JulianDayNumber.hpp @@ -21,10 +21,10 @@ #include #include -#include +#include #include -namespace paxs { +namespace paxs::cal { template class JulianDayNumber { @@ -32,34 +32,33 @@ namespace paxs { Day day{ 1808286 }; public: JulianDayNumber() = default; - template JulianDayNumber(const T& jdn_) { day = static_cast(jdn_); } - private: - static double getK(const double month) { - return std::floor((14 - month) / 12); - } public: - void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) - void setYear(const DateYear) {} // 何もしない( Variant に用いているため定義) - void setMonth(const DateMonth) {} // 何もしない( Variant に用いているため定義) - void setDay(const Day day_) { day = day_; } - void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) - DateGengo getGengo() { return 0; } - DateYear getYear() { return 0; } - DateMonth getMonth() { return 0; } - Day& getDay() { return day; } - DateGengo cgetGengo() const { return 0; } - DateYear cgetYear() const { return 0; } - DateMonth cgetMonth() const { return 0; } - Day cgetDay() const { return day; } - static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) - static DateOutputType getDateOutputType() { return DateOutputType::name_and_value; } // 暦名&年月日形式( Variant に用いているため定義) + constexpr void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) + constexpr void setYear(const DateYear) const {} // 何もしない( Variant に用いているため定義) + constexpr void setMonth(const DateMonth) const {} // 何もしない( Variant に用いているため定義) + constexpr void setDay(const Day day_) { day = day_; } + constexpr void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) + constexpr DateGengo getGengo() const { return 0; } + constexpr DateYear getYear() const { return 0; } + constexpr DateMonth getMonth() const { return 0; } + constexpr Day& getDay() { return day; } + constexpr DateGengo cgetGengo() const { return 0; } + constexpr DateYear cgetYear() const { return 0; } + constexpr DateMonth cgetMonth() const { return 0; } + constexpr Day cgetDay() const { return day; } + constexpr static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) + constexpr static DateOutputType getDateOutputType() { return DateOutputType::name_and_value; } // 暦名&年月日形式( Variant に用いているため定義) + private: + // グレゴリオ暦の計算用 + constexpr static double getK(const double month) { return std::floor((14 - month) / 12); } + public: // グレゴリオ暦からユリウス日を取得 - void fromGregorianCalendar(const double year, const double month, const double day) { + constexpr void fromGregorianCalendar(const double year, const double month = 1.0, const double day = 1.0) { const double K = getK(month); this->day = static_cast(std::floor((-K + year + 4800) * 1461 / 4) + std::floor((K * 12 + month - 2) * 367 / 12) @@ -67,14 +66,14 @@ namespace paxs { + day - 32075); } // ユリウス暦からユリウス日を取得 - void fromJulianCalendar(const double year, const double month, const double day) { + constexpr void fromJulianCalendar(const double year, const double month = 1.0, const double day = 1.0) { const double K = getK(month); this->day = static_cast(std::floor((-K + year + 4800) * 1461 / 4) + std::floor((K * 12 + month - 2) * 367 / 12) + day - 32113); } // グレゴリオ暦を取得 - GregorianDate toGregorianCalendar() const { + constexpr GregorianDate toGregorianCalendar() const { GregorianDate ymd; //JDN ⇒ グレゴリオ暦 double L = static_cast(this->day) + 68569; @@ -90,7 +89,7 @@ namespace paxs { return ymd; } // ユリウス暦を取得 - JulianDate toJulianCalendar() const { + constexpr JulianDate toJulianCalendar() const { JulianDate ymd; double L = static_cast(this->day) + 1402; const double N = std::floor((L - 1) / 1461); @@ -105,7 +104,7 @@ namespace paxs { return ymd; } // 和暦を取得 - JapanDate toJapaneseCalendar(const std::vector& japanese_era_list) const { + constexpr JapanDate toJapaneseCalendar(const std::vector& japanese_era_list) const { JapanDate jp_date{ 0,1,1,1,false }; // ユリウス日が 1480407 以上(神武 1 年 1 月 1 日以降、グレゴリオ暦 紀元前 660 年 2 月 11 日以降) @@ -156,47 +155,40 @@ namespace paxs { if (is_break) break; } } - return jp_date; } // 較正年代を取得 - CalBP toCalBP() const { + constexpr CalBP toCalBP() const { GregorianDate ymd = toGregorianCalendar(); int value = int(ymd.cgetYear()); - if (value >= 1950) { - value = 0; - } - else { - value = 1950 - value; - } + if (value >= 1950) value = 0; + else value = 1950 - value; return CalBP{ value }; } private: // ヒジュラ暦の閏年かどうか - bool isIslamicLeapYear(const int year) const { return ((((11 * year) + 14) % 30) < 11); } + constexpr bool isIslamicLeapYear(const int year) const { return ((((11 * year) + 14) % 30) < 11); } // ヒジュラ暦の月の日数計算 - int getLastMonthDay(const int year, const int month) const { + constexpr int getLastMonthDay(const int year, const int month) const { return (((month % 2) == 1) || ((month == 12) && isIslamicLeapYear(year))) ? 30 : 29; } - public: - // ヒジュラ暦を取得 - IslamicDate toIslamicCalendar() { - // islamic_day(227014) = jdn(1948439) - const int islamic_day = day - 1721425; - // ヒジュラ暦以前の日付 - if (islamic_day <= 227014) { - return IslamicDate(0, 0, 0); - } - IslamicDate ymd{}; - // おおよその年から1年ずつ前倒しで検索 - ymd.setYear((islamic_day - 227014) / 355); - while (islamic_day >= IslamicDate(ymd.getYear() + 1, 1, 1)) ymd.getYear()++; - // ムハッラム( Muharram ・1月)から月単位で検索 - ymd.setMonth(1); - while (islamic_day > IslamicDate(ymd.getYear(), ymd.getMonth(), getLastMonthDay(ymd.getYear(), ymd.getMonth()))) ymd.getMonth()++; - ymd.setDay(islamic_day - IslamicDate(ymd.getYear(), ymd.getMonth(), 1) + 1); - return ymd; - } + public: + // ヒジュラ暦を取得 + constexpr IslamicDate toIslamicCalendar() const { + // islamic_day(227014) = jdn(1948439) + const int islamic_day = day - 1721425; + // ヒジュラ暦以前の日付 + if (islamic_day <= 227014) return IslamicDate(0, 0, 0); + IslamicDate ymd{}; + // おおよその年から1年ずつ前倒しで検索 + ymd.setYear((islamic_day - 227014) / 355); + while (islamic_day >= IslamicDate(ymd.getYear() + 1, 1, 1)) ymd.getYear()++; + // ムハッラム( Muharram ・1月)から月単位で検索 + ymd.setMonth(1); + while (islamic_day > IslamicDate(ymd.getYear(), ymd.getMonth(), getLastMonthDay(ymd.getYear(), ymd.getMonth()))) ymd.getMonth()++; + ymd.setDay(islamic_day - IslamicDate(ymd.getYear(), ymd.getMonth(), 1) + 1); + return ymd; + } }; using JDN_F64 = JulianDayNumber; using JDN_S32 = JulianDayNumber; diff --git a/Library/PAX_SAPIENTICA/Siv3D/Calendar.hpp b/Library/PAX_SAPIENTICA/Siv3D/Calendar.hpp index bda466bae..2193e5f30 100644 --- a/Library/PAX_SAPIENTICA/Siv3D/Calendar.hpp +++ b/Library/PAX_SAPIENTICA/Siv3D/Calendar.hpp @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -33,25 +35,12 @@ #include #include #include -#include #include #include // 数学定数 #include // 地図投影法 #include namespace paxs { - - // 暦 - using CalendarVariant = std::variant< - GregorianDate, JulianDate, JapanDate, JDN_F64, JDN_S32, JDN_S64, CalBP, IslamicDate - >; - - /// @brief 出力に必要な日付の情報 - struct OutputDate { - std::vector calendar_name{}; // 暦の名前 - CalendarVariant date{}; // 日付 - }; - std::vector setFont(const s3d::FontMethod& font_method, const int font_size, const std::string& path, const std::string& key, paxs::Language& language_text) { std::vector font{}; const std::vector& vs = language_text.getFindStart(key); @@ -61,17 +50,17 @@ namespace paxs { return font; } - // 暦の種類 - enum class KoyomiEnum { - koyomi_japan, // 和暦 - koyomi_g, // グレゴリオ暦 - koyomi_j // ユリウス暦 - }; - class KoyomiSiv3D { public: - JDN_F64 jdn; - std::vector date_list{}; + /// @brief 出力に必要な日付の情報 + struct OutputDate { + std::vector calendar_name{}; // 暦の名前 + cal::Calendars date{}; // 日付 + }; + + cal::JDN_F64 jdn{}; // ユリウス通日(基準となる暦) + std::vector date_list{}; // 表示する暦レイヤー + cal::SimulationSteps steps{}; // シミュレーションのステップ数 std::vector font_pulldown; int font_size = 17; @@ -90,28 +79,11 @@ namespace paxs { paxs::Pulldown pulldown; paxs::MenuBar menu_bar; - s3d::Texture texture_tlt; - s3d::Texture texture_github; - s3d::Texture texture_d_l; - s3d::Texture texture_d_r; - s3d::Texture texture_m_l; - s3d::Texture texture_m_r; - s3d::Texture texture_y_l; - s3d::Texture texture_y_r; - s3d::Texture texture_10y_l; - s3d::Texture texture_10y_r; - s3d::Texture texture_c_l; - s3d::Texture texture_c_r; - s3d::Texture texture_10c_l; - s3d::Texture texture_10c_r; - s3d::Texture texture_100c_l; - s3d::Texture texture_100c_r; - s3d::Texture texture_stop; - s3d::Texture texture_playback; - s3d::Texture texture_reverse_playback; - - - /*########################################################################################## + + std::unordered_map texture_dictionary{}; + + +/*########################################################################################## 読み込む XYZ タイルの情報を記載 map_name 地図名 map_url_name 地図画像を取得する URL @@ -179,9 +151,57 @@ namespace paxs { bool is_agent_update = true; // エージェントの更新をするか public: - void init(paxs::Language & language_text - , const s3d::String& path, - const std::string& path8, + + + void calcDate( + //std::vector& date_list, + //const JDN_F64& jdn, + //const std::vector& japanese_era_list, + const SelectLanguage& select_language, + const paxs::Language& language_text + ){ + // 暦データを更新 + paxs::cal::JapanDate jp_date{}; + for (auto& dl : date_list) { + switch (dl.date.index()) { + case cal::gregorian_date_type: + // グレゴリオ暦を格納 + dl.date = jdn.toGregorianCalendar(); + break; + case cal::julian_date_type: + // ユリウス暦を格納 + dl.date = jdn.toJulianCalendar(); + break; + case cal::japan_date_type: + // 和暦を格納 + jp_date = jdn.toJapaneseCalendar(japanese_era_list); + // TODO : 日本語バージョンで、初期状態で日本の元号が読み込めない不具合あり + dl.calendar_name[select_language.cget() + 1 /* 言語位置調整 */] = language_text.cgetFindStart("gengo_" + std::to_string(jp_date.cgetGengo()))[select_language.cget() + 1 /* 言語位置調整 */]; + dl.date = jp_date; + break; + case cal::jdn_f64_type: + case cal::jdn_s32_type: + case cal::jdn_s64_type: + dl.date = jdn; + break; + case cal::calbp_type: + // 格納 + dl.date = jdn.toCalBP(); + break; + case cal::islamic_date_type: + dl.date = jdn.toIslamicCalendar(); + break; + case cal::simulation_steps_type: + dl.date = steps; + break; + } + } + } + + void init( + const SelectLanguage& select_language, + paxs::Language & language_text, + const std::string& path8, const std::unique_ptr& map_view ) { @@ -189,12 +209,13 @@ namespace paxs { // 各暦の日付情報を初期化 date_list = std::vector{ - OutputDate{language_text.getFindStart("calendar_japan"),JapanDate() }, - OutputDate{language_text.getFindStart("calendar_gregorian"),GregorianDate() }, - OutputDate{language_text.getFindStart("calendar_julian"), JulianDate() }, - OutputDate{language_text.getFindStart("calendar_hijri"), IslamicDate() }, - OutputDate{language_text.getFindStart("calendar_julian_day"), JDN_S64() }, - OutputDate{language_text.getFindStart("calendar_calbp"), CalBP()} + OutputDate{language_text.getFindStart("calendar_japan"),cal::JapanDate() }, + OutputDate{language_text.getFindStart("calendar_gregorian"),cal::GregorianDate() }, + OutputDate{language_text.getFindStart("calendar_julian"), cal::JulianDate() }, + OutputDate{language_text.getFindStart("calendar_hijri"), cal::IslamicDate() }, + OutputDate{language_text.getFindStart("calendar_julian_day"), cal::JDN_S64() }, + OutputDate{language_text.getFindStart("calendar_calbp"), cal::CalBP()}, + OutputDate{language_text.getFindStart("calendar_calbp"), cal::SimulationSteps()} }; font_pulldown = setFont(s3d::FontMethod::SDF, 16, path8, "font_path", language_text); @@ -221,26 +242,28 @@ namespace paxs { menu_bar.add(language_text.get(), language_text.findStart("> menu_bar_calendar") + 1, 1, font_menu_bar); menu_bar.add(language_text.get(), language_text.findStart("> menu_bar_map") + 1, 1, font_menu_bar); - texture_tlt = s3d::Texture{ path + U"Image/Logo/TitleLogoText2.svg" }; - texture_github = s3d::Texture{ path + U"Data/MenuIcon/github.svg" }; - texture_d_l = s3d::Texture{ path + U"Data/MenuIcon/DayL.svg" }; - texture_d_r = s3d::Texture{ path + U"Data/MenuIcon/DayR.svg" }; - texture_m_l = s3d::Texture{ path + U"Data/MenuIcon/MonthL.svg" }; - texture_m_r = s3d::Texture{ path + U"Data/MenuIcon/MonthR.svg" }; - texture_y_l = s3d::Texture{ path + U"Data/MenuIcon/YearL.svg" }; - texture_y_r = s3d::Texture{ path + U"Data/MenuIcon/YearR.svg" }; - texture_10y_l = s3d::Texture{ path + U"Data/MenuIcon/10YearL.svg" }; - texture_10y_r = s3d::Texture{ path + U"Data/MenuIcon/10YearR.svg" }; - texture_c_l = s3d::Texture{ path + U"Data/MenuIcon/100YearL.svg" }; - texture_c_r = s3d::Texture{ path + U"Data/MenuIcon/100YearR.svg" }; - texture_10c_l = s3d::Texture{ path + U"Data/MenuIcon/1kYearL.svg" }; - texture_10c_r = s3d::Texture{ path + U"Data/MenuIcon/1kYearR.svg" }; - texture_100c_l = s3d::Texture{ path + U"Data/MenuIcon/10kYearL.svg" }; - texture_100c_r = s3d::Texture{ path + U"Data/MenuIcon/10kYearR.svg" }; - texture_stop = s3d::Texture{ path + U"Data/MenuIcon/stop.svg" }; - texture_playback = s3d::Texture{ path + U"Data/MenuIcon/playback.svg" }; - texture_reverse_playback = s3d::Texture{ path + U"Data/MenuIcon/reverse-playback.svg" }; - + const s3d::String path = s3d::Unicode::FromUTF8(path8); + { + texture_dictionary.emplace("texture_tlt", s3d::Texture{path + U"Image/Logo/TitleLogoText2.svg"}); + texture_dictionary.emplace("texture_github", s3d::Texture{ path + U"Data/MenuIcon/github.svg" }); + texture_dictionary.emplace("texture_d_l", s3d::Texture{ path + U"Data/MenuIcon/DayL.svg" }); + texture_dictionary.emplace("texture_d_r", s3d::Texture{ path + U"Data/MenuIcon/DayR.svg" }); + texture_dictionary.emplace("texture_m_l", s3d::Texture{ path + U"Data/MenuIcon/MonthL.svg" }); + texture_dictionary.emplace("texture_m_r", s3d::Texture{ path + U"Data/MenuIcon/MonthR.svg" }); + texture_dictionary.emplace("texture_y_l", s3d::Texture{ path + U"Data/MenuIcon/YearL.svg" }); + texture_dictionary.emplace("texture_y_r", s3d::Texture{ path + U"Data/MenuIcon/YearR.svg" }); + texture_dictionary.emplace("texture_10y_l", s3d::Texture{ path + U"Data/MenuIcon/10YearL.svg" }); + texture_dictionary.emplace("texture_10y_r", s3d::Texture{ path + U"Data/MenuIcon/10YearR.svg" }); + texture_dictionary.emplace("texture_c_l", s3d::Texture{ path + U"Data/MenuIcon/100YearL.svg" }); + texture_dictionary.emplace("texture_c_r", s3d::Texture{ path + U"Data/MenuIcon/100YearR.svg" }); + texture_dictionary.emplace("texture_10c_l", s3d::Texture{ path + U"Data/MenuIcon/1kYearL.svg" }); + texture_dictionary.emplace("texture_10c_r", s3d::Texture{ path + U"Data/MenuIcon/1kYearR.svg" }); + texture_dictionary.emplace("texture_100c_l", s3d::Texture{ path + U"Data/MenuIcon/10kYearL.svg" }); + texture_dictionary.emplace("texture_100c_r", s3d::Texture{ path + U"Data/MenuIcon/10kYearR.svg" }); + texture_dictionary.emplace("texture_stop", s3d::Texture{ path + U"Data/MenuIcon/stop.svg" }); + texture_dictionary.emplace("texture_playback", s3d::Texture{ path + U"Data/MenuIcon/playback.svg" }); + texture_dictionary.emplace("texture_reverse_playback", s3d::Texture{ path + U"Data/MenuIcon/reverse-playback.svg" }); + } /*########################################################################################## 読み込む XYZ タイルの情報を記載 map_name 地図名 @@ -298,9 +321,14 @@ namespace paxs { shadow_texture= s3d::RenderTexture{ s3d::Scene::Size(), s3d::ColorF{ 1.0, 0.0 } }; internal_texture= s3d::RenderTexture{ shadow_texture.size() }; - + // 日付計算 + calcDate(select_language, language_text); } - void update(const std::unique_ptr& map_view, const std::size_t language + + + + void update(const std::unique_ptr& map_view + , const SelectLanguage& select_language , paxs::Language& language_text, paxs::Simulator& simulator, const paxs::Vector2& start_position, @@ -316,52 +344,35 @@ namespace paxs { //paxs::MathF64::radToDeg(std::asin(std::tanh(paxs::MathF64::degToRad(map_view->getCenterY())))); map_view->getCoordinate().toEquirectangularDegY(); - /*########################################################################################## +/*########################################################################################## 暦関連 ##########################################################################################*/ -//s3d::Rect{ 0,0,50 }.drawFrame(2, ColorF{ 1, 0, 0, 0.5 }); -//Circle{ Cursor::Pos(), 40 }.drawFrame(2, ColorF{ 1, 0, 0, 0.5 }); -//Circle{ Scene::Center(), 10 }.draw(s3d::Palette::Red); // 真ん中の赤い点 - -// 日付の構造体 - // グレゴリオ暦を格納 - date_list[std::size_t(KoyomiEnum::koyomi_g)].date = jdn.toGregorianCalendar(); - // ユリウス暦を格納 - date_list[std::size_t(KoyomiEnum::koyomi_j)].date = jdn.toJulianCalendar(); - // 和暦を格納 - paxs::JapanDate jp_date{}; - jp_date = jdn.toJapaneseCalendar(japanese_era_list); - date_list[std::size_t(KoyomiEnum::koyomi_japan)].calendar_name[language + 1 /* 言語位置調整 */] = language_text.getFindStart("gengo_" + std::to_string(jp_date.cgetGengo()))[language + 1 /* 言語位置調整 */]; - date_list[std::size_t(KoyomiEnum::koyomi_japan)].date = jp_date; - - // 格納 - date_list[3].date = jdn.toIslamicCalendar(); - date_list[4].date = jdn; - date_list[5].date = jdn.toCalBP(); - - static int count = 0; // 暦を繰り上げるタイミングを決めるためのカウンタ - ++count; + static int calendar_update_counter = 0; // 暦を繰り上げるタイミングを決めるためのカウンタ + ++calendar_update_counter; //if(move_forward_in_time) jdn += 1000; //else if(go_back_in_time) jdn -= 1000; //if (count >= 0) { - if (count >= 30) { - count = 0; + if (calendar_update_counter >= 30) { + calendar_update_counter = 0; if (move_forward_in_time) { if (jdn.getDay() != (std::numeric_limits::max)()) { jdn.getDay() += 1.0; // ユリウス日を繰り上げ(次の日にする) + calcDate(select_language, language_text); } //jdn += 365; // ユリウス日を繰り上げ(次の日にする) #ifdef PAXS_USING_SIMULATOR // エージェント機能テスト if (is_agent_update) { simulator.step(); + steps.getDay()++; // ステップ数を増やす } #endif } else if (go_back_in_time) { if (jdn.getDay() != (std::numeric_limits::max)()) { jdn.getDay() -= 1.0; // ユリウス日を繰り上げ(次の日にする) + calcDate(select_language, language_text); } } } @@ -393,13 +404,13 @@ namespace paxs { // 暦の表示(日本語) if ( - language == 1 - || language == 2 - || language == 3 + select_language.cget() == 1 + || select_language.cget() == 2 + || select_language.cget() == 3 ) { for (std::size_t i = 0; i < date_list.size(); ++i) { - DateOutputType output_type = DateOutputType::name_and_value; + cal::DateOutputType output_type = cal::DateOutputType::name_and_value; std::visit([&](const auto& x) { output_type = x.getDateOutputType(); }, date_list[i].date); int date_year = 0; @@ -407,11 +418,11 @@ namespace paxs { int date_day = 0; bool date_lm = false; switch (output_type) { - case paxs::DateOutputType::name_and_ymd: - koyomi_font[language](s3d::Unicode::FromUTF8(date_list[i].calendar_name[language + 1 /* 言語位置調整 */])).draw(s3d::Arg::topRight = s3d::Vec2(koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](U"年").draw(s3d::Arg::topRight = s3d::Vec2(int(120 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](U"月").draw(s3d::Arg::topRight = s3d::Vec2(int(220 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](U"日").draw(s3d::Arg::topRight = s3d::Vec2(int(300 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + case paxs::cal::DateOutputType::name_and_ymd: + koyomi_font[select_language.cget()](s3d::Unicode::FromUTF8(date_list[i].calendar_name[select_language.cget() + 1 /* 言語位置調整 */])).draw(s3d::Arg::topRight = s3d::Vec2(koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](U"年").draw(s3d::Arg::topRight = s3d::Vec2(int(120 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](U"月").draw(s3d::Arg::topRight = s3d::Vec2(int(220 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](U"日").draw(s3d::Arg::topRight = s3d::Vec2(int(300 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); std::visit([&](const auto& x) { date_year = int(x.cgetYear()); @@ -420,21 +431,21 @@ namespace paxs { date_lm = x.isLeapMonth(); }, date_list[i].date); - koyomi_font[language](s3d::ToString(date_year)).draw(s3d::Arg::topRight = s3d::Vec2(int(85 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](s3d::ToString(date_month)).draw(s3d::Arg::topRight = s3d::Vec2(int(190 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](s3d::ToString(date_day)).draw(s3d::Arg::topRight = s3d::Vec2(int(270 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](s3d::ToString(date_year)).draw(s3d::Arg::topRight = s3d::Vec2(int(85 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](s3d::ToString(date_month)).draw(s3d::Arg::topRight = s3d::Vec2(int(190 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](s3d::ToString(date_day)).draw(s3d::Arg::topRight = s3d::Vec2(int(270 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); if (date_lm) { - koyomi_font[language](U"閏").draw(s3d::Arg::topRight = s3d::Vec2(( + koyomi_font[select_language.cget()](U"閏").draw(s3d::Arg::topRight = s3d::Vec2(( (date_month < 10) ? int(167 * koyomi_font_size / 30.0) + koyomi_font_x : int(152 * koyomi_font_size / 30.0) + koyomi_font_x ), koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); } break; - case paxs::DateOutputType::name_and_value: - koyomi_font[language](s3d::Unicode::FromUTF8(date_list[i].calendar_name[language + 1 /* 言語位置調整 */])).draw(s3d::Arg::topRight = s3d::Vec2(koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + case paxs::cal::DateOutputType::name_and_value: + koyomi_font[select_language.cget()](s3d::Unicode::FromUTF8(date_list[i].calendar_name[select_language.cget() + 1 /* 言語位置調整 */])).draw(s3d::Arg::topRight = s3d::Vec2(koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); std::visit([&](const auto& x) { date_day = int(x.cgetDay()); }, date_list[i].date); - koyomi_font[language](s3d::ToString(date_day)).draw(s3d::Arg::topRight = s3d::Vec2(int(300 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](s3d::ToString(date_day)).draw(s3d::Arg::topRight = s3d::Vec2(int(300 * koyomi_font_size / 30.0) + koyomi_font_x, koyomi_font_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); break; default: @@ -446,7 +457,7 @@ namespace paxs { // 暦の表示(英語) for (std::size_t i = 0; i < date_list.size(); ++i) { - DateOutputType output_type = DateOutputType::name_and_value; + cal::DateOutputType output_type = cal::DateOutputType::name_and_value; std::visit([&](const auto& x) { output_type = x.getDateOutputType(); }, date_list[i].date); int date_year = 0; @@ -454,11 +465,11 @@ namespace paxs { int date_day = 0; bool date_lm = false; switch (output_type) { - case paxs::DateOutputType::name_and_ymd: - koyomi_font[language](s3d::Unicode::FromUTF8(date_list[i].calendar_name[language + 1 /* 言語位置調整 */])).draw(s3d::Arg::topRight = s3d::Vec2(koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](U",").draw(s3d::Arg::topRight = s3d::Vec2(int(95 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](U",").draw(s3d::Arg::topRight = s3d::Vec2(int(235 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](U"th").draw(s3d::Arg::topRight = s3d::Vec2(int(315 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + case paxs::cal::DateOutputType::name_and_ymd: + koyomi_font[select_language.cget()](s3d::Unicode::FromUTF8(date_list[i].calendar_name[select_language.cget() + 1 /* 言語位置調整 */])).draw(s3d::Arg::topRight = s3d::Vec2(koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](U",").draw(s3d::Arg::topRight = s3d::Vec2(int(95 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](U",").draw(s3d::Arg::topRight = s3d::Vec2(int(235 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](U"th").draw(s3d::Arg::topRight = s3d::Vec2(int(315 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); std::visit([&](const auto& x) { date_year = int(x.cgetYear()); @@ -467,22 +478,22 @@ namespace paxs { date_lm = x.isLeapMonth(); }, date_list[i].date); - koyomi_font[language](s3d::ToString(date_year)).draw(s3d::Arg::topRight = s3d::Vec2(int(85 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](s3d::Unicode::FromUTF8(month_name[date_month])).draw(s3d::Arg::topRight = s3d::Vec2(int(220 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); - koyomi_font[language](s3d::ToString(date_day)).draw(s3d::Arg::topRight = s3d::Vec2(int(280 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](s3d::ToString(date_year)).draw(s3d::Arg::topRight = s3d::Vec2(int(85 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](s3d::Unicode::FromUTF8(month_name[date_month])).draw(s3d::Arg::topRight = s3d::Vec2(int(220 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](s3d::ToString(date_day)).draw(s3d::Arg::topRight = s3d::Vec2(int(280 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); if (date_lm) { - koyomi_font[language](U"int.").draw(s3d::Arg::topRight = s3d::Vec2(( + koyomi_font[select_language.cget()](U"int.").draw(s3d::Arg::topRight = s3d::Vec2(( int(152 * koyomi_font_size / 30.0) + koyomi_font_en_x ), koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); } break; - case paxs::DateOutputType::name_and_value: - koyomi_font[language](s3d::Unicode::FromUTF8(date_list[i].calendar_name[language + 1 /* 言語位置調整 */])).draw(s3d::Arg::topRight = s3d::Vec2(koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + case paxs::cal::DateOutputType::name_and_value: + koyomi_font[select_language.cget()](s3d::Unicode::FromUTF8(date_list[i].calendar_name[select_language.cget() + 1 /* 言語位置調整 */])).draw(s3d::Arg::topRight = s3d::Vec2(koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); std::visit([&](const auto& x) { date_day = int(x.cgetDay()); }, date_list[i].date); - koyomi_font[language](s3d::ToString(date_day)).draw(s3d::Arg::topRight = s3d::Vec2(int(315 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); + koyomi_font[select_language.cget()](s3d::ToString(date_day)).draw(s3d::Arg::topRight = s3d::Vec2(int(315 * koyomi_font_size / 30.0) + koyomi_font_en_x, koyomi_font_en_y + i * (koyomi_font_size * 4 / 3)), s3d::Palette::Black); break; default: @@ -500,96 +511,114 @@ namespace paxs { const int arrow_icon_move_y = 30; const int icon_move_y = 44; - texture_reverse_playback.resized(arrow_time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); - if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { + // texture_dictionary std::string + // icon_size + // icon_move_x + // icon_move_y + texture_dictionary.at("texture_reverse_playback").resized(arrow_time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , arrow_time_icon_size, arrow_time_icon_size }.leftClicked())) { move_forward_in_time = false; go_back_in_time = true; // 逆再生 } icon_start_x -= arrow_icon_move_x; - texture_stop.resized(arrow_time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); - if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { + texture_dictionary.at("texture_stop").resized(arrow_time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , arrow_time_icon_size, arrow_time_icon_size }.leftClicked())) { move_forward_in_time = false; // 一時停止 go_back_in_time = false; } icon_start_x -= arrow_icon_move_x; - texture_playback.resized(arrow_time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); - if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { + texture_dictionary.at("texture_playback").resized(arrow_time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , arrow_time_icon_size, arrow_time_icon_size }.leftClicked())) { move_forward_in_time = true; // 再生 go_back_in_time = false; } icon_start_y += arrow_icon_move_y; icon_start_x = icon_const_start_x; - texture_d_l.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_d_l").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { jdn.getDay() -= 1; + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_m_l.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_m_l").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() -= 30; + jdn.getDay() -= (365.2422 / 12.0); + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_y_l.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_y_l").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() -= 365; + jdn.getDay() -= 365.2422; + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_10y_l.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_10y_l").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() -= 3650; + jdn.getDay() -= (365.2422 * 10); + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_c_l.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_c_l").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() -= (365 * 100); + jdn.getDay() -= (365.2422 * 100); + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_10c_l.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_10c_l").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() -= (365 * 1000); + jdn.getDay() -= (365.2422 * 1000); + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_100c_l.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_100c_l").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() -= (365 * 10000); + jdn.getDay() -= (365.2422 * 10000); + calcDate(select_language, language_text); } icon_start_y += icon_move_y; icon_start_x = icon_const_start_x; - texture_d_r.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_d_r").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { jdn.getDay() += 1; + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_m_r.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_m_r").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() += 30; + jdn.getDay() += (365.2422 / 12.0); + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_y_r.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_y_r").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() += 365; + jdn.getDay() += 365.2422; + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_10y_r.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_10y_r").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() += 3650; + jdn.getDay() += (365.2422 * 10); + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_c_r.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_c_r").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() += (365 * 100); + jdn.getDay() += (365.2422 * 100); + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_10c_r.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_10c_r").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() += (365 * 1000); + jdn.getDay() += (365.2422 * 1000); + calcDate(select_language, language_text); } icon_start_x -= icon_move_x; - texture_100c_r.resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); + texture_dictionary.at("texture_100c_r").resized(time_icon_size).draw(s3d::Scene::Width() - icon_start_x, koyomi_font_y + icon_start_y); if (tm_.get(s3d::Rect{ s3d::Scene::Width() - icon_start_x,koyomi_font_y + icon_start_y , time_icon_size,time_icon_size }.leftClicked())) { - jdn.getDay() += (365 * 10000); + jdn.getDay() += (365.2422 * 10000); + calcDate(select_language, language_text); } } @@ -599,40 +628,40 @@ namespace paxs { //if (s3d::SimpleGUI::RadioButtons(index1, options, s3d::Vec2{ s3d::Scene::Width() - 400, 400 })) { // jdn = period_jdn[index1]; //} - - int debug_start_y = 300; - int debug_move_y = 25; - // その他のデバッグ用の変数情報の表示 - if (menu_bar.getPulldown(MenuBarType::view).getIsItems(3)) { - font[language](s3d::Unicode::FromUTF8(language_text.get()[map_view_center_x_str_index][language + 1 /* 言語位置調整 */] + { + int debug_start_y = 300; + int debug_move_y = 25; + // その他のデバッグ用の変数情報の表示 + if (menu_bar.getPulldown(MenuBarType::view).getIsItems(3)) { + font[select_language.cget()](s3d::Unicode::FromUTF8(language_text.get()[map_view_center_x_str_index][select_language.cget() + 1 /* 言語位置調整 */] )).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 160, debug_start_y), s3d::Palette::Black); - font[language](s3d::ToString(map_view->getCenterX()) - ).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); - debug_start_y += debug_move_y; - // マップ中心座標 Y - font[language](s3d::Unicode::FromUTF8(language_text.get()[map_view_center_y_str_index][language + 1 /* 言語位置調整 */] + font[select_language.cget()](s3d::ToString(map_view->getCenterX()) + ).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); + debug_start_y += debug_move_y; + // マップ中心座標 Y + font[select_language.cget()](s3d::Unicode::FromUTF8(language_text.get()[map_view_center_y_str_index][select_language.cget() + 1 /* 言語位置調整 */] )).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 160, debug_start_y), s3d::Palette::Black); - font[language](s3d::ToString(map_view->getCenterY()) - ).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); - debug_start_y += debug_move_y; - font[language](s3d::Unicode::FromUTF8(language_text.get()[map_view_center_lat_str_index][language + 1 /* 言語位置調整 */] + font[select_language.cget()](s3d::ToString(map_view->getCenterY()) + ).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); + debug_start_y += debug_move_y; + font[select_language.cget()](s3d::Unicode::FromUTF8(language_text.get()[map_view_center_lat_str_index][select_language.cget() + 1 /* 言語位置調整 */] )).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 160, debug_start_y), s3d::Palette::Black); - font[language](s3d::ToString(map_view_center_lat) - ).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); - debug_start_y += debug_move_y; - font[language](s3d::Unicode::FromUTF8(language_text.get()[map_view_width_str_index][language + 1 /* 言語位置調整 */] + font[select_language.cget()](s3d::ToString(map_view_center_lat) + ).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); + debug_start_y += debug_move_y; + font[select_language.cget()](s3d::Unicode::FromUTF8(language_text.get()[map_view_width_str_index][select_language.cget() + 1 /* 言語位置調整 */] )).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 160, debug_start_y), s3d::Palette::Black); - font[language](s3d::ToString(map_view_width) - ).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); - debug_start_y += debug_move_y; - font[language](s3d::Unicode::FromUTF8(language_text.get()[xyz_tile_z_str_index][language + 1 /* 言語位置調整 */] + font[select_language.cget()](s3d::ToString(map_view_width) + ).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); + debug_start_y += debug_move_y; + font[select_language.cget()](s3d::Unicode::FromUTF8(language_text.get()[xyz_tile_z_str_index][select_language.cget() + 1 /* 言語位置調整 */] )).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 160, debug_start_y), s3d::Palette::Black); - //font[language](s3d::ToString(xyz_tile2->getZ()) - //).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); - //debug_start_y += debug_move_y; - //font[language](s3d::ToString(xyz_tile2->getZNum()) - //).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); - + //font[language](s3d::ToString(xyz_tile2->getZ()) + //).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); + //debug_start_y += debug_move_y; + //font[language](s3d::ToString(xyz_tile2->getZNum()) + //).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Vec2(s3d::Scene::Width() - 110, debug_start_y), s3d::Palette::Black); + } } if (menu_bar.getPulldown(MenuBarType::view).getIsItems(2)) { //font(std::string{ U"A" } + s3d::ToString(xyz_tile_cell.x) + std::string{ U":" } + s3d::ToString(xyz_tile_cell.y)).draw(s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 10, 400), s3d::Palette::Black); @@ -654,7 +683,7 @@ namespace paxs { // メニューバー s3d::Rect{ 0,0,s3d::Scene::Width(),30 }.draw(s3d::Color{ 243,243,243 }); - texture_github.resized(24).draw(s3d::Vec2{ s3d::Scene::Width() - 280, 3 }); + texture_dictionary.at("texture_github").resized(24).draw(s3d::Vec2{ s3d::Scene::Width() - 280, 3 }); pulldown.draw(); // 言語選択 menu_bar.draw(); // 左上メニューバー @@ -665,10 +694,10 @@ namespace paxs { if (menu_bar.getPulldown(MenuBarType::view).getIsItems(2)) { - font[language](s3d::Unicode::FromUTF8(language_text.get()[sueki_nakamura_index][language + 1 /* 言語位置調整 */] + font[select_language.cget()](s3d::Unicode::FromUTF8(language_text.get()[sueki_nakamura_index][select_language.cget() + 1 /* 言語位置調整 */] )).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 160, 590), s3d::Palette::Black); - font[language](s3d::Unicode::FromUTF8(language_text.get()[sueki_tanabe_index][language + 1 /* 言語位置調整 */] + font[select_language.cget()](s3d::Unicode::FromUTF8(language_text.get()[sueki_tanabe_index][select_language.cget() + 1 /* 言語位置調整 */] )).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 160, 620), s3d::Palette::Black); { @@ -686,22 +715,21 @@ namespace paxs { "","I-1前","I-1後","I-2","I-3","I-3","I-3","I-4","I-4/I-5","I-5", "II-1","II-2","II-2/II-3","II-3","II-4","II-5","II-6","III-1" } }; - - int date_year = 0; - std::visit([&](const auto& x) { - date_year = int(x.cgetYear()); - }, date_list[1].date); - for (std::size_t i = 0; i < sueki_year.size(); ++i) { - if (date_year < sueki_year[i]) { - sueki_tanabe = sueki_name[i]; - sueki_nakamura = sueki_nakamura_name[i]; - break; + { + int date_year = 0; + std::visit([&](const auto& x) { date_year = int(x.cgetYear()); }, date_list[1].date); + for (std::size_t i = 0; i < sueki_year.size(); ++i) { + if (date_year < sueki_year[i]) { + sueki_tanabe = sueki_name[i]; + sueki_nakamura = sueki_nakamura_name[i]; + break; + } } } - font[language](s3d::Unicode::FromUTF8(sueki_tanabe + font[select_language.cget()](s3d::Unicode::FromUTF8(sueki_tanabe )).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 60, 620), s3d::Palette::Black); - font[language](s3d::Unicode::FromUTF8(sueki_nakamura + font[select_language.cget()](s3d::Unicode::FromUTF8(sueki_nakamura )).draw(s3d::TextStyle::Outline(0, 0.6, s3d::Palette::White), s3d::Arg::topRight = s3d::Vec2(s3d::Scene::Width() - 60, 590), s3d::Palette::Black); } @@ -709,21 +737,14 @@ namespace paxs { if (s3d::SimpleGUI::Button(U"Init", s3d::Vec2{ 10,60 })) { simulator = paxs::Simulator( path8 + "Data/Simulation/MapList.tsv", - //paxs::Vector2{861, 350}, - //paxs::Vector2{950, 450}, 10); - start_position, - end_position, 10); + //paxs::Vector2{861, 350}, paxs::Vector2{950, 450}, 10); + start_position, end_position, 10); simulator.init(); + steps.setDay(0); // ステップ数を 0 にする } - if (s3d::SimpleGUI::Button(U"Start", s3d::Vec2{ 110,60 })) { - is_agent_update = true; - } - if (s3d::SimpleGUI::Button(U"Stop", s3d::Vec2{ 210,60 })) { - is_agent_update = false; - } + if (s3d::SimpleGUI::Button(U"Start", s3d::Vec2{ 110,60 })) is_agent_update = true; + if (s3d::SimpleGUI::Button(U"Stop", s3d::Vec2{ 210,60 })) is_agent_update = false; #endif - - } } diff --git a/Library/PAX_SAPIENTICA/Siv3D/InitLogo.hpp b/Library/PAX_SAPIENTICA/Siv3D/InitLogo.hpp index 0f90e40ad..d4f1a5a47 100644 --- a/Library/PAX_SAPIENTICA/Siv3D/InitLogo.hpp +++ b/Library/PAX_SAPIENTICA/Siv3D/InitLogo.hpp @@ -23,9 +23,9 @@ namespace paxs { class PaxSapienticaInitSiv3D { private: - bool first_update = false; public: - void firstInit() const { + // ソフトウェアを実行した最初のフレームの一番最初に実行 + static void firstInit() { // ロゴ画像の読み込み const s3d::Texture texture_tl{ U"./../../../../../Image/Logo/TitleBanner2.svg" }; // 画面サイズを変更 @@ -48,7 +48,9 @@ namespace paxs { texture_tl.drawAt(s3d::Scene::Center()); } - void secondInit() { + // ソフトウェアを実行した最初のフレームの一番最後に実行 + static void secondInit() { + static bool first_update = false; if (!first_update) { first_update = true; s3d::Scene::SetLetterbox(s3d::Color{ 243,243,243 }); diff --git a/Library/PAX_SAPIENTICA/Siv3D/Language.hpp b/Library/PAX_SAPIENTICA/Siv3D/Language.hpp index fbef6bf77..b2b0a7ae4 100644 --- a/Library/PAX_SAPIENTICA/Siv3D/Language.hpp +++ b/Library/PAX_SAPIENTICA/Siv3D/Language.hpp @@ -16,6 +16,7 @@ ##########################################################################################*/ +#include #include #include #include @@ -26,6 +27,15 @@ namespace paxs { + // 選択言語 + class SelectLanguage { + private: + std::size_t select_language = 0; + public: + constexpr void set(const std::size_t select_language_) { select_language = select_language_; } + constexpr std::size_t& get() { return select_language; } + constexpr std::size_t cget() const { return select_language; } + }; class Language { private: std::vector> text{}; @@ -44,7 +54,7 @@ namespace paxs { } public: - std::vector>& get() { + constexpr std::vector>& get() { return text; } void add(const std::string& str_) { @@ -59,9 +69,9 @@ namespace paxs { add(str_); } // 始点を探す - std::size_t findStart(const std::string& str_) { + std::size_t findStart(const std::string& str_) const { if (text_map.find(str_) != text_map.end()) { - return text_map[str_]; + return text_map.at(str_); } return 0; } @@ -72,6 +82,13 @@ namespace paxs { } return empty; } + const std::vector& cgetFindStart(const std::string& str_) const { + const std::size_t index = findStart(str_); + if (index < text.size()) { + return text[index]; + } + return empty; + } std::vector> getFindStartToVVS(const std::string& str_, const std::size_t start_index) { std::vector> tmp{}; const std::vector& lt = getFindStart(str_); diff --git a/Library/PAX_SAPIENTICA/Siv3D/Main.hpp b/Library/PAX_SAPIENTICA/Siv3D/Main.hpp index ca8081cda..e869150cf 100644 --- a/Library/PAX_SAPIENTICA/Siv3D/Main.hpp +++ b/Library/PAX_SAPIENTICA/Siv3D/Main.hpp @@ -40,20 +40,15 @@ namespace paxs { void startMain() { - // 初期化とロゴの表示 - paxs::PaxSapienticaInitSiv3D init{}; - init.firstInit(); - //s3d::Console::Open() - s3d::detail::Console_impl ci; - ci.open(); - // フォルダ階層 - const std::string path8 = "./../../../../../"; - const s3d::String path = s3d::Unicode::FromUTF8(path8); - paxs::Language language_text(path8 + "Data/Language/Text.txt"); + // 主要な実行時定数・変数 + const std::string path8 = "./../../../../../"; // フォルダ階層 + SelectLanguage select_language{}; // 選択言語 - // マップ関連変数 - const std::unique_ptr map_view(new(std::nothrow) MapView); + paxs::PaxSapienticaInitSiv3D::firstInit(); // 初期化とロゴの表示 + s3d::detail::Console_impl{}.open(); // コンソールを開く s3d::Console::Open() + paxs::Language language_text(path8 + "Data/Language/Text.txt"); // テキストの多言語対応クラス + const std::unique_ptr map_view(new(std::nothrow) MapView); // マップ関連変数 //#ifdef PAXS_USING_SIMULATOR paxs::Simulator simlator; @@ -63,14 +58,13 @@ namespace paxs { // 本州 paxs::Vector2 start_position = paxs::Vector2{ 877, 381 }; paxs::Vector2 end_position = paxs::Vector2{ 917, 422 }; - //simlator.init(); //#endif int old_width = s3d::Scene::Width(); int old_height = s3d::Scene::Height(); int size_change_count = 0; paxs::KoyomiSiv3D koyomi_siv{}; - koyomi_siv.init(language_text, path, path8, map_view); + koyomi_siv.init(select_language, language_text, path8, map_view); paxs::TouchManager tm; /*########################################################################################## @@ -123,9 +117,9 @@ namespace paxs { // プルダウンを更新 koyomi_siv.pulldown.setPos(s3d::Point{ s3d::Scene::Width() - koyomi_siv.pulldown.getRect().w, 0 }); - koyomi_siv.pulldown.update(0, tm); - const std::size_t language = koyomi_siv.pulldown.getIndex(); - koyomi_siv.menu_bar.update(language, tm); + koyomi_siv.pulldown.update(SelectLanguage{}, tm); + select_language.set(std::size_t(koyomi_siv.pulldown.getIndex())); // 選択言語を更新 + koyomi_siv.menu_bar.update(select_language, tm); mapMapUpdate(koyomi_siv.xyz_tile_list, koyomi_siv.menu_bar, map_view.get()); @@ -151,7 +145,7 @@ namespace paxs { // 地名を描画 koyomi_siv.place_name_location->draw(koyomi_siv.jdn.getDay(), map_view_width, map_view_height, map_view_center_x, map_view_center_y, - koyomi_siv.font[language], koyomi_siv.font[language]/*en_font*/, koyomi_siv.pin_font); + koyomi_siv.font[select_language.cget()], koyomi_siv.font[select_language.cget()]/*en_font*/, koyomi_siv.pin_font); //#ifdef PAXS_USING_SIMULATOR // // エージェント機能テスト @@ -175,14 +169,17 @@ namespace paxs { // font[language], font[language]/*en_font*/, pin_font); //#endif } - koyomi_siv.update(map_view, language, language_text, + koyomi_siv.update( + map_view, + select_language, + language_text, simlator, start_position, end_position, path8, tm ); - init.secondInit(); + paxs::PaxSapienticaInitSiv3D::secondInit(); } } } diff --git a/Library/PAX_SAPIENTICA/Siv3D/Pulldown.hpp b/Library/PAX_SAPIENTICA/Siv3D/Pulldown.hpp index 03feef798..27870a54a 100644 --- a/Library/PAX_SAPIENTICA/Siv3D/Pulldown.hpp +++ b/Library/PAX_SAPIENTICA/Siv3D/Pulldown.hpp @@ -21,6 +21,7 @@ #include #include +#include #include namespace paxs { @@ -83,10 +84,10 @@ namespace paxs { return itemsa.empty(); } - void update(std::size_t language_index_, paxs::TouchManager& tm_) { + void update(const SelectLanguage& select_language, paxs::TouchManager& tm_) { if (isEmpty()) return; - if (language_index != language_index_) { - language_index = language_index_; + if (language_index != select_language.cget()) { + language_index = select_language.cget(); updateLanguage(); } if (tm_.get(rect.leftClicked())) { @@ -212,10 +213,10 @@ namespace paxs { paxs::PulldownType::One )); } - void update(std::size_t language_index_, paxs::TouchManager& tm_) { + void update(const SelectLanguage& select_language, paxs::TouchManager& tm_) { start_x = 0; for (auto& pd : pdv) { - pd.update(language_index_, tm_); + pd.update(select_language, tm_); pd.setRectX(start_x); start_x += pd.getRect().w; } diff --git a/Library/PAX_SAPIENTICA/Type/Date.hpp b/Library/PAX_SAPIENTICA/Type/Date.hpp deleted file mode 100644 index 1bec899c1..000000000 --- a/Library/PAX_SAPIENTICA/Type/Date.hpp +++ /dev/null @@ -1,182 +0,0 @@ -/*########################################################################################## - - PAX SAPIENTICA Library 💀🌿🌏 - - [Planning] 2023 As Project - [Production] 2023 As Project - [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA - [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ - -##########################################################################################*/ - -#ifndef PAX_SAPIENTICA_TYPE_DATE_HPP -#define PAX_SAPIENTICA_TYPE_DATE_HPP - -/*########################################################################################## - Define a structure that handles the year, month, and day. - 年月日を扱う構造体を定義する。 -##########################################################################################*/ - -// TODO:改修必須 - -#include - -namespace paxs { - - // 暦の出力形式 - enum class DateOutputType { - name_and_ymd // 暦名 & 年月日(例:グレゴリオ暦1年1月1日) - ,name_and_value // 暦名 & 値 - }; - - using DateGengo = std::int_least32_t; - using DateYear = std::int_least32_t; - using DateMonth = std::uint_least8_t; - using DateDay = std::uint_least8_t; - // 較正年代 - class CalBP { - private: - std::int_least32_t day{}; - public: - CalBP() = default; - CalBP(const std::int_least32_t day_) - :day(day_) {} - void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) - void setYear(const DateYear) {} // 何もしない( Variant に用いているため定義) - void setMonth(const DateMonth) {} // 何もしない( Variant に用いているため定義) - void setDay(const std::int_least32_t day_) { day = day_; } - void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) - DateGengo getGengo() { return 0; } - DateYear getYear() { return 0; } - DateMonth getMonth() { return 0; } - std::int_least32_t& getDay() { return day; } - DateGengo cgetGengo() const { return 0; } - DateYear cgetYear() const { return 0; } - DateMonth cgetMonth() const { return 0; } - std::int_least32_t cgetDay() const { return day; } - static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) - static DateOutputType getDateOutputType() { return DateOutputType::name_and_value; } // 暦名&年月日形式( Variant に用いているため定義) - }; - - // 年月日 - class IslamicDate { - private: - DateYear year{}; - DateMonth month{}; - DateDay day{}; - public: - // ヒジュラ暦の日付から絶対年代(日付)を計算 - operator int() { - return (day + 29 * (month - 1) + month / 2 - + 354 * (year - 1) // 前年の閏日以外の日 - + (3 + (11 * year)) / 30 // 前年の閏日 - + 227014); // カレンダーの開始日の前日 - } - - IslamicDate() = default; - IslamicDate(const DateYear year_, const DateMonth month_, const DateDay day_) - :year(year_), month(month_), day(day_) {} - void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) - void setYear(const DateYear year_) { year = year_; } - void setMonth(const DateMonth month_) { month = month_; } - void setDay(const DateDay day_) { day = day_; } - void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) - DateGengo getGengo() const { return 0; } - DateYear& getYear() { return year; } - DateMonth& getMonth() { return month; } - DateDay& getDay() { return day; } - DateGengo cgetGengo() const { return 0; } - DateYear cgetYear() const { return year; } - DateMonth cgetMonth() const { return month; } - DateDay cgetDay() const { return day; } - static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) - static DateOutputType getDateOutputType() { return DateOutputType::name_and_ymd; } // 暦名&年月日形式( Variant に用いているため定義) - }; - - // 年月日 - class GregorianDate { - private: - DateYear year{}; - DateMonth month{}; - DateDay day{}; - public: - GregorianDate() = default; - GregorianDate(const DateYear year_, const DateMonth month_, const DateDay day_) - :year(year_), month(month_), day(day_) {} - void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) - void setYear(const DateYear year_) { year = year_; } - void setMonth(const DateMonth month_) { month = month_; } - void setDay(const DateDay day_) { day = day_; } - void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) - DateGengo getGengo() const { return 0; } - DateYear& getYear() { return year; } - DateMonth& getMonth() { return month; } - DateDay& getDay() { return day; } - DateGengo cgetGengo() const { return 0; } - DateYear cgetYear() const { return year; } - DateMonth cgetMonth() const { return month; } - DateDay cgetDay() const { return day; } - static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) - static DateOutputType getDateOutputType() { return DateOutputType::name_and_ymd; } // 暦名&年月日形式( Variant に用いているため定義) - }; - - // 年月日 - class JulianDate { - private: - DateYear year{}; - DateMonth month{}; - DateDay day{}; - public: - JulianDate() = default; - JulianDate(const DateYear year_, const DateMonth month_, const DateDay day_) - :year(year_), month(month_), day(day_) {} - void setGengo(const DateGengo) const {} // 何もしない( Variant に用いているため定義) - void setYear(const DateYear year_) { year = year_; } - void setMonth(const DateMonth month_) { month = month_; } - void setDay(const DateDay day_) { day = day_; } - void setLeapMonth(const bool) const {} // 何もしない( Variant に用いているため定義) - DateGengo getGengo() const { return 0; } - DateYear& getYear() { return year; } - DateMonth& getMonth() { return month; } - DateDay& getDay() { return day; } - DateGengo cgetGengo() const { return 0; } - DateYear cgetYear() const { return year; } - DateMonth cgetMonth() const { return month; } - DateDay cgetDay() const { return day; } - static bool isLeapMonth() { return false; } // 閏月は必ず無い( Variant に用いているため定義) - static DateOutputType getDateOutputType() { return DateOutputType::name_and_ymd; } // 暦名&年月日形式( Variant に用いているため定義) - }; - - - // 日本の年月日 - class JapanDate { - private: - DateGengo gengo{}; - DateYear year{}; - DateMonth month{}; - DateDay day{}; - bool is_leap_month = false; // 閏月かどうか - public: - JapanDate() = default; - JapanDate(const DateGengo gengo_, const DateYear year_, const DateMonth month_, const DateDay day_, const bool is_leap_month_ = false) - :gengo(gengo_), year(year_), month(month_), day(day_), is_leap_month(is_leap_month_){} - void setGengo(const DateGengo gengo_) { gengo = gengo_; } - void setYear(const DateYear year_) { year = year_; } - void setMonth(const DateMonth month_) { month = month_; } - void setDay(const DateDay day_) { day = day_; } - void setLeapMonth(const bool leap_month_) { is_leap_month = leap_month_; } - DateGengo& getGengo() { return gengo; } - DateYear& getYear() { return year; } - DateMonth& getMonth() { return month; } - DateDay& getDay() { return day; } - DateGengo cgetGengo() const { return gengo; } - DateYear cgetYear() const { return year; } - DateMonth cgetMonth() const { return month; } - DateDay cgetDay() const { return day; } - bool isLeapMonth() const { return is_leap_month; } - static DateOutputType getDateOutputType() { return DateOutputType::name_and_ymd; } // 暦名&年月日形式( Variant に用いているため定義) - }; - -} - -#endif // !PAX_SAPIENTICA_TYPE_DATE_HPP \ No newline at end of file diff --git a/Project/IncludeTest/source/Calendar/CalendarsIncludeTest.cpp b/Project/IncludeTest/source/Calendar/CalendarsIncludeTest.cpp new file mode 100644 index 000000000..8ee8f8ff9 --- /dev/null +++ b/Project/IncludeTest/source/Calendar/CalendarsIncludeTest.cpp @@ -0,0 +1,3 @@ +#include + +int main(){} diff --git a/Project/IncludeTest/source/Type/DateIncludeTest.cpp b/Project/IncludeTest/source/Type/DateIncludeTest.cpp deleted file mode 100644 index 62f8e44f5..000000000 --- a/Project/IncludeTest/source/Type/DateIncludeTest.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include - -int main(){}