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
- Regex: '^<.*\.h>'
Priority: 2 Priority: 2
- Regex: '^<.*' SortPriority: 0
CaseSensitive: false
- Regex: ^<.*\.h>
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: ^<.*
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: .*
Priority: 3 Priority: 3
# IncludeIsMainRegex: '(Test)?$' SortPriority: 0
# IncludeIsMainSourceRegex: '' CaseSensitive: false
# IndentAccessModifiers: 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
# InsertTrailingCommas: None InsertBraces: false
# JavaScriptQuotes: Leave InsertNewlineAtEOF: false
# JavaScriptWrapImports: true InsertTrailingCommas: None
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: ''
# MacroBlockEnd: ''
# MaxEmptyLinesToKeep: 1
# NamespaceIndentation: None
# PenaltyBreakAssignment: 2
# PenaltyBreakBeforeFirstCallParameter: 19
# PenaltyBreakComment: 300
# PenaltyBreakFirstLessLess: 120
# PenaltyBreakOpenParenthesis: 0
# PenaltyBreakString: 1000
# PenaltyBreakTemplateDeclaration: 10
# PenaltyExcessCharacter: 1000000
# PenaltyReturnTypeOnItsOwnLine: 60
# PenaltyIndentedWhitespace: 0
# PointerAlignment: Right
# PPIndentWidth: -1
# ReferenceAlignment: Pointer
# ReflowComments: true
# RemoveBracesLLVM: false
# SeparateDefinitionBlocks: Leave
# ShortNamespaceLines: 1
# SortIncludes: CaseSensitive
# SortJavaStaticImport: Before
# SortUsingDeclarations: true
# SpaceAfterCStyleCast: false
# SpaceAfterLogicalNot: false
# SpaceAfterTemplateKeyword: true
# SpaceBeforeAssignmentOperators: true
# SpaceBeforeCaseColon: false
# SpaceBeforeCpp11BracedList: false
# SpaceBeforeCtorInitializerColon: true
# SpaceBeforeInheritanceColon: true
# SpaceBeforeParens: ControlStatements
# SpaceBeforeParensOptions:
# AfterControlStatements: true
# AfterForeachMacros: true
# AfterFunctionDefinitionName: false
# AfterFunctionDeclarationName: false
# AfterIfMacros: true
# AfterOverloadedOperator: false
# BeforeNonEmptyParentheses: false
# SpaceAroundPointerQualifiers: Default
# SpaceBeforeRangeBasedForLoopColon: true
# SpaceInEmptyBlock: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles: Never
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
## our comment capitalization at the same time.
SpacesInLineCommentPrefix:
Minimum: 0
Maximum: -1
# SpacesInParentheses: false
# SpacesInSquareBrackets: false
# SpaceBeforeSquareBrackets: false
# BitFieldColonSpacing: Both
# StatementAttributeLikeMacros:
# - Q_EMIT
# StatementMacros:
# - Q_UNUSED
# - QT_REQUIRE_VERSION
TabWidth: 4
# UseCRLF: false
UseTab: Always
# WhitespaceSensitiveMacros:
# - STRINGIZE
# - PP_STRINGIZE
# - BOOST_PP_STRINGIZE
# - NS_SWIFT_NAME
# - CF_SWIFT_NAME
---
### C++ specific config ###
Language: Cpp Language: Cpp
Standard: c++17 LineEnding: DeriveLF
--- MacroBlockBegin: ""
### ObjC specific config ### MacroBlockEnd: ""
Language: ObjC MaxEmptyLinesToKeep: 1
# ObjCBinPackProtocolList: Auto NamespaceIndentation: None
ObjCBlockIndentWidth: 4 ObjCBinPackProtocolList: Never
# ObjCBreakBeforeNestedBlockParam: true ObjCBlockIndentWidth: 2
# ObjCSpaceAfterProperty: false ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceBeforeProtocolList: true ObjCSpaceAfterProperty: false
--- ObjCSpaceBeforeProtocolList: true
### Java specific config ### PPIndentWidth: -1
Language: Java PackConstructorInitializers: NextLine
# BreakAfterJavaFieldAnnotations: false PenaltyBreakAssignment: 2
JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax'] PenaltyBreakBeforeFirstCallParameter: 10
... PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
QualifierAlignment: Leave
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- c++
- C++
CanonicalDelimiter: ""
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- 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:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InConditionalStatements: false
InCStyleCasts: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE

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,23 +4,32 @@
#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 pvb_practice_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) GDExtensionBool GDE_EXPORT
{ pvb_practice_init(GDExtensionInterfaceGetProcAddress p_get_proc_address,
GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization); GDExtensionClassLibraryPtr p_library,
GDExtensionInitialization* r_initialization) {
GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library,
r_initialization);
init_obj.register_initializer(initialize_gdextension_types); init_obj.register_initializer(initialize_gdextension_types);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE); init_obj.set_minimum_library_initialization_level(
MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init(); return init_obj.init();
} }