Reformatting code style

This commit is contained in:
legatt 2026-02-20 13:02:33 +03:00
parent b94a44c7a4
commit 9e6c5ab38b
32 changed files with 519 additions and 765 deletions

24
.idea/codeStyles/Project.xml generated Normal file
View File

@ -0,0 +1,24 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="AUTODETECT_INDENTS" value="false" />
<RiderCodeStyleSettings>
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=0B82708A1BA7774EB13D27F245698A56/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;1&quot; Title=&quot;Classes and structs&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;__interface&quot; /&gt;&lt;type Name=&quot;class&quot; /&gt;&lt;type Name=&quot;struct&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A42D627FA43B054F91D1E1C4281D8896/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;2&quot; Title=&quot;Concepts&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;concept&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A7EBF16DA3BDCB42A0B710704BC8A053/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;3&quot; Title=&quot;Enums&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;enum&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2229A2BE1AA9214483A51F028530E042/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;4&quot; Title=&quot;Unions&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;union&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=1350D079A82E0740947E85445B5AF47C/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;6&quot; Title=&quot;Parameters&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;function parameter&quot; /&gt;&lt;type Name=&quot;lambda parameter&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=0AFB7787612DF743B09AD9412E48D4CC/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;7&quot; Title=&quot;Local variables&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;local variable&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=72514D5DF422D442B71A277F97B72887/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;8&quot; Title=&quot;Global variables&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;global variable&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=8F69F48E2532F54CBAA0039D4557825E/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;10&quot; Title=&quot;Global functions&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;global function&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=B6E900853D6D05429D8C57765B2E546A/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;11&quot; Title=&quot;Class and struct methods&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;member function&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=B82A063F0DDD98498A70D8D7EBB97F8D/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;12&quot; Title=&quot;Class and struct fields&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;class field&quot; /&gt;&lt;type Name=&quot;struct field&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;_&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=BBE8AA08E662BF409B2CB08EC597C493/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;13&quot; Title=&quot;Class and struct public fields&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;PUBLIC&quot;&gt;&lt;type Name=&quot;class field&quot; /&gt;&lt;type Name=&quot;struct field&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=5653BA7B6222F349B94149A2A53C35B8/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;14&quot; Title=&quot;Union members&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;union member&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=4203BE6F332C5149B409B4D5F7197E54/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;15&quot; Title=&quot;Enumerators&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;scoped enumerator&quot; /&gt;&lt;type Name=&quot;unscoped enumerator&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2B232F1067F0324F8FF4B9D63ACECDB2/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;16&quot; Title=&quot;Other constants&quot;&gt;&lt;Descriptor Static=&quot;True&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;True&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;class field&quot; /&gt;&lt;type Name=&quot;local variable&quot; /&gt;&lt;type Name=&quot;struct field&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=BF0D1AE66D64FE4FAF613448A12051A0/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;17&quot; Title=&quot;Global constants&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;True&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;global variable&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
</RiderCodeStyleSettings>
</code_scheme>
</component>

View File

@ -1,5 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
<option name="PREFERRED_PROJECT_CODE_STYLE" value="EtrediaEmpires" />
</state>
</component>

108
.idea/editor.xml generated
View File

@ -245,101 +245,31 @@
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALLOW_COMMENT_AFTER_LBRACE/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/EMPTY_BLOCK_STYLE/@EntryValue" value="TOGETHER_SAME_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/REQUIRES_EXPRESSION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=0AFB7787612DF743B09AD9412E48D4CC/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;7&quot; Title=&quot;Local variables&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;local variable&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=0B82708A1BA7774EB13D27F245698A56/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;1&quot; Title=&quot;Classes and structs&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;__interface&quot; /&gt;&lt;type Name=&quot;class&quot; /&gt;&lt;type Name=&quot;struct&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=1350D079A82E0740947E85445B5AF47C/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;6&quot; Title=&quot;Parameters&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;function parameter&quot; /&gt;&lt;type Name=&quot;lambda parameter&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2229A2BE1AA9214483A51F028530E042/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;4&quot; Title=&quot;Unions&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;union&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2B232F1067F0324F8FF4B9D63ACECDB2/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;16&quot; Title=&quot;Other constants&quot;&gt;&lt;Descriptor Static=&quot;True&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;True&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;class field&quot; /&gt;&lt;type Name=&quot;local variable&quot; /&gt;&lt;type Name=&quot;struct field&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=4203BE6F332C5149B409B4D5F7197E54/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;15&quot; Title=&quot;Enumerators&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;scoped enumerator&quot; /&gt;&lt;type Name=&quot;unscoped enumerator&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=5653BA7B6222F349B94149A2A53C35B8/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;14&quot; Title=&quot;Union members&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;union member&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=72514D5DF422D442B71A277F97B72887/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;8&quot; Title=&quot;Global variables&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;global variable&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=8F69F48E2532F54CBAA0039D4557825E/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;10&quot; Title=&quot;Global functions&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;global function&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A42D627FA43B054F91D1E1C4281D8896/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;2&quot; Title=&quot;Concepts&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;concept&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A7EBF16DA3BDCB42A0B710704BC8A053/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;3&quot; Title=&quot;Enums&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;enum&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=B6E900853D6D05429D8C57765B2E546A/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;11&quot; Title=&quot;Class and struct methods&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;member function&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=B82A063F0DDD98498A70D8D7EBB97F8D/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;12&quot; Title=&quot;Class and struct fields&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;class field&quot; /&gt;&lt;type Name=&quot;struct field&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;_&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=BBE8AA08E662BF409B2CB08EC597C493/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;13&quot; Title=&quot;Class and struct public fields&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;PUBLIC&quot;&gt;&lt;type Name=&quot;class field&quot; /&gt;&lt;type Name=&quot;struct field&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=BF0D1AE66D64FE4FAF613448A12051A0/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;17&quot; Title=&quot;Global constants&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;True&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;global variable&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
</component>
</project>

View File

@ -3,13 +3,12 @@ import GameData;
import views;
import std;
export namespace ee_assets
{
export namespace ee_assets {
struct AssetData {};
template <typename T> concept Asset = std::is_base_of_v<AssetData, T>;
enum AssetType
{
enum AssetType {
BINARY,
MAP_MESH,
@ -20,8 +19,7 @@ export namespace ee_assets
IMAGE
};
struct AssetBinary : public AssetData
{
struct AssetBinary : public AssetData {
std::uint8_t *content = nullptr;
std::size_t size = 0;
@ -29,8 +27,7 @@ export namespace ee_assets
~AssetBinary();
};
struct AssetMapMesh : public AssetData
{
struct AssetMapMesh : public AssetData {
ee_engine::MapMesh content;
std::uint8_t* Serialize(std::size_t& size);
@ -38,8 +35,7 @@ export namespace ee_assets
AssetMapMesh(std::uint8_t * & source, const std::size_t sourceSize);
};
struct AssetSave : public AssetData
{
struct AssetSave : public AssetData {
ee_data::GameState content;
std::uint8_t* Serialize(std::size_t& size);
@ -49,8 +45,7 @@ export namespace ee_assets
using AssetShader = AssetBinary;
struct AssetMaterial : public AssetData
{
struct AssetMaterial : public AssetData {
std::uint32_t vertexShaderAssetID;
std::uint32_t fragmentShaderAssetID;
};

View File

@ -1,16 +1,13 @@
export module Input;
import std;
export namespace ee_engine
{
struct InputHandlers
{
export namespace ee_engine {
struct InputHandlers {
std::function<void(float dx, float dy)> zooming;
std::function<void(float x, float y, float lastX, float lastY)> mapScroll;
};
class IInput
{
class IInput {
public:
virtual ~IInput() {};
virtual void Poll() = 0;

View File

@ -9,31 +9,25 @@ import views;
import AssetData;
import std;
export namespace ee_engine
{
struct ShaderRefs
{
export namespace ee_engine {
struct ShaderRefs {
ee_assets::AssetShader *vertProvinces;
ee_assets::AssetShader *fragProvinces;
};
struct CameraTransform
{
struct CameraTransform {
glm::vec2 position{0.0f, 0.0f};
float zoom = 1.0f;
};
struct MeshTransform
{
struct MeshTransform {
glm::vec2 position{0.0f, 0.0f};
glm::vec2 scale{1.0f, 1.0f};
float rotation;
};
struct RendererCommand : public ee_utils::WorkerCommand
{
enum Type : std::uint8_t
{
struct RendererCommand : public ee_utils::WorkerCommand {
enum Type : std::uint8_t {
NONE,
UPDATE_REGION,
@ -41,15 +35,17 @@ export namespace ee_engine
COMPLETED
};
struct RegionPayload { std::uint32_t id; ProvinceSSBO data; };
struct RegionPayload {
std::uint32_t id;
ProvinceSSBO data;
};
union {
RegionPayload region;
};
};
class IRenderer : public ee_utils::Worker<RendererCommand, RendererCommand::COMPLETED>
{
class IRenderer : public ee_utils::Worker<RendererCommand, RendererCommand::COMPLETED> {
public:
virtual ~IRenderer();
@ -69,7 +65,6 @@ export namespace ee_engine
glm::vec2 ScreenToWorld(const float screenx, const float screenY);
glm::vec2 ScreenToWorld(const glm::vec2& screenPos);
protected:
bool _isReady;
int screenWidth, screenHeight;
@ -82,7 +77,11 @@ export namespace ee_engine
MapMesh *mapMesh;
ShaderRefs shaders;
struct RegionIndecies {std::size_t startIndex; std::size_t provincesCount;};
struct RegionIndecies {
std::size_t startIndex;
std::size_t provincesCount;
};
std::unordered_map<std::uint32_t /*id*/, RegionIndecies> regionsMapping;
explicit IRenderer(GLFWwindow *window);

View File

@ -5,20 +5,17 @@ module;
export module views:MapView;
import std;
export namespace ee_engine
{
struct MapMesh
{
struct Province
{
export namespace ee_engine {
struct MapMesh {
struct Province {
std::vector<glm::vec2> vertices;
std::vector<std::uint16_t> indices;
};
std::unordered_map<std::uint32_t, std::vector<Province>> regions;
};
struct ProvinceSSBO
{
struct ProvinceSSBO {
std::uint32_t regionId;
std::uint32_t color;
};

View File

@ -14,23 +14,19 @@ TODO: make universal binary format, think about flatbuffers or msgpacks
*/
ee_assets::AssetBinary::AssetBinary(std::uint8_t* &source, const std::size_t sourceSize)
{
ee_assets::AssetBinary::AssetBinary(std::uint8_t * & source, const std::size_t sourceSize) {
content = source;
size = sourceSize;
source = nullptr;
}
ee_assets::AssetBinary::~AssetBinary()
{
ee_assets::AssetBinary::~AssetBinary() {
if (content != nullptr)
DeallocateArray(content);
}
ee_assets::AssetMapMesh::AssetMapMesh(std::uint8_t* &source, const std::size_t sourceSize)
{
ee_assets::AssetMapMesh::AssetMapMesh(std::uint8_t * & source, const std::size_t sourceSize) {
std::uint8_t *buffer = source;
std::uint8_t *pointer = source;
std::size_t leftoverSize = sourceSize;
@ -39,8 +35,7 @@ ee_assets::AssetMapMesh::AssetMapMesh(std::uint8_t* &source, const std::size_t s
std::uint32_t regionsCount = 0;
ee_utils::readNext(&regionsCount, pointer, leftoverSize, sizeof(std::uint32_t));
for (std::uint32_t region = 0; region < regionsCount; region++)
{
for (std::uint32_t region = 0; region < regionsCount; region++) {
std::uint32_t id = 0;
glm::u8vec3 color{};
if (!ee_utils::readNext(&color, pointer, leftoverSize, sizeof(glm::u8vec3)))
@ -52,8 +47,7 @@ ee_assets::AssetMapMesh::AssetMapMesh(std::uint8_t* &source, const std::size_t s
std::uint32_t provincesCount = 0;
ee_utils::readNext(&provincesCount, pointer, leftoverSize, sizeof(std::uint32_t));
for (std::uint32_t pi = 0; pi < provincesCount; pi++)
{
for (std::uint32_t pi = 0; pi < provincesCount; pi++) {
ee_engine::MapMesh::Province prov;
std::uint32_t verticesCount = 0;
@ -61,8 +55,7 @@ ee_assets::AssetMapMesh::AssetMapMesh(std::uint8_t* &source, const std::size_t s
break;
prov.vertices.reserve(verticesCount);
for (std::uint32_t vi = 0; vi < verticesCount; vi++)
{
for (std::uint32_t vi = 0; vi < verticesCount; vi++) {
glm::vec2 vertex;
if (!ee_utils::readNext(&vertex, pointer, leftoverSize, sizeof(glm::vec2)))
break;
@ -75,8 +68,7 @@ ee_assets::AssetMapMesh::AssetMapMesh(std::uint8_t* &source, const std::size_t s
break;
prov.indices.reserve(indicesCount);
for(std::uint32_t ii = 0; ii < indicesCount; ii++)
{
for (std::uint32_t ii = 0; ii < indicesCount; ii++) {
std::uint16_t index = 0;
if (!ee_utils::readNext(&index, pointer, leftoverSize, sizeof(std::uint16_t)))
break;
@ -92,8 +84,7 @@ ee_assets::AssetMapMesh::AssetMapMesh(std::uint8_t* &source, const std::size_t s
}
ee_assets::AssetSave::AssetSave(std::uint8_t* &source, const std::size_t sourceSize)
{
ee_assets::AssetSave::AssetSave(std::uint8_t * & source, const std::size_t sourceSize) {
std::uint8_t *buffer = source;
std::uint8_t *pointer = source;
std::size_t leftoverSize = sourceSize;
@ -102,8 +93,7 @@ ee_assets::AssetSave::AssetSave(std::uint8_t* &source, const std::size_t sourceS
std::uint16_t subjectsCount = static_cast<std::uint16_t>(content.subjects.size());
ee_utils::readNext(&subjectsCount, pointer, leftoverSize, sizeof(std::uint16_t));
for (std::uint16_t i = 0; i < subjectsCount; i++)
{
for (std::uint16_t i = 0; i < subjectsCount; i++) {
ee_data::Subject subject;
ee_utils::readNext(&subject.tag, pointer, leftoverSize, sizeof(subject.tag));
@ -126,16 +116,11 @@ ee_assets::AssetSave::AssetSave(std::uint8_t* &source, const std::size_t sourceS
}
// SERIALIZERS
std::uint8_t* ee_assets::AssetSave::Serialize(std::size_t &size)
{
std::uint8_t* ee_assets::AssetSave::Serialize(std::size_t& size) {
size = sizeof(std::uint16_t);
for (ee_data::Subject &subject : content.subjects)
{
for (ee_data::Subject& subject : content.subjects) {
size += sizeof(subject.tag);
size += sizeof(subject.color);
size += sizeof(std::uint16_t) + subject.regions.size() * sizeof(std::uint32_t);
@ -148,8 +133,7 @@ std::uint8_t* ee_assets::AssetSave::Serialize(std::size_t &size)
std::uint16_t subjectsCount = static_cast<std::uint16_t>(content.subjects.size());
ee_utils::writeNext(pointer, &subjectsCount, leftover, sizeof(std::uint16_t));
for (ee_data::Subject &subject : content.subjects)
{
for (ee_data::Subject& subject : content.subjects) {
ee_utils::writeNext(pointer, &subject.tag, leftover, sizeof(subject.tag));
ee_utils::writeNext(pointer, &subject.color, leftover, sizeof(subject.color));

View File

@ -7,8 +7,7 @@ module Render;
import std;
import utils;
ee_engine::IRenderer::IRenderer(GLFWwindow *window)
{
ee_engine::IRenderer::IRenderer(GLFWwindow *window) {
commandsMapping[RendererCommand::UPDATE_REGION] = std::bind_front(&IRenderer::UpdateRegionCmd, this);
this->window = window;
@ -16,39 +15,30 @@ ee_engine::IRenderer::IRenderer(GLFWwindow *window)
screenAspect = static_cast<float>(screenWidth) / static_cast<float>(screenHeight);
}
ee_engine::IRenderer::~IRenderer()
{
ee_engine::IRenderer::~IRenderer() {}
}
void ee_engine::IRenderer::RegisterMaterials(const ShaderRefs &shaders)
{
void ee_engine::IRenderer::RegisterMaterials(const ShaderRefs& shaders) {
this->shaders = shaders;
}
void ee_engine::IRenderer::RegisterMapMesh(MapMesh* mapMesh)
{
void ee_engine::IRenderer::RegisterMapMesh(MapMesh *mapMesh) {
this->mapMesh = mapMesh;
}
void ee_engine::IRenderer::Draw()
{
void ee_engine::IRenderer::Draw() {
Clear();
DrawMap();
DrawUI();
}
void ee_engine::IRenderer::ResizeWindow(int width, int height)
{
void ee_engine::IRenderer::ResizeWindow(int width, int height) {
screenWidth = width;
screenHeight = height;
screenAspect = static_cast<float>(screenWidth) / static_cast<float>(screenHeight);
}
void ee_engine::IRenderer::SetCamera(const CameraTransform &camera)
{
if (camera.zoom <= 0)
{
void ee_engine::IRenderer::SetCamera(const CameraTransform& camera) {
if (camera.zoom <= 0) {
LOG(WARNING, "Camera zoom cannot be zero or less!");
return;
}
@ -74,13 +64,11 @@ void ee_engine::IRenderer::SetCamera(const CameraTransform &camera)
ApplyCamera();
}
glm::vec2 ee_engine::IRenderer::ScreenToWorld(const float screenX, const float screenY)
{
glm::vec2 ee_engine::IRenderer::ScreenToWorld(const float screenX, const float screenY) {
return ScreenToWorld(glm::vec2(screenX, screenY));
}
glm::vec2 ee_engine::IRenderer::ScreenToWorld(const glm::vec2 &screenPos)
{
glm::vec2 ee_engine::IRenderer::ScreenToWorld(const glm::vec2& screenPos) {
float x = 2.0f * screenPos.x / screenWidth - 1.0f;
float y = -2.0f * screenPos.y / screenHeight + 1.0f;
@ -91,16 +79,13 @@ glm::vec2 ee_engine::IRenderer::ScreenToWorld(const glm::vec2 &screenPos)
return glm::vec2(world) / world.w;
}
void ee_engine::IRenderer::UpdateRegionCmd(ee_engine::RendererCommand &command)
{
if (!regionsMapping.contains(command.region.id))
{
void ee_engine::IRenderer::UpdateRegionCmd(ee_engine::RendererCommand& command) {
if (!regionsMapping.contains(command.region.id)) {
LOG(WARNING, "Updating unregistered region with id: %d", command.region.id);
return;
}
if (command.region.id != command.region.data.regionId)
{
if (command.region.id != command.region.data.regionId) {
LOG(ERROR, "Updating regions ID is not supported! Region: %d Changed ID: %d",
command.region.id, command.region.data.regionId);
}
@ -108,8 +93,7 @@ void ee_engine::IRenderer::UpdateRegionCmd(ee_engine::RendererCommand &command)
RegionIndecies mapping = regionsMapping[command.region.id];
std::vector<ProvinceSSBO> buffer;
buffer.reserve(mapping.provincesCount);
for (std::size_t i = 0; i < mapping.provincesCount; i++)
{
for (std::size_t i = 0; i < mapping.provincesCount; i++) {
buffer.push_back(command.region.data);
}

View File

@ -3,8 +3,7 @@ import Input;
export
{
class Actions
{
class Actions {
public:
static ee_engine::InputHandlers mappings;

View File

@ -12,28 +12,24 @@ import std;
export
{
struct AssetAddress
{
struct AssetAddress {
std::atomic<void*> resource;
};
struct AssetHandle
{
struct AssetHandle {
static constexpr std::uint32_t INVALID_ASSET_ID = UINT32_MAX;
std::size_t slot = 0;
std::uint32_t id = 0;
};
class AssetInfo
{
class AssetInfo {
public:
ee_assets::AssetType type = ee_assets::BINARY;
std::atomic<bool> isReady;
AssetAddress *resourceAddress;
AssetInfo(void *resource)
{
AssetInfo(void *resource) {
this->resourceAddress = Allocate<AssetAddress>();
this->resourceAddress->resource.store(resource);
}
@ -43,18 +39,15 @@ export
AssetInfo(AssetInfo&& other) noexcept :
type(other.type),
resourceAddress(other.resourceAddress)
{
resourceAddress(other.resourceAddress) {
isReady.store(other.isReady.load(std::memory_order_relaxed), std::memory_order_relaxed);
other.resourceAddress = nullptr;
other.isReady.store(false, std::memory_order_relaxed);
}
AssetInfo& operator=(AssetInfo&& other) noexcept
{
if (this != &other)
{
AssetInfo& operator=(AssetInfo&& other) noexcept {
if (this != &other) {
type = other.type;
resourceAddress = other.resourceAddress;
isReady.store(other.isReady.load(std::memory_order_relaxed), std::memory_order_relaxed);
@ -66,17 +59,14 @@ export
}
};
struct AssetLoadingEntry
{
struct AssetLoadingEntry {
AssetHandle handle;
FileHandle *file;
IFileSystem *fileOwner;
};
struct AssetStreamCommand : ee_utils::WorkerCommand
{
enum Type : std::uint8_t
{
struct AssetStreamCommand : ee_utils::WorkerCommand {
enum Type : std::uint8_t {
NONE,
LOAD,
@ -93,11 +83,9 @@ export
std::atomic<void*> *out = nullptr;
};
class AssetManager final : public ee_utils::ThreadedWorker<AssetStreamCommand, AssetStreamCommand::COMPLETED>
{
class AssetManager final : public ee_utils::ThreadedWorker<AssetStreamCommand, AssetStreamCommand::COMPLETED> {
public:
AssetManager() : ThreadedWorker(L"Assets Stream", 250)
{
AssetManager() : ThreadedWorker(L"Assets Stream", 250) {
commandsMapping[AssetStreamCommand::LOAD] = std::bind_front(&AssetManager::LoadCmd, this);
commandsMapping[AssetStreamCommand::FIND] = std::bind_front(&AssetManager::FindCmd, this);
commandsMapping[AssetStreamCommand::GET] = std::bind_front(&AssetManager::GetCmd, this);
@ -105,22 +93,18 @@ export
diskSystem = Allocate<NativeFileSystem>();
}
~AssetManager() override
{
~AssetManager() override {
Deallocate(diskSystem);
}
void LoadDir(ee_assets::AssetType type, const std::filesystem::path &path)
{
for (const std::filesystem::directory_entry &entry : std::filesystem::directory_iterator(path))
{
void LoadDir(ee_assets::AssetType type, const std::filesystem::path& path) {
for (const std::filesystem::directory_entry& entry : std::filesystem::directory_iterator(path)) {
if (entry.is_directory()) continue;
LoadAsync(type, entry.path());
}
}
void LoadAsync(ee_assets::AssetType type, const std::filesystem::path &path)
{
void LoadAsync(ee_assets::AssetType type, const std::filesystem::path& path) {
AssetStreamCommand command;
command.type = AssetStreamCommand::LOAD;
command.targetPath = path;
@ -129,8 +113,7 @@ export
Request(command);
}
AssetHandle& Find(const std::filesystem::path &path)
{
AssetHandle& Find(const std::filesystem::path& path) {
std::atomic<void*> result;
AssetStreamCommand command;
command.type = AssetStreamCommand::FIND;
@ -142,8 +125,7 @@ export
return *reinterpret_cast<AssetHandle*>(command.out->load());
}
AssetHandle& Find(const std::uint32_t id)
{
AssetHandle& Find(const std::uint32_t id) {
std::atomic<void*> result;
AssetStreamCommand command;
command.type = AssetStreamCommand::FIND;
@ -156,29 +138,26 @@ export
}
// Returned resource reference should not be stored
template <ee_assets::Asset T> T& FindOnce(const std::filesystem::path &path)
{
template <ee_assets::Asset T>
T& FindOnce(const std::filesystem::path& path) {
return Get<T>(Find(path));
}
// Returned resource reference should not be stored
template <ee_assets::Asset T> T& FindOnce(const std::uint32_t id)
{
template <ee_assets::Asset T>
T& FindOnce(const std::uint32_t id) {
return Get<T>(Find(id));
}
void Redirect(const AssetHandle &handle, void *resource)
{
void Redirect(const AssetHandle& handle, void *resource) {
const AssetInfo& asset = activeAssets[handle.slot];
if (asset.resourceAddress == nullptr)
{
if (asset.resourceAddress == nullptr) {
LOG(WARNING, "Attempt to redirect empty handle");
return;
}
// TODO: LEAK! Free old resource after redirecting handler to other resource
if (asset.resourceAddress->resource.load() != nullptr)
{
if (asset.resourceAddress->resource.load() != nullptr) {
void *oldResource = asset.resourceAddress->resource.exchange(nullptr, std::memory_order_acq_rel);
//if (oldResource)
//Deallocate(oldResource);
@ -188,8 +167,8 @@ export
}
// Returned resource reference should not be stored
template <ee_assets::Asset T> T& Get(const AssetHandle &handle)
{
template <ee_assets::Asset T>
T& Get(const AssetHandle& handle) {
std::atomic<void*> result;
AssetStreamCommand command;
command.type = AssetStreamCommand::GET;
@ -201,8 +180,7 @@ export
return *reinterpret_cast<T*>(command.out->load());
}
void Free(AssetHandle &handle)
{
void Free(AssetHandle& handle) {
AssetInfo& asset = activeAssets[handle.slot];
Redirect(handle, nullptr);
Deallocate(asset.resourceAddress);
@ -212,18 +190,14 @@ export
}
protected:
void Update() override
{
void Update() override {
// TODO: FinishLoadTasks()
for (AssetLoadingEntry &entry : loadingEntries)
{
for (AssetLoadingEntry& entry : loadingEntries) {
bool isReady = entry.fileOwner->PollReady(*entry.file);
if (isReady)
{
if (isReady) {
AssetInfo& asset = activeAssets[entry.handle.slot];
switch (asset.type)
{
switch (asset.type) {
case ee_assets::MAP_MESH:
FinishLoadConstruct(entry, mapMeshesStorage);
break;
@ -260,13 +234,10 @@ export
});
}
void Release() override
{
for (const AssetInfo &asset : activeAssets)
{
void Release() override {
for (const AssetInfo& asset : activeAssets) {
//TODO: LEAK! Free resource
if (asset.resourceAddress->resource.load() != nullptr)
{
if (asset.resourceAddress->resource.load() != nullptr) {
void *resource = asset.resourceAddress->resource.exchange(nullptr, std::memory_order_acq_rel);
//if (resource)
//Deallocate(resource);
@ -300,8 +271,7 @@ export
std::vector<ee_assets::AssetShader*> shadersStorage;
std::vector<ee_assets::AssetMaterial*> materialsStorage;
void LoadCmd(AssetStreamCommand &command)
{
void LoadCmd(AssetStreamCommand& command) {
LOG(INFO, "LOAD command: [%hs]", command.targetPath.generic_u8string().c_str());
/* TODO: process path to select FS */
@ -317,15 +287,13 @@ export
asset.type = command.targetType;
std::size_t assetPos = 0;
if (freeAssetSlots.size() > 0)
{
if (freeAssetSlots.size() > 0) {
assetPos = freeAssetSlots.back();
Deallocate(activeAssets[assetPos].resourceAddress);
activeAssets[assetPos] = std::move(asset);
freeAssetSlots.pop_back();
}
else
{
else {
activeAssets.push_back(std::move(asset));
assetPos = activeAssets.size() - 1;
}
@ -346,12 +314,11 @@ export
command.type = AssetStreamCommand::COMPLETED;
}
void FindCmd(AssetStreamCommand &command)
{
void FindCmd(AssetStreamCommand& command) {
std::uint32_t id = command.targetId;
if (id == AssetHandle::INVALID_ASSET_ID)
{
std::unordered_map<std::filesystem::path, std::uint32_t>::iterator idMapping = assetsIdMapping.find(command.targetPath);
if (id == AssetHandle::INVALID_ASSET_ID) {
std::unordered_map<std::filesystem::path, std::uint32_t>::iterator idMapping = assetsIdMapping.find(
command.targetPath);
if (idMapping == assetsIdMapping.end())
return;
id = idMapping->second;
@ -368,8 +335,7 @@ export
command.type = AssetStreamCommand::COMPLETED;
}
void GetCmd(AssetStreamCommand &command)
{
void GetCmd(AssetStreamCommand& command) {
if (activeAssets.size() <= command.target.slot)
return;
if (!activeAssets[command.target.slot].isReady)
@ -381,15 +347,15 @@ export
command.type = AssetStreamCommand::COMPLETED;
}
template<ee_assets::Asset T> void FinishLoadConstruct(AssetLoadingEntry &loaded, std::vector<T*> &storage)
{
template <ee_assets::Asset T>
void FinishLoadConstruct(AssetLoadingEntry& loaded, std::vector<T*>& storage) {
T *resource = Allocate<T>(loaded.file->data, loaded.file->size);
storage.push_back(resource);
Redirect(loaded.handle, storage.back());
}
template<ee_assets::Asset T> void FinishLoadPlain(AssetLoadingEntry &loaded, std::vector<T*> &storage)
{
template <ee_assets::Asset T>
void FinishLoadPlain(AssetLoadingEntry& loaded, std::vector<T*>& storage) {
T *resource = Allocate<T>();
if (loaded.file->size < sizeof(T))
LOG(CRITICAL, "File size is less than needed for asset of type: %d", typeid(T).name());
@ -398,10 +364,9 @@ export
Redirect(loaded.handle, storage.back());
}
template<ee_assets::Asset T> void ClearStorage(std::vector<T*> &storage)
{
for (T* &resource : storage)
{
template <ee_assets::Asset T>
void ClearStorage(std::vector<T*>& storage) {
for (T * & resource : storage) {
if (resource != nullptr)
Deallocate(resource);
}

View File

@ -7,10 +7,8 @@ import std;
export
{
struct ClientCommand : public ee_utils::WorkerCommand
{
enum Type : std::uint8_t
{
struct ClientCommand : public ee_utils::WorkerCommand {
enum Type : std::uint8_t {
NONE,
SEND,
@ -19,8 +17,7 @@ export
};
};
class Client final : public ee_utils::ThreadedWorker<ClientCommand, ClientCommand::COMPLETED>
{
class Client final : public ee_utils::ThreadedWorker<ClientCommand, ClientCommand::COMPLETED> {
public:
Client();
~Client() override;

View File

@ -4,21 +4,14 @@ export module DataChannel;
export
{
class IDataChannel
{
class IDataChannel {
public:
// virtual void Request() = 0;
// virtual void Listen() = 0;
// virtual void Mute() = 0;
};
class NetworkChannel final : public IDataChannel
{
class NetworkChannel final : public IDataChannel {};
};
class ThreadChannel final : public IDataChannel
{
};
class ThreadChannel final : public IDataChannel {};
}

View File

@ -12,8 +12,7 @@ import utils;
export
{
class Engine
{
class Engine {
public:
inline static GLFWwindow *window;
inline static ee_engine::IInput *input;
@ -21,13 +20,11 @@ export
inline static ee_engine::IRenderer *renderer;
inline static Client *client;
static void Shutdown()
{
static void Shutdown() {
if (input != nullptr)
Deallocate(input);
if (renderer != nullptr)
{
if (renderer != nullptr) {
renderer->Shutdown();
Deallocate(renderer);
}
@ -41,10 +38,8 @@ export
}
template <ee_utils::IThreadedWorker T>
static void WaitThreadShutdown(T* &thread)
{
if (thread != nullptr)
{
static void WaitThreadShutdown(T * & thread) {
if (thread != nullptr) {
thread->Shutdown();
while (thread->isRunning.load()) {}
Deallocate(thread);

View File

@ -64,6 +64,5 @@ export
void Close(FileHandle& file) override;
private:
};
}

View File

@ -5,9 +5,9 @@ module;
export module GLFWInput;
import Input;
export {
class GLFWInput final : public ee_engine::IInput
export
{
class GLFWInput final : public ee_engine::IInput {
public:
GLFWInput(ee_engine::InputHandlers handlers);

View File

@ -10,15 +10,13 @@ ee_engine::InputHandlers Actions::mappings {
.mapScroll = MapScroll
};
void Actions::Zoom(float dx, float dy)
{
void Actions::Zoom(float dx, float dy) {
ee_engine::CameraTransform cam = Engine::renderer->getCamera();
cam.zoom *= pow(1.1f, -dy);
Engine::renderer->SetCamera(cam);
}
void Actions::MapScroll(float x, float y, float lastX, float lastY)
{
void Actions::MapScroll(float x, float y, float lastX, float lastY) {
ee_engine::CameraTransform cam = Engine::renderer->getCamera();
glm::vec2 pos = Engine::renderer->ScreenToWorld(x, y);

View File

@ -3,15 +3,12 @@ import utils;
import views;
import Engine;
Client::Client() : ThreadedWorker(L"Client", 0)
{
Client::Client() : ThreadedWorker(L"Client", 0) {
commandsMapping[ClientCommand::SEND] = std::bind_front(&Client::SendCmd, this);
}
void Client::Init()
{
if (Engine::renderer == nullptr || !Engine::renderer->isReady())
{
void Client::Init() {
if (Engine::renderer == nullptr || !Engine::renderer->isReady()) {
LOG(CRITICAL, "Renderer is not ready. Client cannot be created");
throw std::logic_error("Renderer is not ready");
}
@ -22,47 +19,33 @@ void Client::Init()
ViewModelSubject(asset.content.subjects[1]);
}
const IDataChannel* Client::GetConnection()
{
const IDataChannel* Client::GetConnection() {
return networkConnection;
}
void Client::ConnectServer()
{
void Client::ConnectServer() {
if (networkConnection != nullptr)
Deallocate(networkConnection);
networkConnection = Allocate<NetworkChannel>();
}
void Client::LoadSave(const AssetHandle save)
{
void Client::LoadSave(const AssetHandle save) {
this->save = save;
}
void Client::Update()
{
void Client::Update() {}
}
void Client::Release()
{
}
void Client::SendCmd(ClientCommand &command)
{
void Client::Release() {}
void Client::SendCmd(ClientCommand& command) {
command.type = ClientCommand::COMPLETED;
}
void Client::ViewModelSubject(ee_data::Subject subject)
{
for (const std::uint32_t region : subject.regions)
{
void Client::ViewModelSubject(ee_data::Subject subject) {
for (const std::uint32_t region : subject.regions) {
ee_engine::ProvinceSSBO vm{
.regionId = region,
.color = subject.color
@ -77,9 +60,7 @@ void Client::ViewModelSubject(ee_data::Subject subject)
}
Client::~Client()
{
Client::~Client() {
if (networkConnection != nullptr)
Deallocate(networkConnection);
}

View File

@ -7,8 +7,7 @@ import utils;
//TOO: REWORK WITH IOCP
IFileSystem::~IFileSystem()
{
IFileSystem::~IFileSystem() {
for (FileHandle *handle : activeFiles)
Deallocate(handle);
for (FileHandle *handle : failedFiles)
@ -17,8 +16,7 @@ IFileSystem::~IFileSystem()
#ifdef _WIN32
FileHandle& NativeFileSystem::Open(const std::filesystem::path &path, const std::uint32_t flags)
{
FileHandle& NativeFileSystem::Open(const std::filesystem::path& path, const std::uint32_t flags) {
FileHandle *result = Allocate<FileHandle>();
#ifndef NDEBUG
@ -42,8 +40,7 @@ FileHandle& NativeFileSystem::Open(const std::filesystem::path &path, const std:
NULL
);
if (file == INVALID_HANDLE_VALUE)
{
if (file == INVALID_HANDLE_VALUE) {
LOG(ERROR, "Failed to open file %s. Error: %d", path.c_str(), GetLastError());
failedFiles.push_back(result);
return *result;
@ -54,15 +51,13 @@ FileHandle& NativeFileSystem::Open(const std::filesystem::path &path, const std:
if (result->size == INVALID_FILE_SIZE)
LOG(ERROR, "Failed to get size of file %s. Error: %d", path.c_str(), GetLastError());
if (freeFileSlots.size() > 0)
{
if (freeFileSlots.size() > 0) {
std::size_t pos = freeFileSlots.back();
result->id = pos;
activeFiles[pos] = result;
freeFileSlots.pop_back();
}
else
{
else {
result->id = activeFiles.size();
activeFiles.push_back(result);
}
@ -70,8 +65,7 @@ FileHandle& NativeFileSystem::Open(const std::filesystem::path &path, const std:
return *result;
}
void NativeFileSystem::ReadAsync(FileHandle &file, const std::uint32_t bufferSize, const std::uint32_t flags)
{
void NativeFileSystem::ReadAsync(FileHandle& file, const std::uint32_t bufferSize, const std::uint32_t flags) {
file.overlapped = {
.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)
};
@ -90,21 +84,17 @@ void NativeFileSystem::ReadAsync(FileHandle &file, const std::uint32_t bufferSiz
LOG(ERROR, "File reading is synchronious while asynchronious is awaited");
}
bool NativeFileSystem::PollReady(FileHandle &file)
{
bool NativeFileSystem::PollReady(FileHandle& file) {
DWORD status = WaitForSingleObject(file.overlapped.hEvent, 0);
switch (status)
{
switch (status) {
case WAIT_OBJECT_0:
{
if (file.size == file.bufferSize)
{
if (file.size == file.bufferSize) {
file.data = file.buffer;
file.buffer = nullptr;
}
else
{
else {
/* TODO: reserve size for data, shift and move */
}
@ -125,24 +115,20 @@ bool NativeFileSystem::PollReady(FileHandle &file)
return true;
}
void NativeFileSystem::Close(FileHandle &file)
{
void NativeFileSystem::Close(FileHandle& file) {
if (file.overlapped.hEvent)
CloseHandle(file.overlapped.hEvent);
if (file.buffer != nullptr)
{
if (file.buffer != nullptr) {
DeallocateArray(file.buffer);
file.buffer = nullptr;
}
if (file.data != nullptr)
{
if (file.data != nullptr) {
DeallocateArray(file.data);
file.data = nullptr;
}
if (file.win32Handle != INVALID_HANDLE_VALUE)
{
if (file.win32Handle != INVALID_HANDLE_VALUE) {
CloseHandle(file.win32Handle);
file.win32Handle = INVALID_HANDLE_VALUE;
}
@ -154,5 +140,4 @@ void NativeFileSystem::Close(FileHandle &file)
#ifdef __linux__
#endif

View File

@ -9,8 +9,7 @@ module GLFWInput;
import Engine;
import utils;
GLFWInput::GLFWInput(ee_engine::InputHandlers handlers) : ee_engine::IInput(handlers)
{
GLFWInput::GLFWInput(ee_engine::InputHandlers handlers) : ee_engine::IInput(handlers) {
glfwSetWindowUserPointer(Engine::window, this);
glfwSetScrollCallback(Engine::window, [](GLFWwindow *window, double dx, double dy) {
GLFW_CALLBACK(zooming, static_cast<float>(dx), static_cast<float>(dy));
@ -19,8 +18,7 @@ GLFWInput::GLFWInput(ee_engine::InputHandlers handlers) : ee_engine::IInput(hand
LOG(INFO, "Input mappings initialized");
}
void GLFWInput::Poll()
{
void GLFWInput::Poll() {
double mouseX, mouseY;
glfwGetCursorPos(Engine::window, &mouseX, &mouseY);
this->mouseX = static_cast<float>(mouseX);
@ -41,10 +39,8 @@ void GLFWInput::Poll()
void GLFWInput::OnLeftMouseButton(int state) {}
void GLFWInput::OnRightMouseButton(int state) {}
void GLFWInput::OnMiddleMouseButton(int state)
{
switch(state)
{
void GLFWInput::OnMiddleMouseButton(int state) {
switch (state) {
case GLFW_PRESS:
{
handlers.mapScroll(mouseX, mouseY, lastMouseX, lastMouseY);

View File

@ -9,8 +9,7 @@ import MagnumRender;
import GLFWInput;
import std;
int main(int argc, char **argv)
{
int main(int argc, char **argv) {
// Setup P7 logger
Logger::Init(P7_SINK P7_LOGS_PATH);
Logger::RegisterThread(L"Main");
@ -54,8 +53,10 @@ int main(int argc, char **argv)
//TODO: ShaderRefs builder from set of AssetMaterial
ee_assets::AssetMaterial& provincesMaterial =
Engine::assetManager->FindOnce<ee_assets::AssetMaterial>("assets/materials/provinces.mat");
ee_assets::AssetShader &vertProv = Engine::assetManager->FindOnce<ee_assets::AssetShader>(provincesMaterial.vertexShaderAssetID);
ee_assets::AssetShader &fragProv = Engine::assetManager->FindOnce<ee_assets::AssetShader>(provincesMaterial.fragmentShaderAssetID);
ee_assets::AssetShader& vertProv = Engine::assetManager->FindOnce<ee_assets::AssetShader>(
provincesMaterial.vertexShaderAssetID);
ee_assets::AssetShader& fragProv = Engine::assetManager->FindOnce<ee_assets::AssetShader>(
provincesMaterial.fragmentShaderAssetID);
Engine::renderer->RegisterMaterials({
.vertProvinces = &vertProv,
.fragProvinces = &fragProv
@ -80,8 +81,7 @@ int main(int argc, char **argv)
// Game loop
ee_engine::RendererCommand renderCmdBuffer;
while(!glfwWindowShouldClose(window))
{
while (!glfwWindowShouldClose(window)) {
Engine::renderer->ProcessQueue(renderCmdBuffer);
Engine::renderer->Draw();

View File

@ -12,10 +12,8 @@ import std;
using namespace Magnum;
export namespace ee_magnum
{
class BaseMaterial : public GL::AbstractShaderProgram
{
export namespace ee_magnum {
class BaseMaterial : public GL::AbstractShaderProgram {
public:
inline static constexpr std::int32_t CAMERA_BINDING = 1;
//TODO: push constant
@ -28,8 +26,7 @@ export namespace ee_magnum
explicit BaseMaterial(const std::string& vertSrc, const std::string& fragSrc);
};
class ProvinceMaterial final : public BaseMaterial
{
class ProvinceMaterial final : public BaseMaterial {
public:
inline static constexpr std::int32_t PROVINCES_DATA_BINDING = 0;
inline static constexpr std::int32_t PROVINCES_ID_BINDING = 3;

View File

@ -15,10 +15,8 @@ import std;
using namespace Magnum;
export namespace ee_magnum
{
class MagnumRenderer final : public ee_engine::IRenderer
{
export namespace ee_magnum {
class MagnumRenderer final : public ee_engine::IRenderer {
public:
MagnumRenderer(GLFWwindow *window);
~MagnumRenderer();
@ -33,7 +31,8 @@ export namespace ee_magnum
void ApplyCamera() override;
virtual void UpdateProvinces(const std::size_t index, const std::vector<ee_engine::ProvinceSSBO> &data) override;
virtual void
UpdateProvinces(const std::size_t index, const std::vector<ee_engine::ProvinceSSBO>& data) override;
private:
Platform::GLContext context;

View File

@ -12,8 +12,7 @@ module MagnumRender;
import :Materials;
import utils;
ee_magnum::BaseMaterial::BaseMaterial(const std::string &vertSrc, const std::string &fragSrc)
{
ee_magnum::BaseMaterial::BaseMaterial(const std::string& vertSrc, const std::string& fragSrc) {
GL::Shader vert{GL::Version::GL430, GL::Shader::Type::Vertex};
GL::Shader frag{GL::Version::GL430, GL::Shader::Type::Fragment};
@ -31,22 +30,17 @@ ee_magnum::BaseMaterial::BaseMaterial(const std::string &vertSrc, const std::str
link();
}
void ee_magnum::BaseMaterial::setModel(const Matrix4 &m)
{
void ee_magnum::BaseMaterial::setModel(const Matrix4& m) {
setUniform(TRANSFORM_BINDING, m);
}
void ee_magnum::BaseMaterial::setViewProjection(const Matrix4 &vp)
{
void ee_magnum::BaseMaterial::setViewProjection(const Matrix4& vp) {
setUniform(CAMERA_BINDING, vp);
}
ee_magnum::ProvinceMaterial::ProvinceMaterial(const std::string &vertSrc, const std::string &fragSrc): BaseMaterial(vertSrc, fragSrc)
{
ee_magnum::ProvinceMaterial::ProvinceMaterial(const std::string& vertSrc, const std::string& fragSrc) : BaseMaterial(
vertSrc, fragSrc) {}
}
void ee_magnum::ProvinceMaterial::setId(const uint32_t id)
{
void ee_magnum::ProvinceMaterial::setId(const uint32_t id) {
setUniform(PROVINCES_ID_BINDING, id);
}

View File

@ -18,15 +18,13 @@ import utils;
using namespace Math::Literals;
ee_magnum::MagnumRenderer::MagnumRenderer(GLFWwindow *window) : IRenderer(window)
{
ee_magnum::MagnumRenderer::MagnumRenderer(GLFWwindow *window) : IRenderer(window) {
ValidateSupport();
LOG(INFO, "Renderer created");
}
void ee_magnum::MagnumRenderer::Init()
{
void ee_magnum::MagnumRenderer::Init() {
LOG(INFO, "GLSL version: %d", GL::Context::current().version());
LoadShaders();
@ -36,41 +34,30 @@ void ee_magnum::MagnumRenderer::Init()
LOG(INFO, "Renderer initialized");
}
void ee_magnum::MagnumRenderer::Clear()
{
void ee_magnum::MagnumRenderer::Clear() {
GL::defaultFramebuffer.clear(GL::FramebufferClear::Color);
}
void ee_magnum::MagnumRenderer::DrawMap()
{
void ee_magnum::MagnumRenderer::DrawMap() {
ApplyCamera();
for (std::uint32_t i = 0; i < provinceMeshes.size(); i++)
{
for (std::uint32_t i = 0; i < provinceMeshes.size(); i++) {
provinceMaterial->setId(i);
provinceMaterial->draw(provinceMeshes[i]);
}
}
void ee_magnum::MagnumRenderer::DrawUI()
{
void ee_magnum::MagnumRenderer::DrawUI() {}
}
void ee_magnum::MagnumRenderer::ValidateSupport() {}
void ee_magnum::MagnumRenderer::ValidateSupport()
{
}
void ee_magnum::MagnumRenderer::ApplyCamera()
{
void ee_magnum::MagnumRenderer::ApplyCamera() {
Matrix4 viewProjection{Magnum::NoInit};
std::memcpy(viewProjection.data(), glm::value_ptr(this->viewProjection), sizeof(float) * 16);
provinceMaterial->setViewProjection(viewProjection);
}
void ee_magnum::MagnumRenderer::LoadShaders()
{
void ee_magnum::MagnumRenderer::LoadShaders() {
provinceMaterial = Allocate<ProvinceMaterial>(std::string(
reinterpret_cast<const char*>(shaders.vertProvinces->content),
shaders.vertProvinces->size
@ -82,15 +69,12 @@ void ee_magnum::MagnumRenderer::LoadShaders()
LOG(INFO, "Shaders loaded");
}
void ee_magnum::MagnumRenderer::LoadProvinces()
{
void ee_magnum::MagnumRenderer::LoadProvinces() {
std::vector<ee_engine::ProvinceSSBO> provincesData;
std::size_t regionIndex = 0;
for (auto& [region, provs]: mapMesh->regions)
{
for (ee_engine::MapMesh::Province &province: provs)
{
for (auto& [region, provs] : mapMesh->regions) {
for (ee_engine::MapMesh::Province& province : provs) {
GL::Mesh regionMesh;
Containers::ArrayView provinceVertices(province.vertices.data(), province.vertices.size());
@ -121,17 +105,15 @@ void ee_magnum::MagnumRenderer::LoadProvinces()
Containers::ArrayView provincesDataView(provincesData.data(), provincesData.size());
provinceSSBO.setData(provincesDataView, GL::BufferUsage::DynamicDraw);
provinceSSBO.bind(GL::Buffer::Target::ShaderStorage, ProvinceMaterial::PROVINCES_DATA_BINDING);
}
void ee_magnum::MagnumRenderer::UpdateProvinces(const std::size_t index, const std::vector<ee_engine::ProvinceSSBO> &data)
{
void ee_magnum::MagnumRenderer::UpdateProvinces(const std::size_t index,
const std::vector<ee_engine::ProvinceSSBO>& data) {
Containers::ArrayView provincesData(data.data(), data.size());
provinceSSBO.setSubData(index, provincesData);
}
void ee_magnum::MagnumRenderer::Shutdown()
{
void ee_magnum::MagnumRenderer::Shutdown() {
provinceMeshes.clear();
provinceSSBO = GL::Buffer{NoCreate};
if (provinceMaterial != nullptr)
@ -139,7 +121,4 @@ void ee_magnum::MagnumRenderer::Shutdown()
provinceMaterial = nullptr;
}
ee_magnum::MagnumRenderer::~MagnumRenderer()
{
}
ee_magnum::MagnumRenderer::~MagnumRenderer() {}

View File

@ -1,24 +1,25 @@
export module utils:allocator;
import std;
export {
template<typename T, typename... Args> T* Allocate(Args&&... args)
export
{
template <typename T, typename... Args>
T* Allocate(Args&&... args) {
return new T(std::forward<Args>(args)...);
}
template<typename T> void Deallocate(T* obj)
{
template <typename T>
void Deallocate(T *obj) {
delete obj;
}
template<typename T> T* AllocateArray(std::size_t size)
{
template <typename T>
T* AllocateArray(std::size_t size) {
return new T[size];
}
template<typename T> void DeallocateArray(T* obj)
{
template <typename T>
void DeallocateArray(T *obj) {
delete[] obj;
}
}

View File

@ -1,8 +1,7 @@
export module utils:buffers;
import std;
export namespace ee_utils
{
export namespace ee_utils {
bool readNext(void *dst, std::uint8_t * & srcPointer, std::size_t& srcLeftoverSize, const std::size_t readSize);
bool writeNext(std::uint8_t * & dstPointer, void *src, std::size_t& dstLeftoverSize, const std::size_t writeSize);
}

View File

@ -5,8 +5,7 @@ module;
export module utils:lockfree;
export namespace boost
{
export namespace boost {
using lockfree::capacity;
using lockfree::queue;

View File

@ -7,29 +7,24 @@ module;
export module utils:logger;
import std;
namespace logger
{
namespace logger {
template <std::size_t length>
struct wstring
{
struct wstring {
wchar_t content[length];
constexpr operator const wchar_t*() const { return content; }
explicit constexpr wstring(const char (&str)[length]) : content{}
{
explicit constexpr wstring(const char (&str)[length]) : content{} {
for (std::size_t i = 0; i < length; i++)
content[i] = static_cast<wchar_t>(str[i]);
}
};
template <std::size_t length>
constexpr wstring<length> TM(const char (&str)[length])
{
constexpr wstring<length> TM(const char (&str)[length]) {
return wstring<length>(str);
}
enum LogLevel : std::uint8_t
{
enum LogLevel : std::uint8_t {
TRACE,
DEBUG,
INFO,
@ -41,15 +36,13 @@ namespace logger
class Logger;
template <typename... Args>
struct LOG_WCHAR
{
struct LOG_WCHAR {
LOG_WCHAR(
LogLevel level,
const wchar_t *format,
Args&&... args,
const std::source_location& location = std::source_location::current()
)
{
) {
Logger::trace->Trace(
0,
static_cast<eP7Trace_Level>(level),
@ -65,15 +58,13 @@ namespace logger
// Notice: logging char string supports only ASCII, use LOG_WCHAR with wchar string for UTF-8
template <std::size_t length, typename... Args>
struct LOG
{
struct LOG {
LOG(
LogLevel level,
const char (&format)[length],
Args&&... args,
const std::source_location& location = std::source_location::current()
)
{
) {
Logger::trace->Trace(
0,
static_cast<eP7Trace_Level>(level),
@ -87,18 +78,17 @@ namespace logger
}
};
template <typename... Args> LOG_WCHAR(LogLevel, const wchar_t*, Args&&...) -> LOG_WCHAR<Args...>;
template <std::size_t length, typename... Args> LOG(LogLevel, const char (&)[length], Args&&...) -> LOG<length, Args...>;
template <typename... Args>
LOG_WCHAR(LogLevel, const wchar_t *, Args&&...) -> LOG_WCHAR<Args...>;
template <std::size_t length, typename... Args>
LOG(LogLevel, const char (&)[length], Args&&...) -> LOG<length, Args...>;
class Logger
{
class Logger {
public:
Logger() = delete;
static void Init(const wchar_t *options)
{
if (isReady)
{
static void Init(const wchar_t *options) {
if (isReady) {
LOG_WCHAR(WARNING, L"Logger already initialized.");
return;
}
@ -110,18 +100,16 @@ namespace logger
isReady = true;
}
static void Release()
{
static void Release() {
trace->Release();
client->Release();
}
static void RegisterThread(const wchar_t *name)
{
static void RegisterThread(const wchar_t *name) {
trace->Register_Thread(name, 0);
}
static void UnregisterThread()
{
static void UnregisterThread() {
trace->Unregister_Thread(0);
}
@ -131,10 +119,11 @@ namespace logger
inline static bool isReady = false;
template <typename... Args> friend struct LOG_WCHAR;
template <std::size_t length, typename... Args> friend struct LOG;
template <typename... Args>
friend struct LOG_WCHAR;
template <std::size_t length, typename... Args>
friend struct LOG;
};
}
export using logger::Logger;

View File

@ -3,50 +3,42 @@ export module utils:worker;
import :logger;
import std;
export namespace ee_utils
{
struct WorkerCommand
{
export namespace ee_utils {
struct WorkerCommand {
std::uint8_t type = 0;
};
template <typename T> concept IWorkerCommand = std::is_base_of_v<WorkerCommand, T>;
template <IWorkerCommand TCommand, std::size_t MaxCmdTypeId, bool IdleDetection = false>
class Worker
{
class Worker {
public:
void Request(const TCommand &command)
{
void Request(const TCommand& command) {
commands.push(command); //TODO: filled queue case
}
void Request(const std::uint8_t type)
{
void Request(const std::uint8_t type) {
commands.push(TCommand{.type = type}); //TODO: filled queue case
}
void ProcessQueue(TCommand &buffer) requires !IdleDetection
{
while (this->commands.pop(buffer))
{
void ProcessQueue(TCommand& buffer) requires !IdleDetection {
while (this->commands.pop(buffer)) {
ProcessCommand(buffer);
}
}
std::uint32_t ProcessQueue(TCommand &buffer) requires IdleDetection
{
std::uint32_t ProcessQueue(TCommand& buffer) requires IdleDetection {
thread_local std::uint32_t idleCounter = 0;
if (!this->commands.pop(buffer))
{
if (!this->commands.pop(buffer)) {
idleCounter++;
return idleCounter;
}
idleCounter = 0;
do
{
do {
ProcessCommand(buffer);
} while (this->commands.pop(buffer));
}
while (this->commands.pop(buffer));
return 0;
}
@ -59,10 +51,8 @@ export namespace ee_utils
Worker() {};
void ProcessCommand(TCommand &command)
{
if (command.type > MaxCmdTypeId || !commandsMapping[command.type])
{
void ProcessCommand(TCommand& command) {
if (command.type > MaxCmdTypeId || !commandsMapping[command.type]) {
LOG(WARNING, "Unhandled command. Type id: %d", command.type);
command.type = MaxCmdTypeId;
return;
@ -78,10 +68,8 @@ export namespace ee_utils
virtual ~ThreadedWorkerBase() {}
void Start()
{
if (isRunning.load())
{
void Start() {
if (isRunning.load()) {
LOG(CRITICAL, "Thread can be started only once before stop");
throw std::logic_error("Thread can be started only once before stop");
}
@ -93,8 +81,7 @@ export namespace ee_utils
});
}
void Shutdown()
{
void Shutdown() {
if (isRunning.load())
thread.request_stop();
else LOG(WARNING, "Tried to shutdown stopped thread");
@ -106,28 +93,27 @@ export namespace ee_utils
virtual void Threading() = 0;
};
template <typename T> concept IThreadedWorker = std::is_base_of_v<ThreadedWorkerBase, T>;
enum class IdleBackoffMode : std::uint8_t
{
enum class IdleBackoffMode : std::uint8_t {
DISABLED,
YIELD
};
template <IWorkerCommand TCommand, std::size_t MaxCmdType, IdleBackoffMode IdleBackoffMode = IdleBackoffMode::DISABLED>
class ThreadedWorker : public Worker<TCommand, MaxCmdType, static_cast<bool>(IdleBackoffMode)>, public ThreadedWorkerBase
{
template <IWorkerCommand TCommand, std::size_t MaxCmdType, IdleBackoffMode IdleBackoffMode =
IdleBackoffMode::DISABLED>
class ThreadedWorker : public Worker<TCommand, MaxCmdType, static_cast<bool>(IdleBackoffMode)>,
public ThreadedWorkerBase {
protected:
const wchar_t *threadName;
explicit ThreadedWorker(const wchar_t *threadName, std::uint32_t yieldIdleTime = 0)
{
explicit ThreadedWorker(const wchar_t *threadName, std::uint32_t yieldIdleTime = 0) {
this->threadName = threadName;
this->yieldIdleTime = yieldIdleTime;
}
void Threading()
{
void Threading() {
Logger::RegisterThread(threadName);
LOG(INFO, "Thread started");
@ -136,17 +122,13 @@ export namespace ee_utils
ReleaseStop();
}
void Loop()
{
void Loop() {
TCommand commandBuffer{};
while (!stoken->stop_requested())
{
if constexpr (IdleBackoffMode == IdleBackoffMode::DISABLED)
{
while (!stoken->stop_requested()) {
if constexpr (IdleBackoffMode == IdleBackoffMode::DISABLED) {
this->ProcessQueue(commandBuffer);
}
else
{
else {
const std::uint32_t idleCounter = this->ProcessQueue(commandBuffer);
if (idleCounter > yieldIdleTime)
@ -163,8 +145,7 @@ export namespace ee_utils
private:
std::uint32_t yieldIdleTime;
void ReleaseStop()
{
void ReleaseStop() {
Release();
LOG(INFO, "Thread is released");
Logger::UnregisterThread();

View File

@ -1,10 +1,9 @@
module utils;
import :buffers;
bool ee_utils::readNext(void* dst, std::uint8_t* &srcPointer, std::size_t &srcLeftoverSize, const std::size_t readSize)
{
if (srcLeftoverSize >= readSize)
{
bool ee_utils::readNext(void *dst, std::uint8_t * & srcPointer, std::size_t& srcLeftoverSize,
const std::size_t readSize) {
if (srcLeftoverSize >= readSize) {
srcLeftoverSize -= readSize;
std::memcpy(dst, srcPointer, readSize);
srcPointer += readSize;
@ -15,10 +14,9 @@ bool ee_utils::readNext(void* dst, std::uint8_t* &srcPointer, std::size_t &srcLe
return false;
}
bool ee_utils::writeNext(std::uint8_t* &dstPointer, void* src, std::size_t &dstLeftoverSize, const std::size_t writeSize)
{
if (dstLeftoverSize >= writeSize)
{
bool ee_utils::writeNext(std::uint8_t * & dstPointer, void *src, std::size_t& dstLeftoverSize,
const std::size_t writeSize) {
if (dstLeftoverSize >= writeSize) {
dstLeftoverSize -= writeSize;
std::memcpy(dstPointer, src, writeSize);
dstPointer += writeSize;