|
| 1 | +// SPDX-License-Identifier: Apache-2.0 |
| 2 | + |
| 3 | +#include <scratchcpp/scratchconfiguration.h> |
| 4 | + |
| 5 | +#include "blocks.h" |
| 6 | + |
| 7 | +#ifdef ENABLE_MOTION_BLOCKS |
| 8 | +#include "motionblocks.h" |
| 9 | +#endif |
| 10 | +#ifdef ENABLE_LOOKS_BLOCKS |
| 11 | +#include "looksblocks.h" |
| 12 | +#endif |
| 13 | +#ifdef ENABLE_SOUND_BLOCKS |
| 14 | +#include "soundblocks.h" |
| 15 | +#endif |
| 16 | +#ifdef ENABLE_EVENT_BLOCKS |
| 17 | +#include "eventblocks.h" |
| 18 | +#endif |
| 19 | +#ifdef ENABLE_CONTROL_BLOCKS |
| 20 | +#include "controlblocks.h" |
| 21 | +#endif |
| 22 | +#ifdef ENABLE_SENSING_BLOCKS |
| 23 | +#include "sensingblocks.h" |
| 24 | +#endif |
| 25 | +#ifdef ENABLE_OPERATOR_BLOCKS |
| 26 | +#include "operatorblocks.h" |
| 27 | +#endif |
| 28 | +#ifdef ENABLE_VARIABLE_BLOCKS |
| 29 | +#include "variableblocks.h" |
| 30 | +#endif |
| 31 | +#ifdef ENABLE_LIST_BLOCKS |
| 32 | +#include "listblocks.h" |
| 33 | +#endif |
| 34 | +#ifdef ENABLE_CUSTOM_BLOCKS |
| 35 | +#include "customblocks.h" |
| 36 | +#endif |
| 37 | + |
| 38 | +using namespace libscratchcpp; |
| 39 | + |
| 40 | +Blocks Blocks::m_instance; |
| 41 | + |
| 42 | +const std::vector<std::shared_ptr<IExtension>> &Blocks::extensions() |
| 43 | +{ |
| 44 | + return m_instance.m_extensions; |
| 45 | +} |
| 46 | + |
| 47 | +Blocks::Blocks() |
| 48 | +{ |
| 49 | +#ifdef ENABLE_MOTION_BLOCKS |
| 50 | + m_extensions.push_back(std::make_shared<MotionBlocks>()); |
| 51 | +#endif |
| 52 | +#ifdef ENABLE_LOOKS_BLOCKS |
| 53 | + m_extensions.push_back(std::make_shared<LooksBlocks>()); |
| 54 | +#endif |
| 55 | +#ifdef ENABLE_SOUND_BLOCKS |
| 56 | + m_extensions.push_back(std::make_shared<SoundBlocks>()); |
| 57 | +#endif |
| 58 | +#ifdef ENABLE_EVENT_BLOCKS |
| 59 | + m_extensions.push_back(std::make_shared<EventBlocks>()); |
| 60 | +#endif |
| 61 | +#ifdef ENABLE_CONTROL_BLOCKS |
| 62 | + m_extensions.push_back(std::make_shared<ControlBlocks>()); |
| 63 | +#endif |
| 64 | +#ifdef ENABLE_SENSING_BLOCKS |
| 65 | + m_extensions.push_back(std::make_shared<SensingBlocks>()); |
| 66 | +#endif |
| 67 | +#ifdef ENABLE_OPERATOR_BLOCKS |
| 68 | + m_extensions.push_back(std::make_shared<OperatorBlocks>()); |
| 69 | +#endif |
| 70 | +#ifdef ENABLE_VARIABLE_BLOCKS |
| 71 | + m_extensions.push_back(std::make_shared<VariableBlocks>()); |
| 72 | +#endif |
| 73 | +#ifdef ENABLE_LIST_BLOCKS |
| 74 | + m_extensions.push_back(std::make_shared<ListBlocks>()); |
| 75 | +#endif |
| 76 | +#ifdef ENABLE_CUSTOM_BLOCKS |
| 77 | + m_extensions.push_back(std::make_shared<CustomBlocks>()); |
| 78 | +#endif |
| 79 | +} |
| 80 | + |
| 81 | +void Blocks::registerExtensions() |
| 82 | +{ |
| 83 | + for (auto ext : m_extensions) |
| 84 | + ScratchConfiguration::registerExtension(ext); |
| 85 | +} |
0 commit comments