inkcpp_rb 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +84 -0
- data/LICENSE +7 -0
- data/README.md +3 -0
- data/Rakefile +16 -0
- data/bin/console +15 -0
- data/bin/setup +10 -0
- data/bin/tapioca +29 -0
- data/ext/inkcpp_rb/extconf.rb +19 -0
- data/ext/inkcpp_rb/inkcpp/.clang-format +99 -0
- data/ext/inkcpp_rb/inkcpp/.github/FUNDING.yml +1 -0
- data/ext/inkcpp_rb/inkcpp/.github/workflows/build.yml +344 -0
- data/ext/inkcpp_rb/inkcpp/.github/workflows/release.yml +49 -0
- data/ext/inkcpp_rb/inkcpp/.gitignore +25 -0
- data/ext/inkcpp_rb/inkcpp/.gitmodules +9 -0
- data/ext/inkcpp_rb/inkcpp/CMakeLists.txt +170 -0
- data/ext/inkcpp_rb/inkcpp/CODE_OF_CONDUCT.md +76 -0
- data/ext/inkcpp_rb/inkcpp/CONTRIBUTING.md +55 -0
- data/ext/inkcpp_rb/inkcpp/Config.cmake.in +2 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/CMakeLists.txt +13 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/main.c +38 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/main.cpp +40 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/test.ink +8 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example/test.ink.json +1 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/cmake_example.zip +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/InkCPP_DEMO.zip +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/CreateThread.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/HandleChoice.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/ListElementOf.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/MinimalRuntime.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/MinimalThread.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/ObseverChange.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/TagListGetValue.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Documentation/unreal/imgs/YieldResume.png +0 -0
- data/ext/inkcpp_rb/inkcpp/Doxyfile +2825 -0
- data/ext/inkcpp_rb/inkcpp/LICENSE.txt +22 -0
- data/ext/inkcpp_rb/inkcpp/Minimal.runsettings +8 -0
- data/ext/inkcpp_rb/inkcpp/README.md +192 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/CMakeLists.txt +67 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/array.h +481 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/avl_array.h +833 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/casting.h +93 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/choice.cpp +54 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/collections/restorable.cpp +124 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/collections/restorable.h +406 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/container_operations.cpp +52 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/container_operations.h +34 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/executioner.h +179 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/functional.cpp +86 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/functions.cpp +54 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/functions.h +40 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/globals_impl.cpp +289 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/globals_impl.h +149 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/header.cpp +44 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/choice.h +106 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/functional.h +327 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/globals.h +196 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/list.h +187 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/runner.h +291 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/snapshot.h +61 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/story.h +219 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/story_ptr.h +233 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/traits.h +270 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/include/types.h +169 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_impl.cpp +79 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_impl.h +39 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_operations.cpp +276 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_operations.h +356 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_table.cpp +841 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/list_table.h +450 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/numeric_operations.cpp +40 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/numeric_operations.h +529 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/operation_bases.h +164 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/operations.h +100 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/output.cpp +528 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/output.h +153 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/platform.h +22 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/random.h +38 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/runner_impl.cpp +1396 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/runner_impl.h +336 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/simple_restorable_stack.h +335 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/snapshot_impl.cpp +182 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/snapshot_impl.h +91 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/snapshot_interface.h +57 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/stack.cpp +618 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/stack.h +243 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/story_impl.cpp +361 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/story_impl.h +92 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/story_ptr.cpp +75 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_operations.cpp +125 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_operations.h +67 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_table.cpp +149 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_table.h +47 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/string_utils.h +207 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/system.cpp +39 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/tuple.hpp +151 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/value.cpp +279 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp/value.h +666 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/CMakeLists.txt +62 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/include/inkcpp.h +393 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/inkcpp.cpp +344 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/inkcpp_c.pc.in +10 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/ExternalFunction.c +56 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Globals.c +98 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Lists.c +73 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Observer.c +36 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_c/tests/Snapshot.c +65 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_cl/CMakeLists.txt +49 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_cl/inkcpp_cl.cpp +215 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_cl/test.cpp +209 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_cl/test.h +8 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/CMakeLists.txt +37 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_emitter.cpp +446 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_emitter.h +70 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_stream.cpp +166 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/binary_stream.h +79 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/command.cpp +107 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/compiler.cpp +96 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.cpp +62 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.h +104 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/include/compilation_results.h +22 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/include/compiler.h +44 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/json.hpp +24596 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/json_compiler.cpp +411 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/json_compiler.h +62 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/list_data.cpp +47 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/list_data.h +70 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/reporter.cpp +107 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_compiler/reporter.h +55 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/CMakeLists.txt +19 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/example.py +78 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/src/module.cpp +317 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/conftest.py +53 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_ExternalFunctions.py +35 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Globals.py +40 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Lists.py +43 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Observer.py +27 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_Snapshot.py +57 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_py/unreal_example.ink +71 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Array.cpp +115 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/CMakeLists.txt +117 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Callstack.cpp +392 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/EmptyStringForDivert.cpp +36 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ExternalFunctionsExecuteProperly.cpp +34 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/FallbackFunction.cpp +77 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Globals.cpp +73 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/InkyJson.cpp +34 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/LabelCondition.cpp +60 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Lists.cpp +144 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/LookaheadSafe.cpp +46 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Main.cpp +7 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/MoveTo.cpp +95 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/NewLines.cpp +76 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/NoEarlyTags.cpp +33 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Observer.cpp +245 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Pointer.cpp +191 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Restorable.cpp +294 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/SpaceAfterBracketChoice.cpp +45 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Stack.cpp +224 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Tags.cpp +131 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ThirdTierChoiceAfterBrackets.cpp +38 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/UTF8.cpp +56 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/Value.cpp +210 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/catch.hpp +17970 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/AHF.ink +7 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ChoiceBracketStory.ink +7 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/EmptyStringForDivert.ink +13 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ExternalFunctionsExecuteProperly.ink +11 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/FallBack.ink +15 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/GlobalStory.ink +9 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/LabelConditionStory.ink +5 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/LinesStory.ink +42 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ListLogicStory.ink +40 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ListStory.ink +8 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/LookaheadSafe.ink +14 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/MoveTo.ink +36 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/NoEarlyTags.ink +19 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ObserverStory.ink +8 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/SimpleStoryFlow.ink +65 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/TagsStory.ink +22 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/TheIntercept.ink +1686 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/ThirdTierChoiceAfterBracketsStory.ink +13 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/UTF-8-demo.txt +212 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/UTF8Story.ink +218 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/simple-1.1.1-inklecate.json +154 -0
- data/ext/inkcpp_rb/inkcpp/inkcpp_test/ink/simple-1.1.1-inky.json +160 -0
- data/ext/inkcpp_rb/inkcpp/notes/ArchitectureNotes.md +54 -0
- data/ext/inkcpp_rb/inkcpp/notes/ListNotes.md +69 -0
- data/ext/inkcpp_rb/inkcpp/notes/OperationNotes.md +35 -0
- data/ext/inkcpp_rb/inkcpp/notes/TagsNotes.md +24 -0
- data/ext/inkcpp_rb/inkcpp/notes/WhitespaceNotes.md +28 -0
- data/ext/inkcpp_rb/inkcpp/proofing/README.md +3 -0
- data/ext/inkcpp_rb/inkcpp/proofing/inkcpp_runtime_driver +12 -0
- data/ext/inkcpp_rb/inkcpp/pyproject.toml +63 -0
- data/ext/inkcpp_rb/inkcpp/setup.py +166 -0
- data/ext/inkcpp_rb/inkcpp/shared/CMakeLists.txt +14 -0
- data/ext/inkcpp_rb/inkcpp/shared/private/command.h +172 -0
- data/ext/inkcpp_rb/inkcpp/shared/private/header.h +46 -0
- data/ext/inkcpp_rb/inkcpp/shared/public/config.h +53 -0
- data/ext/inkcpp_rb/inkcpp/shared/public/system.h +307 -0
- data/ext/inkcpp_rb/inkcpp/shared/public/version.h +14 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestAllSequenceTypes.ink +59 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestArithmetic.ink +17 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestBasicStringLiterals.ink +8 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestBasicTunnel.ink +10 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestBlanksInInlineSequences.ink +51 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestCallStackEvaluation.ink +15 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestChoiceCount.ink +15 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestChoiceDivertsToDone.ink +6 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestChoiceWithBracketsOnly.ink +9 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestCompareDivertTargets.ink +26 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestComplexTunnels.ink +22 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestConditionalChoiceInWeave.ink +19 -0
- data/ext/inkcpp_rb/inkcpp/tests/TestTunnelOnwardsAfterTunnel.ink +17 -0
- data/ext/inkcpp_rb/inkcpp/unreal/CMakeLists.txt +51 -0
- data/ext/inkcpp_rb/inkcpp/unreal/UE_example.ink +92 -0
- data/ext/inkcpp_rb/inkcpp/unreal/blueprint_filter.js +377 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Resources/Icon128.png +0 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkAsset.cpp +47 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkChoice.cpp +40 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkList.cpp +86 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkRuntime.cpp +265 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkThread.cpp +239 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/InkVar.cpp +143 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/TagList.cpp +95 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Private/inkcpp.cpp +13 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkAsset.h +50 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkChoice.h +58 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkDelegates.h +139 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkList.h +102 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkRuntime.h +177 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkSnapshot.h +30 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkThread.h +215 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/InkVar.h +245 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/TagList.h +77 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/Public/inkcpp.h +217 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp/inkcpp.Build.cs +62 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/InkAssetFactory.cpp +237 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/InkAssetFactory.h +43 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/inkcpp_editor.cpp +13 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Private/inklecate_cmd.cpp.in +24 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/Public/inkcpp_editor.h +9 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/Source/inkcpp_editor/inkcpp_editor.Build.cs +61 -0
- data/ext/inkcpp_rb/inkcpp/unreal/inkcpp/inkcpp.uplugin +44 -0
- data/ext/inkcpp_rb/inkcpp/unreal/render.css +1 -0
- data/ext/inkcpp_rb/inkcpp_rb.cpp +321 -0
- data/inkcpp_rb.gemspec +54 -0
- data/rbi/inkcpp_rb.rbi +211 -0
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/minitest.rbi +119 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
- data/sorbet/rbi/gems/minitest@5.25.4.rbi +1547 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
- data/sorbet/rbi/gems/prism@1.3.0.rbi +40040 -0
- data/sorbet/rbi/gems/rake-compiler@1.2.8.rbi +9 -0
- data/sorbet/rbi/gems/rake@13.2.1.rbi +3033 -0
- data/sorbet/rbi/gems/rbi@0.2.2.rbi +4527 -0
- data/sorbet/rbi/gems/rice@4.3.3.rbi +44 -0
- data/sorbet/rbi/gems/spoom@1.5.0.rbi +4932 -0
- data/sorbet/rbi/gems/tapioca@0.16.7.rbi +3611 -0
- data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +400 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/* Copyright (c) 2024 Julian Benda
|
|
2
|
+
*
|
|
3
|
+
* This file is part of inkCPP which is released under MIT license.
|
|
4
|
+
* See file LICENSE.txt or go to
|
|
5
|
+
* https://github.com/JBenda/inkcpp for full license details.
|
|
6
|
+
*/
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "CoreMinimal.h"
|
|
10
|
+
#include "GameFramework/Actor.h"
|
|
11
|
+
#include "Misc/Optional.h"
|
|
12
|
+
|
|
13
|
+
#include "InkDelegates.h"
|
|
14
|
+
#include "InkSnapshot.h"
|
|
15
|
+
|
|
16
|
+
#include "ink/types.h"
|
|
17
|
+
#include "ink/globals.h"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#include "InkRuntime.generated.h"
|
|
21
|
+
|
|
22
|
+
class UInkThread;
|
|
23
|
+
struct FInkVar;
|
|
24
|
+
namespace ink::runtime { class story; }
|
|
25
|
+
|
|
26
|
+
/** Instanciated story with global variable storage and access, used to instanciate new threads.
|
|
27
|
+
* @ingroup unreal
|
|
28
|
+
*/
|
|
29
|
+
UCLASS()
|
|
30
|
+
class INKCPP_API AInkRuntime : public AActor
|
|
31
|
+
{
|
|
32
|
+
GENERATED_BODY()
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
// Sets default values for this actor's properties
|
|
36
|
+
AInkRuntime();
|
|
37
|
+
~AInkRuntime();
|
|
38
|
+
|
|
39
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
40
|
+
/**
|
|
41
|
+
* Create a new Thread. If a Snapshot is set/loaded create Threads like there was before
|
|
42
|
+
* if you want to create a fresh Thread despite an existing LoadedSnapshot enter the starting path
|
|
43
|
+
*
|
|
44
|
+
* @blueprint
|
|
45
|
+
*/
|
|
46
|
+
UInkThread* Start(TSubclassOf<UInkThread> type, FString path = "", bool runImmediately = true);
|
|
47
|
+
|
|
48
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
49
|
+
/**
|
|
50
|
+
* Create a new Thread in existing memory, for more details \see AInkRuntime::Start()
|
|
51
|
+
*
|
|
52
|
+
* @blueprint
|
|
53
|
+
*/
|
|
54
|
+
UInkThread* StartExisting(UInkThread* thread, FString path = "", bool runImmediately = true);
|
|
55
|
+
|
|
56
|
+
UFUNCTION(BlueprintCallable, Category="Ink")
|
|
57
|
+
/** creates a snapshot of the current runtime state.
|
|
58
|
+
* can be loladed with @ref #LoadSnapshot()
|
|
59
|
+
*
|
|
60
|
+
* @blueprint
|
|
61
|
+
*/
|
|
62
|
+
FInkSnapshot Snapshot();
|
|
63
|
+
|
|
64
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
65
|
+
/**
|
|
66
|
+
* Loads a snapshot file, therfore deletes globals and invalidate all current Threads
|
|
67
|
+
* After this Start and StartExisting will load the corresponding Threads (on at a time)
|
|
68
|
+
*
|
|
69
|
+
* @blueprint
|
|
70
|
+
*/
|
|
71
|
+
void LoadSnapshot(const FInkSnapshot& snapshot);
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
UFUNCTION(BlueprintCallable, Category="Ink")
|
|
75
|
+
/** Marks a thread as "exclusive".
|
|
76
|
+
* As long as it is running, no other threads will update.
|
|
77
|
+
* @see #PopExclusiveThread()
|
|
78
|
+
*
|
|
79
|
+
* @blueprint
|
|
80
|
+
*/
|
|
81
|
+
void PushExclusiveThread(UInkThread* Thread);
|
|
82
|
+
|
|
83
|
+
UFUNCTION(BlueprintCallable, Category="Ink")
|
|
84
|
+
/** Removes a thread from the exclusive stack.
|
|
85
|
+
* @see #PushExclusiveThread()
|
|
86
|
+
*
|
|
87
|
+
* @blueprint
|
|
88
|
+
*/
|
|
89
|
+
void PopExclusiveThread(UInkThread* Thread);
|
|
90
|
+
|
|
91
|
+
UFUNCTION(BlueprintCallable, Category="Ink")
|
|
92
|
+
/** register a "tag function"
|
|
93
|
+
* This function is executed if context or a tag in a special format apears
|
|
94
|
+
* @see @ref TagFunction
|
|
95
|
+
*
|
|
96
|
+
* @blueprint
|
|
97
|
+
*/
|
|
98
|
+
void RegisterTagFunction(FName functionName, const FTagFunctionDelegate & function);
|
|
99
|
+
|
|
100
|
+
/** @private for interanl use */
|
|
101
|
+
void HandleTagFunction(UInkThread* Caller, const TArray<FString>& Params);
|
|
102
|
+
|
|
103
|
+
UFUNCTION(BlueprintCallable, Category="Ink")
|
|
104
|
+
/** Access a variable from the ink runtime.
|
|
105
|
+
* variables are shared between all threads in the same runtime.
|
|
106
|
+
* @param name of variable in ink script
|
|
107
|
+
*
|
|
108
|
+
* @blueprint
|
|
109
|
+
*/
|
|
110
|
+
FInkVar GetGlobalVariable(const FString& name);
|
|
111
|
+
|
|
112
|
+
UFUNCTION(BlueprintCallable, Category="Ink")
|
|
113
|
+
/** Sets a global variable inside the ink runtime.
|
|
114
|
+
* @param name of variable in ink script
|
|
115
|
+
* @param value new value for the variable
|
|
116
|
+
*
|
|
117
|
+
* @blueprint
|
|
118
|
+
*/
|
|
119
|
+
void SetGlobalVariable(const FString& name, const FInkVar& value);
|
|
120
|
+
|
|
121
|
+
UFUNCTION(BlueprintCallable, Category="Ink")
|
|
122
|
+
/** Gets a ping if variable changes
|
|
123
|
+
* @see #ObserverVariableEvent() #ObserverVariableChange()
|
|
124
|
+
*
|
|
125
|
+
* @blueprint
|
|
126
|
+
*/
|
|
127
|
+
void ObserverVariable(const FString& variableName, const FVariableCallbackDelegate& callback);
|
|
128
|
+
|
|
129
|
+
UFUNCTION(BlueprintCallable, Category="Ink")
|
|
130
|
+
/** On variable change provides new value
|
|
131
|
+
* @see #ObserverVariable() #ObserverVariableChange()
|
|
132
|
+
*
|
|
133
|
+
* @blueprint
|
|
134
|
+
*/
|
|
135
|
+
void ObserverVariableEvent(const FString& variableName, const FVariableCallbackDelegateNewValue& callback);
|
|
136
|
+
|
|
137
|
+
UFUNCTION(BlueprintCallable, Category="Ink")
|
|
138
|
+
/** On variable change provides old and new value.
|
|
139
|
+
* @see #ObserverVariableEvent() #ObserverVariable()
|
|
140
|
+
* @attention if the varibale set for the firs time, the old value has value type @ref
|
|
141
|
+
* EInkVarType::None
|
|
142
|
+
*
|
|
143
|
+
* @blueprint
|
|
144
|
+
*/
|
|
145
|
+
void ObserverVariableChange(const FString& variableName, const FVariableCallbackDelegateNewOldValue& callback);
|
|
146
|
+
|
|
147
|
+
protected:
|
|
148
|
+
/** Called when the game starts or when spawned */
|
|
149
|
+
virtual void BeginPlay() override;
|
|
150
|
+
|
|
151
|
+
public:
|
|
152
|
+
// Called every frame
|
|
153
|
+
/** @private */
|
|
154
|
+
virtual void Tick(float DeltaTime) override;
|
|
155
|
+
|
|
156
|
+
// Story asset used in this level
|
|
157
|
+
UPROPERTY(EditAnywhere, Category="Ink")
|
|
158
|
+
/** @private */
|
|
159
|
+
class UInkAsset* InkAsset;
|
|
160
|
+
|
|
161
|
+
private:
|
|
162
|
+
ink::runtime::story* mpRuntime;
|
|
163
|
+
ink::runtime::globals mpGlobals;
|
|
164
|
+
|
|
165
|
+
UPROPERTY()
|
|
166
|
+
TArray<UInkThread*> mThreads;
|
|
167
|
+
|
|
168
|
+
TMap<FName, FGlobalTagFunctionMulticastDelegate> mGlobalTagFunctions;
|
|
169
|
+
|
|
170
|
+
UPROPERTY()
|
|
171
|
+
TArray<UInkThread*> mExclusiveStack;
|
|
172
|
+
|
|
173
|
+
// UPROPERTY(EditDefaultsOnly, Category="Ink")
|
|
174
|
+
TOptional<FInkSnapshot> mSnapshot;
|
|
175
|
+
// snapshot generates data when re-constructing the globals to allow reconstructing the threads
|
|
176
|
+
ink::runtime::snapshot* mpSnapshot;
|
|
177
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* Copyright (c) 2024 Julian Benda
|
|
2
|
+
*
|
|
3
|
+
* This file is part of inkCPP which is released under MIT license.
|
|
4
|
+
* See file LICENSE.txt or go to
|
|
5
|
+
* https://github.com/JBenda/inkcpp for full license details.
|
|
6
|
+
*/
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "InkSnapshot.generated.h"
|
|
10
|
+
|
|
11
|
+
/** A serelizable snapshot of a runtime state
|
|
12
|
+
* Can be used as variable in a USaveGame to be stored and reloaded
|
|
13
|
+
* @ingroup unreal
|
|
14
|
+
*/
|
|
15
|
+
USTRUCT(BlueprintType)
|
|
16
|
+
struct INKCPP_API FInkSnapshot
|
|
17
|
+
{
|
|
18
|
+
GENERATED_BODY()
|
|
19
|
+
FInkSnapshot() {}
|
|
20
|
+
|
|
21
|
+
/** @private */
|
|
22
|
+
FInkSnapshot(const char* snap_data, size_t snap_len)
|
|
23
|
+
: data(reinterpret_cast<const uint8*>(snap_data), snap_len)
|
|
24
|
+
{}
|
|
25
|
+
UPROPERTY(BlueprintReadWrite, SaveGame, Category = "ink|SaveGame")
|
|
26
|
+
/** Raw data used to restore runtime state.
|
|
27
|
+
* not needed if a USaveGame is used.
|
|
28
|
+
*/
|
|
29
|
+
TArray<uint8> data;
|
|
30
|
+
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/* Copyright (c) 2024 Julian Benda
|
|
2
|
+
*
|
|
3
|
+
* This file is part of inkCPP which is released under MIT license.
|
|
4
|
+
* See file LICENSE.txt or go to
|
|
5
|
+
* https://github.com/JBenda/inkcpp for full license details.
|
|
6
|
+
*/
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "CoreMinimal.h"
|
|
10
|
+
#include "UObject/NoExportTypes.h"
|
|
11
|
+
|
|
12
|
+
#include "InkVar.h"
|
|
13
|
+
#include "InkDelegates.h"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
#include "ink/runner.h"
|
|
17
|
+
#include "ink/types.h"
|
|
18
|
+
|
|
19
|
+
#include "InkThread.generated.h"
|
|
20
|
+
|
|
21
|
+
class UTagList;
|
|
22
|
+
class AInkRuntime;
|
|
23
|
+
class UInkChoice;
|
|
24
|
+
|
|
25
|
+
/** Base class for all ink threads
|
|
26
|
+
* @ingroup unreal
|
|
27
|
+
*/
|
|
28
|
+
UCLASS(Blueprintable)
|
|
29
|
+
class INKCPP_API UInkThread : public UObject
|
|
30
|
+
{
|
|
31
|
+
GENERATED_BODY()
|
|
32
|
+
|
|
33
|
+
public:
|
|
34
|
+
UInkThread();
|
|
35
|
+
~UInkThread();
|
|
36
|
+
|
|
37
|
+
// Yields the thread immediately. Will wait until Resume().
|
|
38
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
39
|
+
/** Yields the thread immediatly.
|
|
40
|
+
* This will stop the execution (after finishing the current line).
|
|
41
|
+
* until @ref #Resume() is called.
|
|
42
|
+
*
|
|
43
|
+
* @ref #Yield() and @ref #Resume() working with a refernce counter.
|
|
44
|
+
* therfore a thread can be yield multiple times, and must then be resumed
|
|
45
|
+
* the same amount.
|
|
46
|
+
*
|
|
47
|
+
* @blueprint
|
|
48
|
+
*/
|
|
49
|
+
void Yield();
|
|
50
|
+
|
|
51
|
+
UFUNCTION(BlueprintPure, Category = "Ink")
|
|
52
|
+
/** Checks if the thread is stopped.
|
|
53
|
+
* @retval true if the thread currently waiting to resume
|
|
54
|
+
* @see #Yield() #Resume()
|
|
55
|
+
*
|
|
56
|
+
* @blueprint
|
|
57
|
+
*/
|
|
58
|
+
bool IsYielding();
|
|
59
|
+
|
|
60
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
61
|
+
/** Resumes yielded thread.
|
|
62
|
+
* @see #Yield()
|
|
63
|
+
*
|
|
64
|
+
* @blueprint
|
|
65
|
+
*/
|
|
66
|
+
void Resume();
|
|
67
|
+
|
|
68
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
69
|
+
/** Kills thread at next possible moment
|
|
70
|
+
*
|
|
71
|
+
* @blueprint
|
|
72
|
+
*/
|
|
73
|
+
void Stop();
|
|
74
|
+
|
|
75
|
+
UFUNCTION(BlueprintPure, Category = "Ink")
|
|
76
|
+
|
|
77
|
+
/** Access runtime the thread belongs to
|
|
78
|
+
* @return runtime of the thread
|
|
79
|
+
*
|
|
80
|
+
* @blueprint
|
|
81
|
+
*/
|
|
82
|
+
AInkRuntime* GetRuntime() const { return mpRuntime; }
|
|
83
|
+
|
|
84
|
+
// Called before the thread begins executing
|
|
85
|
+
UFUNCTION(BlueprintImplementableEvent, Category = "Ink")
|
|
86
|
+
/** triggered after initalizing the runner
|
|
87
|
+
*
|
|
88
|
+
* @blueprint
|
|
89
|
+
*/
|
|
90
|
+
void OnStartup();
|
|
91
|
+
|
|
92
|
+
// Called when the thread has printed a new line
|
|
93
|
+
UFUNCTION(BlueprintImplementableEvent, Category = "Ink")
|
|
94
|
+
/** triggerd if a new line of context is available
|
|
95
|
+
* @param line text of new line
|
|
96
|
+
* @param tags tags assoziated with this line
|
|
97
|
+
*
|
|
98
|
+
* @blueprint
|
|
99
|
+
*/
|
|
100
|
+
void OnLineWritten(const FString& line, const UTagList* tags);
|
|
101
|
+
|
|
102
|
+
UFUNCTION(BlueprintImplementableEvent, Category = "Ink")
|
|
103
|
+
/** triggered when a tag is encountered
|
|
104
|
+
* @param tag_name the tag found
|
|
105
|
+
*
|
|
106
|
+
* @blueprint
|
|
107
|
+
*/
|
|
108
|
+
void OnTag(const FString& tag_name);
|
|
109
|
+
|
|
110
|
+
UFUNCTION(BlueprintImplementableEvent, Category = "Ink")
|
|
111
|
+
/** triggered when reached a choice point.
|
|
112
|
+
* @param choices possible branches to choos for continue
|
|
113
|
+
* @see #PickChoice()
|
|
114
|
+
*
|
|
115
|
+
* @blueprint
|
|
116
|
+
*/
|
|
117
|
+
void OnChoice(const TArray<UInkChoice*>& choices);
|
|
118
|
+
|
|
119
|
+
UFUNCTION(BlueprintImplementableEvent, Category = "Ink")
|
|
120
|
+
/** triggered when the thread reached the end of context
|
|
121
|
+
* @see AInkRuntime::StartExisting()
|
|
122
|
+
*
|
|
123
|
+
* @blueprint
|
|
124
|
+
*/
|
|
125
|
+
void OnShutdown();
|
|
126
|
+
|
|
127
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
128
|
+
/** picks a choice to continue with
|
|
129
|
+
* @see UInkChoice::GetIndex()
|
|
130
|
+
* @retval false if the index is out of range
|
|
131
|
+
*
|
|
132
|
+
* @blueprint
|
|
133
|
+
*/
|
|
134
|
+
bool PickChoice(int index);
|
|
135
|
+
|
|
136
|
+
// Registers a callback for a named "tag function"
|
|
137
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
138
|
+
/** Register a callback for a named "tag function"
|
|
139
|
+
* @see @ref TagFunction
|
|
140
|
+
*
|
|
141
|
+
* @blueprint
|
|
142
|
+
*/
|
|
143
|
+
void RegisterTagFunction(FName functionName, const FTagFunctionDelegate& function);
|
|
144
|
+
|
|
145
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
146
|
+
/** register a external function.
|
|
147
|
+
* A function provides a return value
|
|
148
|
+
* @see if you do not want to return something #RegisterExternalEvent()
|
|
149
|
+
*
|
|
150
|
+
* @blueprint
|
|
151
|
+
*/
|
|
152
|
+
void RegisterExternalFunction(
|
|
153
|
+
const FString& functionName, const FExternalFunctionDelegate& function,
|
|
154
|
+
bool lookaheadSafe = false
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
UFUNCTION(BlueprintCallable, Category = "Ink")
|
|
158
|
+
/** register external event.
|
|
159
|
+
* A event has the return type void.
|
|
160
|
+
* @see If you want to return a value use #RegisterExternalFunction()
|
|
161
|
+
*
|
|
162
|
+
* @blueprint
|
|
163
|
+
*/
|
|
164
|
+
void RegisterExternalEvent(
|
|
165
|
+
const FString& functionName, const FExternalFunctionVoidDelegate& function,
|
|
166
|
+
bool lookaheadSafe = false
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
protected:
|
|
171
|
+
/** @private */
|
|
172
|
+
virtual void OnStartup_Implementation() {}
|
|
173
|
+
|
|
174
|
+
/** @private */
|
|
175
|
+
virtual void OnLineWritten_Implementation(const FString& line, UTagList* tags) {}
|
|
176
|
+
|
|
177
|
+
/** @private */
|
|
178
|
+
virtual void OnTag_Implementation(const FString& line) {}
|
|
179
|
+
|
|
180
|
+
/** @private */
|
|
181
|
+
virtual void OnChoice_Implementation(const TArray<UInkChoice*>& choices) {}
|
|
182
|
+
|
|
183
|
+
/** @private */
|
|
184
|
+
virtual void OnShutdown_Implementation() {}
|
|
185
|
+
|
|
186
|
+
private:
|
|
187
|
+
friend class AInkRuntime;
|
|
188
|
+
|
|
189
|
+
void Initialize(FString path, AInkRuntime* runtime, ink::runtime::runner thread);
|
|
190
|
+
bool Execute();
|
|
191
|
+
bool CanExecute() const;
|
|
192
|
+
|
|
193
|
+
bool ExecuteInternal();
|
|
194
|
+
|
|
195
|
+
void ExecuteTagMethod(const TArray<FString>& Params);
|
|
196
|
+
|
|
197
|
+
private:
|
|
198
|
+
ink::runtime::runner mpRunner;
|
|
199
|
+
UTagList* mpTags;
|
|
200
|
+
TArray<UInkChoice*> mCurrentChoices; /// @TODO: make accassible?
|
|
201
|
+
|
|
202
|
+
TMap<FName, FTagFunctionMulticastDelegate> mTagFunctions;
|
|
203
|
+
|
|
204
|
+
FString mStartPath;
|
|
205
|
+
bool mbHasRun;
|
|
206
|
+
|
|
207
|
+
int mnChoiceToChoose;
|
|
208
|
+
int mnYieldCounter;
|
|
209
|
+
bool mbInChoice;
|
|
210
|
+
bool mbKill;
|
|
211
|
+
bool mbInitialized;
|
|
212
|
+
|
|
213
|
+
UPROPERTY()
|
|
214
|
+
AInkRuntime* mpRuntime;
|
|
215
|
+
};
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/* Copyright (c) 2024 Julian Benda
|
|
2
|
+
*
|
|
3
|
+
* This file is part of inkCPP which is released under MIT license.
|
|
4
|
+
* See file LICENSE.txt or go to
|
|
5
|
+
* https://github.com/JBenda/inkcpp for full license details.
|
|
6
|
+
*
|
|
7
|
+
* Based on Copyright (c) 2020 David Colson
|
|
8
|
+
* UnrealInk @ https://github.com/DavidColson/UnrealInk
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include "CoreMinimal.h"
|
|
13
|
+
#include "Kismet/BlueprintFunctionLibrary.h"
|
|
14
|
+
#include "UObject/TextProperty.h"
|
|
15
|
+
#include "Containers/Union.h"
|
|
16
|
+
#include "Containers/StringConv.h"
|
|
17
|
+
|
|
18
|
+
#include "InkList.h"
|
|
19
|
+
|
|
20
|
+
#include "InkVar.generated.h"
|
|
21
|
+
|
|
22
|
+
/** Label for types possible contained in a @ref FInkVar
|
|
23
|
+
* @ingroup unreal
|
|
24
|
+
*/
|
|
25
|
+
UENUM(BlueprintType)
|
|
26
|
+
enum class EInkVarType : uint8
|
|
27
|
+
{
|
|
28
|
+
Float, ///< contains a value of type float
|
|
29
|
+
Int, ///< contains a value of type int or uint
|
|
30
|
+
UInt, ///< @todo currenty not supported
|
|
31
|
+
Bool, ///< contains a boolean
|
|
32
|
+
String, ///< contains a string value
|
|
33
|
+
List, ///< contains a @ref UInkList
|
|
34
|
+
None ///< contains no value
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
namespace ink::runtime { struct value; }
|
|
38
|
+
|
|
39
|
+
/** A wrapper for passing around ink vars to and from ink itself.
|
|
40
|
+
* To access the values see @ref UInkVarLibrary
|
|
41
|
+
* @see UInkVarLibrary
|
|
42
|
+
* @ingroup unreal
|
|
43
|
+
*/
|
|
44
|
+
USTRUCT(BlueprintType)
|
|
45
|
+
struct INKCPP_API FInkVar
|
|
46
|
+
{
|
|
47
|
+
GENERATED_BODY()
|
|
48
|
+
|
|
49
|
+
FInkVar() {}
|
|
50
|
+
|
|
51
|
+
/** @private */
|
|
52
|
+
FInkVar(float val) { value.SetSubtype<float>(val); }
|
|
53
|
+
|
|
54
|
+
/** @private */
|
|
55
|
+
FInkVar(int val) { value.SetSubtype<int>(val); }
|
|
56
|
+
|
|
57
|
+
/** @private */
|
|
58
|
+
FInkVar(unsigned val)
|
|
59
|
+
{
|
|
60
|
+
UE_LOG(InkCpp, Warning, TEXT("Converting unsigned to signed int, since missing blueprint support for unsigned type"));
|
|
61
|
+
value.SetSubtype<int>(val);
|
|
62
|
+
} // TODO: change if we find a way to support unsigned values in blueprints
|
|
63
|
+
|
|
64
|
+
/** @private */
|
|
65
|
+
FInkVar(bool val) { value.SetSubtype<bool>(val); }
|
|
66
|
+
|
|
67
|
+
/** @private */
|
|
68
|
+
FInkVar(FString val) {
|
|
69
|
+
value.SetSubtype<FString>(val);
|
|
70
|
+
BufferDecodedString();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** @private */
|
|
74
|
+
FInkVar(UInkList& List) { value.SetSubtype<UInkList*>(&List); }
|
|
75
|
+
|
|
76
|
+
/** @private */
|
|
77
|
+
FInkVar(ink::runtime::value val);
|
|
78
|
+
|
|
79
|
+
/** @private */
|
|
80
|
+
ink::runtime::value to_value() const;
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
// allow changing via Editor, but not in controle flow, it is just a wrapper type to create a new one
|
|
84
|
+
// UPROPERTY(EditAnywhere, Category = "Ink")
|
|
85
|
+
/** @private */
|
|
86
|
+
TUnion<float, int, unsigned, bool, FString, UInkList*> value;
|
|
87
|
+
|
|
88
|
+
/** Keeps utf8 version of string alive to write it in runtime.
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
TArray<UTF8CHAR> utf8{};
|
|
92
|
+
|
|
93
|
+
/** Get the type contained in the value
|
|
94
|
+
* @retval EInkVarType::None if no value is contained (void)
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
EInkVarType type() const {
|
|
98
|
+
uint8 id = value.GetCurrentSubtypeIndex();
|
|
99
|
+
if(id >= static_cast<uint8>(EInkVarType::None))
|
|
100
|
+
{ return EInkVarType::None; }
|
|
101
|
+
else
|
|
102
|
+
{ return static_cast<EInkVarType>(id); }
|
|
103
|
+
}
|
|
104
|
+
private:
|
|
105
|
+
void BufferDecodedString() {
|
|
106
|
+
FTCHARToUTF8 Convert(*value.GetSubtype<FString>());
|
|
107
|
+
utf8.SetNum(Convert.Length() + 1);
|
|
108
|
+
UTF8CHAR* dst = utf8.GetData();
|
|
109
|
+
[this,&dst](const UTF8CHAR* src){
|
|
110
|
+
int i = 0;
|
|
111
|
+
while(*src) {
|
|
112
|
+
*dst++ = *src++;
|
|
113
|
+
}
|
|
114
|
+
*dst = static_cast<UTF8CHAR>(0);
|
|
115
|
+
}(reinterpret_cast<const UTF8CHAR*>(Convert.Get()));
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** Conversion Methods for @ref FInkVar
|
|
120
|
+
* @ingroup unreal
|
|
121
|
+
*/
|
|
122
|
+
UCLASS()
|
|
123
|
+
class INKCPP_API UInkVarLibrary : public UBlueprintFunctionLibrary
|
|
124
|
+
{
|
|
125
|
+
GENERATED_BODY()
|
|
126
|
+
|
|
127
|
+
public:
|
|
128
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Var Type", BlueprintAutocast), Category = "Ink")
|
|
129
|
+
/** Get the type contained in the value
|
|
130
|
+
* @retval EInkVarType::None if no value is contained (void)
|
|
131
|
+
*
|
|
132
|
+
* @blueprint
|
|
133
|
+
*/
|
|
134
|
+
static EInkVarType InkVarType(const FInkVar& InkVar);
|
|
135
|
+
|
|
136
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "String (Ink Var)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
137
|
+
/** Access String value
|
|
138
|
+
*
|
|
139
|
+
* @blueprint
|
|
140
|
+
*/
|
|
141
|
+
static FString Conv_InkVarString(const FInkVar& InkVar);
|
|
142
|
+
|
|
143
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Int (Ink Var)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
144
|
+
/** Access Int/Uint value
|
|
145
|
+
* @todo suppurt unsigned int
|
|
146
|
+
*
|
|
147
|
+
* @blueprint
|
|
148
|
+
*/
|
|
149
|
+
static int Conv_InkVarInt(const FInkVar& InkVar);
|
|
150
|
+
|
|
151
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Float (Ink Var)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
152
|
+
/** Access Float Value
|
|
153
|
+
*
|
|
154
|
+
* @blueprint
|
|
155
|
+
*/
|
|
156
|
+
static float Conv_InkVarFloat(const FInkVar& InkVar);
|
|
157
|
+
|
|
158
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Name (Ink Var)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
159
|
+
/** Access String value as FName
|
|
160
|
+
*
|
|
161
|
+
* @blueprint
|
|
162
|
+
*/
|
|
163
|
+
static FName Conv_InkVarName(const FInkVar& InkVar);
|
|
164
|
+
|
|
165
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Text (Ink Var)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
166
|
+
/** Access Strnig value as FText
|
|
167
|
+
*
|
|
168
|
+
* @blueprint
|
|
169
|
+
*/
|
|
170
|
+
static FText Conv_InkVarText(const FInkVar& InkVar);
|
|
171
|
+
|
|
172
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Bool (Ink Var)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
173
|
+
/** Access bool value
|
|
174
|
+
*
|
|
175
|
+
* @blueprint */
|
|
176
|
+
static bool Conv_InkVarBool(const FInkVar& InkVar);
|
|
177
|
+
|
|
178
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "InkList (Ink Var)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
179
|
+
/** Access @ref UInkList "List" value
|
|
180
|
+
*
|
|
181
|
+
* @blueprint
|
|
182
|
+
*/
|
|
183
|
+
static const UInkList* Conv_InkVarInkList(const FInkVar& InkVar);
|
|
184
|
+
|
|
185
|
+
// UFUNCTION(BlueprintPure, meta = (DisplayName = "UInt (Ink Var)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
186
|
+
// static unsigned Conv_InkVarUInt(const FInkVar& InkVar);
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Ink Var (String)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
190
|
+
/** Convert string to @ref FInkVar
|
|
191
|
+
*
|
|
192
|
+
* @blueprint
|
|
193
|
+
*/
|
|
194
|
+
static FInkVar Conv_StringInkVar(const FString& String);
|
|
195
|
+
|
|
196
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Ink Var (Int)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
197
|
+
/** Convert int to @ref FInkVar
|
|
198
|
+
* @todo support unsigned values
|
|
199
|
+
*
|
|
200
|
+
* @blueprint
|
|
201
|
+
*/
|
|
202
|
+
static FInkVar Conv_IntInkVar(int Number);
|
|
203
|
+
|
|
204
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Ink Var (Float)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
205
|
+
/** Convert float to @ref FInkVar
|
|
206
|
+
*
|
|
207
|
+
* @blueprint
|
|
208
|
+
*/
|
|
209
|
+
static FInkVar Conv_FloatInkVar(float Number);
|
|
210
|
+
|
|
211
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Ink Var (Text)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
212
|
+
/** Convert FText to @ref FInkVar of type @ref EInkVarType::String "String"
|
|
213
|
+
*
|
|
214
|
+
* @blueprint
|
|
215
|
+
*/
|
|
216
|
+
static FInkVar Conv_TextInkVar(const FText& Text);
|
|
217
|
+
|
|
218
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Ink Var (Name)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
219
|
+
/** Convert FName to @ref FInkVar of type @ref EInkVarType::String "String"
|
|
220
|
+
*
|
|
221
|
+
* @blueprint
|
|
222
|
+
*/
|
|
223
|
+
static FInkVar Conv_NameInkVar(const FName& Name);
|
|
224
|
+
|
|
225
|
+
UFUNCTION(BlueprintPure, meta = (DisplayName = "Ink Var (Bool)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
226
|
+
/** Convert bool to @ref FInkVar
|
|
227
|
+
*
|
|
228
|
+
* @blueprint
|
|
229
|
+
*/
|
|
230
|
+
static FInkVar Conv_BoolInkVar(bool Boolean);
|
|
231
|
+
|
|
232
|
+
UFUNCTION(
|
|
233
|
+
BlueprintPure,
|
|
234
|
+
meta = (DisplayName = "Ink Var (InkList)", CompactNodeTitle = "->", BlueprintAutocast),
|
|
235
|
+
Category = "Ink"
|
|
236
|
+
)
|
|
237
|
+
/** Converts @ref UInkList "List" to @ref FInkVar
|
|
238
|
+
*
|
|
239
|
+
* @blueprint
|
|
240
|
+
*/
|
|
241
|
+
static FInkVar Conv_ListInkVar(UInkList* List);
|
|
242
|
+
|
|
243
|
+
// UFUNCTION(BlueprintPure, meta = (DisplayName = "Ink Var (UInt)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Ink")
|
|
244
|
+
// static FInkVar Conv_UIntInkVar(unsigned Number);
|
|
245
|
+
};
|