mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-21 11:26:53 +01:00
78 lines
2.5 KiB
C++
78 lines
2.5 KiB
C++
|
|
|
|
#include "terrain_2d_structure.h"
|
|
|
|
bool Terrain2DStructure::get_use_rect() const {
|
|
return _use_rect;
|
|
}
|
|
void Terrain2DStructure::set_use_rect(const bool value) {
|
|
_use_rect = value;
|
|
}
|
|
|
|
Rect2 Terrain2DStructure::get_chunk_rect() const {
|
|
return _chunk_rect;
|
|
}
|
|
void Terrain2DStructure::set_chunk_rect(const Rect2 &value) {
|
|
_chunk_rect = value;
|
|
}
|
|
|
|
int Terrain2DStructure::get_position_x() const {
|
|
return _position_x;
|
|
}
|
|
void Terrain2DStructure::set_position_x(const int value) {
|
|
_position_x = value;
|
|
}
|
|
|
|
int Terrain2DStructure::get_position_y() const {
|
|
return _position_y;
|
|
}
|
|
void Terrain2DStructure::set_position_y(const int value) {
|
|
_position_y = value;
|
|
}
|
|
|
|
void Terrain2DStructure::set_position(const int x, const int y) {
|
|
_position_x = x;
|
|
_position_y = y;
|
|
}
|
|
|
|
void Terrain2DStructure::write_to_chunk(Ref<Terrain2DChunk> chunk) {
|
|
ERR_FAIL_COND(!chunk.is_valid());
|
|
|
|
if (has_method("_write_to_chunk")) {
|
|
call("_write_to_chunk", chunk);
|
|
}
|
|
}
|
|
|
|
Terrain2DStructure::Terrain2DStructure() {
|
|
_use_rect = true;
|
|
_position_x = 0;
|
|
_position_y = 0;
|
|
}
|
|
|
|
Terrain2DStructure::~Terrain2DStructure() {
|
|
}
|
|
|
|
void Terrain2DStructure::_bind_methods() {
|
|
BIND_VMETHOD(MethodInfo("_write_to_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk")));
|
|
|
|
ClassDB::bind_method(D_METHOD("get_use_rect"), &Terrain2DStructure::get_use_rect);
|
|
ClassDB::bind_method(D_METHOD("set_use_rect", "value"), &Terrain2DStructure::set_use_rect);
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_rect"), "set_use_rect", "get_use_rect");
|
|
|
|
ClassDB::bind_method(D_METHOD("get_chunk_rect"), &Terrain2DStructure::get_chunk_rect);
|
|
ClassDB::bind_method(D_METHOD("set_chunk_rect", "value"), &Terrain2DStructure::set_chunk_rect);
|
|
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "chunk_rect"), "set_chunk_rect", "get_chunk_rect");
|
|
|
|
ClassDB::bind_method(D_METHOD("get_position_x"), &Terrain2DStructure::get_position_x);
|
|
ClassDB::bind_method(D_METHOD("set_position_x", "value"), &Terrain2DStructure::set_position_x);
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "position_x"), "set_position_x", "get_position_x");
|
|
|
|
ClassDB::bind_method(D_METHOD("get_position_y"), &Terrain2DStructure::get_position_y);
|
|
ClassDB::bind_method(D_METHOD("set_position_y", "value"), &Terrain2DStructure::set_position_y);
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "position_y"), "set_position_y", "get_position_y");
|
|
|
|
ClassDB::bind_method(D_METHOD("set_position", "x", "y"), &Terrain2DStructure::set_position);
|
|
|
|
ClassDB::bind_method(D_METHOD("write_to_chunk", "chunk"), &Terrain2DStructure::write_to_chunk);
|
|
}
|