feature/state_machine #5
20
src/Main.cpp
20
src/Main.cpp
@ -55,39 +55,39 @@ void Main::_physics_process(float delta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Main::set_full_screen(bool new_full_screen)
|
void Main::set_full_screen(bool full_screen)
|
||||||
{
|
{
|
||||||
full_screen = new_full_screen;
|
this->full_screen = full_screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Main::get_full_screen()
|
bool Main::get_full_screen()
|
||||||
{
|
{
|
||||||
return full_screen;
|
return this->full_screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Main::set_window_size(Vector2 new_window_size)
|
void Main::set_window_size(Vector2 window_size)
|
||||||
{
|
{
|
||||||
window_size = new_window_size;
|
this-> window_size = window_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 Main::get_window_size()
|
Vector2 Main::get_window_size()
|
||||||
{
|
{
|
||||||
return window_size;
|
return this->window_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Main::set_launch_screen(int8_t new_launch_screen)
|
void Main::set_launch_screen(int8_t launch_screen)
|
||||||
{
|
{
|
||||||
launch_screen = new_launch_screen;
|
this->launch_screen = launch_screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t Main::get_launch_screen()
|
int8_t Main::get_launch_screen()
|
||||||
{
|
{
|
||||||
if (launch_screen == -1)
|
if (this->launch_screen == -1)
|
||||||
{
|
{
|
||||||
return _os->get_current_screen();
|
return _os->get_current_screen();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return launch_screen;
|
return this->launch_screen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
src/Main.h
12
src/Main.h
@ -89,9 +89,9 @@ namespace godot
|
|||||||
/**
|
/**
|
||||||
* @brief Set the full screen object.
|
* @brief Set the full screen object.
|
||||||
*
|
*
|
||||||
* @param[in] new_full_screen The new full screen state.
|
* @param[in] full_screen The new full screen state.
|
||||||
*/
|
*/
|
||||||
void set_full_screen(bool new_full_screen);
|
void set_full_screen(bool full_screen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the full screen object.
|
* @brief Get the full screen object.
|
||||||
@ -104,9 +104,9 @@ namespace godot
|
|||||||
/**
|
/**
|
||||||
* @brief Set the window size object.
|
* @brief Set the window size object.
|
||||||
*
|
*
|
||||||
* @param[in] new_window_size The new window size.
|
* @param[in] window_size The new window size.
|
||||||
*/
|
*/
|
||||||
void set_window_size(Vector2 new_window_size);
|
void set_window_size(Vector2 window_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the window size object.
|
* @brief Get the window size object.
|
||||||
@ -118,9 +118,9 @@ namespace godot
|
|||||||
/**
|
/**
|
||||||
* @brief Set the launch screen object.
|
* @brief Set the launch screen object.
|
||||||
*
|
*
|
||||||
* @param[in] new_launch_screen The launch screen to use.
|
* @param[in] launch_screen The launch screen to use.
|
||||||
*/
|
*/
|
||||||
void set_launch_screen(int8_t new_launch_screen);
|
void set_launch_screen(int8_t launch_screen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the launch screen object.
|
* @brief Get the launch screen object.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "Player.h"
|
#include "player/Player.h"
|
||||||
|
|
||||||
#include <Camera2D.hpp>
|
#include <Camera2D.hpp>
|
||||||
#include <TileMap.hpp>
|
#include <TileMap.hpp>
|
||||||
@ -112,54 +112,54 @@ void Player::_physics_process(float delta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::set_sprite_frames(Ref<SpriteFrames> new_sprite_frames)
|
void Player::set_sprite_frames(Ref<SpriteFrames> sprite_frames)
|
||||||
{
|
{
|
||||||
sprite_frames = new_sprite_frames;
|
this->sprite_frames = sprite_frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<SpriteFrames> Player::get_sprite_frames()
|
Ref<SpriteFrames> Player::get_sprite_frames()
|
||||||
{
|
{
|
||||||
return sprite_frames;
|
return this->sprite_frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::set_speed(float new_speed)
|
void Player::set_speed(float speed)
|
||||||
{
|
{
|
||||||
speed = new_speed;
|
this->speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Player::get_speed()
|
float Player::get_speed()
|
||||||
{
|
{
|
||||||
return speed;
|
return this->speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::set_jump_force(float new_jump_force)
|
void Player::set_jump_force(float jump_force)
|
||||||
{
|
{
|
||||||
jump_force = new_jump_force;
|
this->jump_force = jump_force;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Player::get_jump_force()
|
float Player::get_jump_force()
|
||||||
{
|
{
|
||||||
return jump_force;
|
return this->jump_force;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::set_gravity(float new_gravity)
|
void Player::set_gravity(float gravity)
|
||||||
{
|
{
|
||||||
gravity = new_gravity;
|
this->gravity = gravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Player::get_gravity()
|
float Player::get_gravity()
|
||||||
{
|
{
|
||||||
return gravity;
|
return this->gravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::set_run_speed(float new_run_speed)
|
void Player::set_run_speed(float run_speed)
|
||||||
{
|
{
|
||||||
run_speed = new_run_speed;
|
this->run_speed = run_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Player::get_run_speed()
|
float Player::get_run_speed()
|
||||||
{
|
{
|
||||||
return run_speed;
|
return this->run_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::set_double_jump(bool double_jump)
|
void Player::set_double_jump(bool double_jump)
|
||||||
|
@ -112,9 +112,9 @@ namespace godot
|
|||||||
/**
|
/**
|
||||||
* @brief Set the sprite frames object.
|
* @brief Set the sprite frames object.
|
||||||
*
|
*
|
||||||
* @param[in] new_sprite_frames The new sprite frame.
|
* @param[in] sprite_frames The new sprite frame.
|
||||||
*/
|
*/
|
||||||
void set_sprite_frames(Ref<SpriteFrames> new_sprite_frames);
|
void set_sprite_frames(Ref<SpriteFrames> sprite_frames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the sprite frames object.
|
* @brief Get the sprite frames object.
|
||||||
@ -126,9 +126,9 @@ namespace godot
|
|||||||
/**
|
/**
|
||||||
* @brief Set the speed object.
|
* @brief Set the speed object.
|
||||||
*
|
*
|
||||||
* @param[in] new_speed The new speed.
|
* @param[in] speed The new speed.
|
||||||
*/
|
*/
|
||||||
void set_speed(float new_speed);
|
void set_speed(float speed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the speed object.
|
* @brief Get the speed object.
|
||||||
@ -140,9 +140,9 @@ namespace godot
|
|||||||
/**
|
/**
|
||||||
* @brief Set the jump force object.
|
* @brief Set the jump force object.
|
||||||
*
|
*
|
||||||
* @param[in] new_jump_force The new force applied to the player to make him jump.
|
* @param[in] jump_force The new force applied to the player to make him jump.
|
||||||
*/
|
*/
|
||||||
void set_jump_force(float new_jump_force);
|
void set_jump_force(float jump_force);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the jump force object.
|
* @brief Get the jump force object.
|
||||||
@ -154,9 +154,9 @@ namespace godot
|
|||||||
/**
|
/**
|
||||||
* @brief Set the gravity object.
|
* @brief Set the gravity object.
|
||||||
*
|
*
|
||||||
* @param[in] new_gravity The new gravity to apply to the player.
|
* @param[in] gravity The new gravity to apply to the player.
|
||||||
*/
|
*/
|
||||||
void set_gravity(float new_gravity);
|
void set_gravity(float gravity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the gravity object.
|
* @brief Get the gravity object.
|
||||||
@ -168,9 +168,9 @@ namespace godot
|
|||||||
/**
|
/**
|
||||||
* @brief Set the run speed object.
|
* @brief Set the run speed object.
|
||||||
*
|
*
|
||||||
* @param[in] new_run_speed The new speed for running.
|
* @param[in] run_speed The new speed for running.
|
||||||
*/
|
*/
|
||||||
void set_run_speed(float new_run_speed);
|
void set_run_speed(float run_speed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the run speed object.
|
* @brief Get the run speed object.
|
||||||
|
@ -33,9 +33,9 @@ void State::_state_exit(const String state, const Array args)
|
|||||||
WARN_PRINT("State " + state + " is missing its _state_exit method!");
|
WARN_PRINT("State " + state + " is missing its _state_exit method!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void State::set_parent(Node *new_parent)
|
void State::set_parent(Node *parent)
|
||||||
{
|
{
|
||||||
parent = new_parent;
|
this->parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *State::get_parent()
|
Node *State::get_parent()
|
||||||
@ -43,12 +43,12 @@ Node *State::get_parent()
|
|||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void State::set_state_machine(StateMachine *new_state_machine)
|
void State::set_state_machine(StateMachine *state_machine)
|
||||||
{
|
{
|
||||||
state_machine = new_state_machine;
|
this->state_machine = state_machine;
|
||||||
}
|
}
|
||||||
|
|
||||||
StateMachine *State::get_state_machine()
|
StateMachine *State::get_state_machine()
|
||||||
{
|
{
|
||||||
return state_machine;
|
return this->state_machine;
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ namespace godot
|
|||||||
|
|
||||||
virtual void _state_exit(const String state, const Array args = Array());
|
virtual void _state_exit(const String state, const Array args = Array());
|
||||||
|
|
||||||
virtual void set_parent(Node *new_parent) final;
|
virtual void set_parent(Node *parent) final;
|
||||||
|
|
||||||
virtual Node *get_parent() final;
|
virtual Node *get_parent() final;
|
||||||
|
|
||||||
virtual void set_state_machine(StateMachine *new_state_machine) final;
|
virtual void set_state_machine(StateMachine *state_machine) final;
|
||||||
|
|
||||||
virtual StateMachine *get_state_machine() final;
|
virtual StateMachine *get_state_machine() final;
|
||||||
};
|
};
|
||||||
|
@ -155,24 +155,24 @@ Variant StateMachine::_call(const String method, const Array &args)
|
|||||||
return this->call(method, args);
|
return this->call(method, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StateMachine::set_default_state(const String new_default_state)
|
void StateMachine::set_default_state(const String default_state)
|
||||||
{
|
{
|
||||||
default_state = new_default_state;
|
this->default_state = default_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
String StateMachine::get_default_state()
|
String StateMachine::get_default_state()
|
||||||
{
|
{
|
||||||
return default_state;
|
return this->default_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StateMachine::set_current_state(const String new_current_sate)
|
void StateMachine::set_current_state(const String current_sate)
|
||||||
{
|
{
|
||||||
current_state = new_current_sate;
|
this->current_state = current_sate;
|
||||||
}
|
}
|
||||||
|
|
||||||
String StateMachine::get_current_state()
|
String StateMachine::get_current_state()
|
||||||
{
|
{
|
||||||
return current_state;
|
return this->current_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StateMachine::set_debug(bool debug)
|
void StateMachine::set_debug(bool debug)
|
||||||
|
@ -74,7 +74,7 @@ namespace godot
|
|||||||
return _call(method, Array::make(args...));
|
return _call(method, Array::make(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_default_state(const String new_default_state);
|
void set_default_state(const String default_state);
|
||||||
|
|
||||||
String get_default_state();
|
String get_default_state();
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ namespace godot
|
|||||||
|
|
||||||
bool get_debug();
|
bool get_debug();
|
||||||
|
|
||||||
void set_current_state(const String new_current_state);
|
void set_current_state(const String current_state);
|
||||||
|
|
||||||
String get_current_state();
|
String get_current_state();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user