2022-04-05 14:51:59 -04:00
|
|
|
#include <Godot.hpp>
|
|
|
|
|
2022-04-11 13:30:51 -04:00
|
|
|
#include "state_machine/StateMachine.h"
|
|
|
|
#include "state_machine/State.h"
|
2022-04-05 14:51:59 -04:00
|
|
|
#include "Main.h"
|
2022-04-11 13:30:51 -04:00
|
|
|
#include "player/Player.h"
|
|
|
|
#include "player/states/PlayerIdle.h"
|
|
|
|
#include "player/states/PlayerMove.h"
|
|
|
|
#include "player/states/PlayerJump.h"
|
|
|
|
#include "player/states/PlayerFall.h"
|
2022-04-05 14:51:59 -04:00
|
|
|
|
|
|
|
using namespace godot;
|
|
|
|
|
2022-04-13 00:59:23 -04:00
|
|
|
/**
|
|
|
|
* @brief This function connects the gdnative init function.
|
|
|
|
*
|
|
|
|
*/
|
2022-04-05 14:51:59 -04:00
|
|
|
extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o)
|
|
|
|
{
|
|
|
|
Godot::gdnative_init(o);
|
|
|
|
}
|
|
|
|
|
2022-04-13 00:59:23 -04:00
|
|
|
/**
|
|
|
|
* @brief This function connects the gdnative terminate function.
|
|
|
|
*
|
|
|
|
*/
|
2022-04-05 14:51:59 -04:00
|
|
|
extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *o)
|
|
|
|
{
|
|
|
|
// This next line is a workaround to fix bug:
|
|
|
|
// https://github.com/godotengine/godot/issues/48295
|
|
|
|
Godot::nativescript_terminate(_RegisterState::nativescript_handle);
|
|
|
|
Godot::gdnative_terminate(o);
|
|
|
|
}
|
|
|
|
|
2022-04-13 00:59:23 -04:00
|
|
|
/**
|
|
|
|
* @brief This function connects the init methods in the classes to godot's gdnative.
|
|
|
|
*
|
|
|
|
*/
|
2022-04-05 14:51:59 -04:00
|
|
|
extern "C" void GDN_EXPORT godot_nativescript_init(void *handle)
|
|
|
|
{
|
|
|
|
Godot::nativescript_init(handle);
|
2022-04-09 22:16:27 -04:00
|
|
|
register_class<StateMachine>();
|
|
|
|
register_class<State>();
|
2022-04-11 13:30:51 -04:00
|
|
|
register_class<main::Main>();
|
|
|
|
register_class<player::Player>();
|
|
|
|
register_class<player::PlayerIdle>();
|
|
|
|
register_class<player::PlayerMove>();
|
|
|
|
register_class<player::PlayerJump>();
|
|
|
|
register_class<player::PlayerFall>();
|
2022-04-05 14:51:59 -04:00
|
|
|
}
|