Compare commits

..

3 Commits

11 changed files with 537 additions and 207 deletions

View File

@ -1,199 +1,268 @@
# Commented out parameters are those with the same value as base LLVM style.
# We can uncomment them if we want to change their value, or enforce the
# chosen value in case the base style changes (last sync: Clang 14.0).
--- ---
### General config, applies to all languages ### BasedOnStyle: Chromium
BasedOnStyle: LLVM
AccessModifierOffset: -4 AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign AlignAfterOpenBracket: Align
# AlignArrayOfStructures: None AlignArrayOfStructures: None
# AlignConsecutiveMacros: None AlignConsecutiveAssignments:
# AlignConsecutiveAssignments: None Enabled: false
# AlignConsecutiveBitFields: None AcrossEmptyLines: false
# AlignConsecutiveDeclarations: None AcrossComments: false
# AlignEscapedNewlines: Right AlignCompound: false
AlignOperands: DontAlign PadOperators: true
AlignTrailingComments: false AlignConsecutiveBitFields:
# AllowAllArgumentsOnNextLine: true Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false
# AllowShortEnumsOnASingleLine: true AllowShortBlocksOnASingleLine: Never
# AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false
# AllowShortCaseLabelsOnASingleLine: false AllowShortEnumsOnASingleLine: true
# AllowShortFunctionsOnASingleLine: All AllowShortFunctionsOnASingleLine: Inline
# AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: Never
# AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: All
# AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakAfterReturnType: None AlwaysBreakAfterReturnType: None
# AlwaysBreakBeforeMultilineStrings: false AlwaysBreakBeforeMultilineStrings: true
# AlwaysBreakTemplateDeclarations: MultiLine AlwaysBreakTemplateDeclarations: Yes
# AttributeMacros: AttributeMacros:
# - __capability - __capability
# BinPackArguments: true BinPackArguments: true
# BinPackParameters: true BinPackParameters: false
# BraceWrapping: BitFieldColonSpacing: Both
# AfterCaseLabel: false BraceWrapping:
# AfterClass: false AfterCaseLabel: false
# AfterControlStatement: Never AfterClass: false
# AfterEnum: false AfterControlStatement: Never
# AfterFunction: false AfterEnum: false
# AfterNamespace: false AfterFunction: false
# AfterObjCDeclaration: false AfterNamespace: false
# AfterStruct: false AfterObjCDeclaration: false
# AfterUnion: false AfterStruct: false
# AfterExternBlock: false AfterUnion: false
# BeforeCatch: false AfterExternBlock: false
# BeforeElse: false BeforeCatch: false
# BeforeLambdaBody: false BeforeElse: false
# BeforeWhile: false BeforeLambdaBody: false
# IndentBraces: false BeforeWhile: false
# SplitEmptyFunction: true IndentBraces: false
# SplitEmptyRecord: true SplitEmptyFunction: true
# SplitEmptyNamespace: true SplitEmptyRecord: true
# BreakBeforeBinaryOperators: None SplitEmptyNamespace: true
# BreakBeforeConceptDeclarations: true BreakAfterAttributes: Never
# BreakBeforeBraces: Attach BreakAfterJavaFieldAnnotations: false
# BreakBeforeInheritanceComma: false BreakArrays: true
# BreakInheritanceList: BeforeColon BreakBeforeBinaryOperators: None
# BreakBeforeTernaryOperators: true BreakBeforeBraces: Attach
# BreakConstructorInitializersBeforeComma: false BreakBeforeConceptDeclarations: Always
BreakConstructorInitializers: AfterColon BreakBeforeInlineASMColon: OnlyMultiline
# BreakStringLiterals: true BreakBeforeTernaryOperators: true
ColumnLimit: 0 BreakConstructorInitializers: BeforeColon
# CommentPragmas: '^ IWYU pragma:' BreakInheritanceList: BeforeColon
# QualifierAlignment: Leave BreakStringLiterals: true
# CompactNamespaces: false ColumnLimit: 80
ConstructorInitializerIndentWidth: 8 CommentPragmas: "^ IWYU pragma:"
ContinuationIndentWidth: 8 CompactNamespaces: false
Cpp11BracedListStyle: false ConstructorInitializerIndentWidth: 4
# DeriveLineEnding: true ContinuationIndentWidth: 4
# DerivePointerAlignment: false Cpp11BracedListStyle: true
# DisableFormat: false DerivePointerAlignment: false
# EmptyLineAfterAccessModifier: Never DisableFormat: false
# EmptyLineBeforeAccessModifier: LogicalBlock EmptyLineAfterAccessModifier: Never
# ExperimentalAutoDetectBinPacking: false EmptyLineBeforeAccessModifier: LogicalBlock
# PackConstructorInitializers: BinPack ExperimentalAutoDetectBinPacking: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true FixNamespaceComments: true
# AllowAllConstructorInitializersOnNextLine: true ForEachMacros:
# FixNamespaceComments: true - foreach
# ForEachMacros: - Q_FOREACH
# - foreach - BOOST_FOREACH
# - Q_FOREACH IfMacros:
# - BOOST_FOREACH - KJ_IF_MAYBE
# IfMacros: IncludeBlocks: Preserve
# - KJ_IF_MAYBE
# IncludeBlocks: Preserve
IncludeCategories: IncludeCategories:
- Regex: '".*"' - Regex: ^<ext/.*\.h>
Priority: 1 Priority: 2
- Regex: '^<.*\.h>' SortPriority: 0
Priority: 2 CaseSensitive: false
- Regex: '^<.*' - Regex: ^<.*\.h>
Priority: 3 Priority: 1
# IncludeIsMainRegex: '(Test)?$' SortPriority: 0
# IncludeIsMainSourceRegex: '' CaseSensitive: false
# IndentAccessModifiers: false - Regex: ^<.*
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: .*
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: ([-_](test|unittest))?$
IncludeIsMainSourceRegex: ""
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true IndentCaseLabels: true
# IndentCaseBlocks: false IndentExternBlock: AfterExternBlock
# IndentGotoLabels: true IndentGotoLabels: true
# IndentPPDirectives: None IndentPPDirectives: None
# IndentExternBlock: AfterExternBlock IndentRequiresClause: true
# IndentRequires: false IndentWidth: 4
IndentWidth: 4 IndentWrappedFunctionNames: false
# IndentWrappedFunctionNames: false InsertBraces: false
# InsertTrailingCommas: None InsertNewlineAtEOF: false
# JavaScriptQuotes: Leave InsertTrailingCommas: None
# JavaScriptWrapImports: true IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtEOF: false
KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLinesAtTheStartOfBlocks: false
# LambdaBodyIndentation: Signature LambdaBodyIndentation: Signature
# MacroBlockBegin: '' Language: Cpp
# MacroBlockEnd: '' LineEnding: DeriveLF
# MaxEmptyLinesToKeep: 1 MacroBlockBegin: ""
# NamespaceIndentation: None MacroBlockEnd: ""
# PenaltyBreakAssignment: 2 MaxEmptyLinesToKeep: 1
# PenaltyBreakBeforeFirstCallParameter: 19 NamespaceIndentation: None
# PenaltyBreakComment: 300 ObjCBinPackProtocolList: Never
# PenaltyBreakFirstLessLess: 120 ObjCBlockIndentWidth: 2
# PenaltyBreakOpenParenthesis: 0 ObjCBreakBeforeNestedBlockParam: true
# PenaltyBreakString: 1000 ObjCSpaceAfterProperty: false
# PenaltyBreakTemplateDeclaration: 10 ObjCSpaceBeforeProtocolList: true
# PenaltyExcessCharacter: 1000000 PPIndentWidth: -1
# PenaltyReturnTypeOnItsOwnLine: 60 PackConstructorInitializers: NextLine
# PenaltyIndentedWhitespace: 0 PenaltyBreakAssignment: 2
# PointerAlignment: Right PenaltyBreakBeforeFirstCallParameter: 10
# PPIndentWidth: -1 PenaltyBreakComment: 300
# ReferenceAlignment: Pointer PenaltyBreakFirstLessLess: 120
# ReflowComments: true PenaltyBreakOpenParenthesis: 0
# RemoveBracesLLVM: false PenaltyBreakString: 1000
# SeparateDefinitionBlocks: Leave PenaltyBreakTemplateDeclaration: 10
# ShortNamespaceLines: 1 PenaltyExcessCharacter: 1000000
# SortIncludes: CaseSensitive PenaltyIndentedWhitespace: 0
# SortJavaStaticImport: Before PenaltyReturnTypeOnItsOwnLine: 200
# SortUsingDeclarations: true PointerAlignment: Left
# SpaceAfterCStyleCast: false QualifierAlignment: Leave
# SpaceAfterLogicalNot: false RawStringFormats:
# SpaceAfterTemplateKeyword: true - Language: Cpp
# SpaceBeforeAssignmentOperators: true Delimiters:
# SpaceBeforeCaseColon: false - cc
# SpaceBeforeCpp11BracedList: false - CC
# SpaceBeforeCtorInitializerColon: true - cpp
# SpaceBeforeInheritanceColon: true - Cpp
# SpaceBeforeParens: ControlStatements - CPP
# SpaceBeforeParensOptions: - c++
# AfterControlStatements: true - C++
# AfterForeachMacros: true CanonicalDelimiter: ""
# AfterFunctionDefinitionName: false BasedOnStyle: google
# AfterFunctionDeclarationName: false - Language: TextProto
# AfterIfMacros: true Delimiters:
# AfterOverloadedOperator: false - pb
# BeforeNonEmptyParentheses: false - PB
# SpaceAroundPointerQualifiers: Default - proto
# SpaceBeforeRangeBasedForLoopColon: true - PROTO
# SpaceInEmptyBlock: false EnclosingFunctions:
# SpaceInEmptyParentheses: false - EqualsProto
# SpacesBeforeTrailingComments: 1 - EquivToProto
# SpacesInAngles: Never - PARSE_PARTIAL_TEXT_PROTO
# SpacesInConditionalStatement: false - PARSE_TEST_PROTO
# SpacesInContainerLiterals: true - PARSE_TEXT_PROTO
# SpacesInCStyleCastParentheses: false - ParseTextOrDie
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix - ParseTextProtoOrDie
## our comment capitalization at the same time. - ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDeclarationName: false
AfterFunctionDefinitionName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix: SpacesInLineCommentPrefix:
Minimum: 0 Minimum: 1
Maximum: -1 Maximum: -1
# SpacesInParentheses: false SpacesInParens: Never
# SpacesInSquareBrackets: false SpacesInParensOptions:
# SpaceBeforeSquareBrackets: false InConditionalStatements: false
# BitFieldColonSpacing: Both InCStyleCasts: false
# StatementAttributeLikeMacros: InEmptyParentheses: false
# - Q_EMIT Other: false
# StatementMacros: SpacesInSquareBrackets: false
# - Q_UNUSED Standard: Auto
# - QT_REQUIRE_VERSION StatementAttributeLikeMacros:
TabWidth: 4 - Q_EMIT
# UseCRLF: false StatementMacros:
UseTab: Always - Q_UNUSED
# WhitespaceSensitiveMacros: - QT_REQUIRE_VERSION
# - STRINGIZE TabWidth: 4
# - PP_STRINGIZE UseTab: Never
# - BOOST_PP_STRINGIZE VerilogBreakBetweenInstancePorts: true
# - NS_SWIFT_NAME WhitespaceSensitiveMacros:
# - CF_SWIFT_NAME - BOOST_PP_STRINGIZE
--- - CF_SWIFT_NAME
### C++ specific config ### - NS_SWIFT_NAME
Language: Cpp - PP_STRINGIZE
Standard: c++17 - STRINGIZE
---
### ObjC specific config ###
Language: ObjC
# ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
---
### Java specific config ###
Language: Java
# BreakAfterJavaFieldAnnotations: false
JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax']
...

86
design/design.svg Normal file
View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="297mm"
height="210mm"
viewBox="0 0 297 210"
version="1.1"
id="svg1"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
sodipodi:docname="design.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#999999"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="1.4456739"
inkscape:cx="457.57206"
inkscape:cy="455.4969"
inkscape:current-layer="layer1" />
<defs
id="defs1">
<inkscape:path-effect
effect="fillet_chamfer"
id="path-effect2"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,0,1,0,1.9526687,0,1 @ F,0,0,1,0,8.1210291,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,4.1953263,0,1 @ F,0,0,1,0,0,0,1"
radius="0"
unit="px"
method="auto"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
d="m 76.912699,128.73488 c -3.09378,0 -5.58467,2.49037 -5.58467,5.58415 l 0,4.79808 h -11.92954 c -1.07857,-1e-4 -1.95295,0.87428 -1.95285,1.95285 v 14.17528 c 4e-5,4.48525 3.63622,8.12119 8.12147,8.12095 h 35.371481 c 33.27233,-0.0457 61.77036,-2.57674 69.51411,-20.2855 0.92724,-2.12046 -0.51796,-3.96358 -2.83497,-3.96358 h -35.2564 l 0,-4.79808 c 0,-3.09378 -2.49089,-5.58415 -5.58468,-5.58415 z"
style="fill:#999999;stroke-width:0.793999;stroke-linejoin:round"
id="path3"
sodipodi:nodetypes="ssccccccsscsss" />
<path
style="fill:none;stroke-width:0.793999;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;stroke-dasharray:0.79399902,0.79399902;stroke-dashoffset:0"
d="m 101.04647,132.07152 c 0,0 -1.204305,-26.60929 2.69533,-39.856586 3.89964,-13.247293 7.97132,-9.5197 7.97132,-9.5197"
id="path4" />
<g
id="g6"
transform="rotate(-45,103.30016,66.792882)">
<circle
style="fill:#1b1b1b;fill-opacity:1;stroke:none;stroke-width:0.509709;stroke-linejoin:round;stroke-dasharray:0.509709, 0.509709;stroke-dashoffset:0;stroke-opacity:1"
id="path5"
cx="82.723785"
cy="86.363235"
r="3.0717413" />
<path
style="fill:none;fill-opacity:1;stroke:#ae6215;stroke-width:0.793999;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 82.723785,83.291496 c 0,0 -0.01513,-1.283369 0.456975,-1.648864"
id="path6" />
<rect
style="fill:#1b1b1b;fill-opacity:1;stroke:none;stroke-width:0.793999;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect6"
width="1.6455212"
height="1.0793402"
x="81.880798"
y="82.756508"
ry="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,3 @@
[gd_scene format=3 uid="uid://3qb27d8vkjku"]
[node name="Level" type="Level"]

27
src/entrance.cpp Normal file
View File

@ -0,0 +1,27 @@
#include "entrance.hpp"
#include "level.hpp"
namespace godot {
void Entrance::_bind_methods() {}
void Entrance::_enter_tree() {
this->seek_parent_level();
if(parentLevel != nullptr) {
parentLevel->add_entrance(this);
}
}
void Entrance::_exit_tree() {
if(parentLevel != nullptr)
parentLevel->remove_entrance(this);
}
Level *Entrance::seek_parent_level() {
Node *current = this;
do {
current = current->get_parent();
if(Level *level = Object::cast_to<Level>(current))
return level;
} while(current != nullptr);
return nullptr;
}
}

22
src/entrance.hpp Normal file
View File

@ -0,0 +1,22 @@
#ifndef ENTRANCE_HPP
#define ENTRANCE_HPP
#include "godot_cpp/classes/node3d.hpp"
namespace godot {
class Level;
class Entrance : public Node3D {
GDCLASS(Entrance, Node3D)
static void _bind_methods();
protected:
Level *parentLevel;
public:
virtual void _enter_tree() override;
virtual void _exit_tree() override;
protected:
Level *seek_parent_level();
};
}
#endif // !ENTRANCE_HPP

24
src/game_mode.hpp Normal file
View File

@ -0,0 +1,24 @@
#ifndef GAME_STATE_HPP
#define GAME_STATE_HPP
#include "godot_cpp/classes/node.hpp"
#include "godot_cpp/classes/packed_scene.hpp"
namespace godot {
class Level;
class Player;
class GameState : public Node {
GDCLASS(GameState, Node)
static void _bind_methods();
protected:
Level *currentLevel{nullptr};
Ref<PackedScene> firstLevel{};
Player *playerInstance{nullptr};
public:
void load_level(Ref<PackedScene> levelScene);
};
}
#endif // !GAME_STATE_HPP

30
src/level.cpp Normal file
View File

@ -0,0 +1,30 @@
#include "level.hpp"
#include "entrance.hpp"
#include "godot_cpp/variant/utility_functions.hpp"
namespace godot {
void Level::_bind_methods() {}
Transform3D Level::get_entrance(String entranceName) {
if(entrances.has(entranceName)) {
Node3D *entrance = Object::cast_to<Node3D>(this->entrances[entranceName]);
return entrance->get_global_transform();
} else {
return this->get_global_transform();
}
}
void Level::add_entrance(Entrance *entrance) {
String key = entrance->get_name();
if(this->entrances.has(key))
UtilityFunctions::push_error("Attempt to register entrance ", key, " with duplicate key");
this->entrances[key] = entrance;
}
void Level::remove_entrance(Entrance *entrance) {
String key = entrance->get_name();
if(!this->entrances.has(key))
UtilityFunctions::push_error("Attempt to deregister entrance ", key, " without registering it");
this->entrances.erase(key);
}
}

24
src/level.hpp Normal file
View File

@ -0,0 +1,24 @@
#ifndef LEVEL_HPP
#define LEVEL_HPP
#include "godot_cpp/classes/node3d.hpp"
#include "godot_cpp/variant/dictionary.hpp"
#include "godot_cpp/variant/string.hpp"
#include "godot_cpp/variant/transform3d.hpp"
namespace godot {
class Entrance;
class Level : public Node3D {
GDCLASS(Level, Node3D)
static void _bind_methods();
protected:
Dictionary entrances{};
public:
Transform3D get_entrance(String entranceName);
void add_entrance(Entrance *entrance);
void remove_entrance(Entrance *entrance);
};
}
#endif // !LEVEL_HPP

13
src/player.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "player.hpp"
#include "godot_cpp/classes/animation_tree.hpp"
#include "godot_cpp/classes/node3d.hpp"
namespace godot {
void Player::_bind_methods() {}
void Player::_enter_tree() {
this->model = this->get_node<Node3D>("Model");
this->animTree = this->get_node<AnimationTree>("Model/AnimationTree");
}
void Player::_process(double deltaTime) {}
void Player::_physics_process(double deltaTime) {}
} // namespace godot

23
src/player.hpp Normal file
View File

@ -0,0 +1,23 @@
#ifndef PLAYER_HPP
#define PLAYER_HPP
#include "godot_cpp/classes/animation_tree.hpp"
#include "godot_cpp/classes/character_body3d.hpp"
namespace godot {
class Player : public CharacterBody3D {
GDCLASS(Player, CharacterBody3D)
static void _bind_methods();
protected:
Node3D *model{nullptr};
AnimationTree *animTree{nullptr};
public:
virtual void _enter_tree() override;
virtual void _process(double deltaTime) override;
virtual void _physics_process(double deltaTime) override;
};
} // namespace godot
#endif // !PLAYER_HPP

View File

@ -4,24 +4,33 @@
#include <godot_cpp/core/defs.hpp> #include <godot_cpp/core/defs.hpp>
#include <godot_cpp/godot.hpp> #include <godot_cpp/godot.hpp>
#include "player.hpp"
#include "level.hpp"
#include "entrance.hpp"
using namespace godot; using namespace godot;
void initialize_gdextension_types(ModuleInitializationLevel p_level) void initialize_gdextension_types(ModuleInitializationLevel p_level) {
{ if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { return;
return; }
} ClassDB::register_class<Player>();
ClassDB::register_class<Level>();
ClassDB::register_class<Entrance>();
} }
extern "C" extern "C" {
{ // Initialization
// Initialization GDExtensionBool GDE_EXPORT
GDExtensionBool GDE_EXPORT pvb_practice_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) pvb_practice_init(GDExtensionInterfaceGetProcAddress p_get_proc_address,
{ GDExtensionClassLibraryPtr p_library,
GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization); GDExtensionInitialization* r_initialization) {
init_obj.register_initializer(initialize_gdextension_types); GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library,
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE); r_initialization);
init_obj.register_initializer(initialize_gdextension_types);
init_obj.set_minimum_library_initialization_level(
MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init(); return init_obj.init();
} }
} }