summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/Array.cpp5
-rw-r--r--src/core/Dictionary.cpp5
-rw-r--r--src/core/Image.cpp130
-rw-r--r--src/core/InputEvent.cpp279
-rw-r--r--src/core/NodePath.cpp4
-rw-r--r--src/core/RID.cpp9
-rw-r--r--src/core/Variant.cpp20
7 files changed, 4 insertions, 448 deletions
diff --git a/src/core/Array.cpp b/src/core/Array.cpp
index e610e1b..4c80499 100644
--- a/src/core/Array.cpp
+++ b/src/core/Array.cpp
@@ -131,11 +131,6 @@ void Array::invert()
godot_array_invert(&_godot_array);
}
-bool Array::is_shared() const
-{
- return godot_array_is_shared(&_godot_array);
-}
-
Variant Array::pop_back()
{
godot_variant v = godot_array_pop_back(&_godot_array);
diff --git a/src/core/Dictionary.cpp b/src/core/Dictionary.cpp
index 7ac6312..8ea2d17 100644
--- a/src/core/Dictionary.cpp
+++ b/src/core/Dictionary.cpp
@@ -49,11 +49,6 @@ Array Dictionary::keys() const
return *(Array *) &a;
}
-int Dictionary::parse_json(const String& json)
-{
- return godot_dictionary_parse_json(&_godot_dictionary, (godot_string *) &json);
-}
-
Variant &Dictionary::operator [](const Variant& key)
{
return *(Variant *) godot_dictionary_operator_index(&_godot_dictionary, (godot_variant *) &key);
diff --git a/src/core/Image.cpp b/src/core/Image.cpp
deleted file mode 100644
index 4206115..0000000
--- a/src/core/Image.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-#include "Image.hpp"
-
-#include "Defs.hpp"
-
-#include "Vector2.hpp"
-#include "Rect2.hpp"
-#include "Color.hpp"
-#include "String.hpp"
-
-#include "PoolArrays.hpp"
-
-#include <godot/godot_image.h>
-
-namespace godot {
-
-Image::Image()
-{
- godot_image_new(&_godot_image);
-}
-
-Image::Image(const int width, const int height, const bool mipmaps, const Format format)
-{
- godot_image_new_with_size_format(&_godot_image, width, height, mipmaps, (godot_image_format) format);
-}
-
-void Image::blit_rect(const Image& src, const Rect2& src_rect, const Vector2& dest)
-{
- // @DLScript @Todo
-}
-
-void Image::brush_transfer(const Image& src, const Image& brush, const Vector2& pos)
-{
- // @DLScript @Todo
-}
-
-Image Image::brushed(const Image& src, const Image& brush, const Vector2& pos)
-{
- return *this; // @DLScript @Todo
-}
-
-Image Image::compressed(const Format format)
-{
- return *this; // @DLScript @Todo
-}
-
-Image Image::converted(const Format format)
-{
- return *this; // @DLScript @Todo
-}
-
-Image Image::decompressed()
-{
- return *this; // @DLScript @Todo
-}
-
-bool Image::empty() const
-{
- return true; // @DLScript @Todo
-}
-
-void Image::fix_alpha_edges()
-{
- // @DLScript @Todo
-}
-
-
-PoolByteArray Image::get_data()
-{
- // @Todo
- return PoolByteArray();
-}
-
-
-Image::Format Image::get_format() const
-{
- return Format::FORMAT_RGBAH; // @DLScript @Todo
-}
-
-int Image::get_height() const
-{
- return godot_image_get_height(&_godot_image);
-}
-
-Color Image::get_pixel(const int x, const int y, const int mipmap_level)
-{
- return Color(); // @DLScript @Todo
-}
-
-Image Image::get_rect(const Rect2& area)
-{
- return *this; // @DLScript @Todo
-}
-
-Rect2 Image::get_used_rect() const
-{
- return Rect2(); // @DLScript @Todo
-}
-
-int Image::get_width() const
-{
- return godot_image_get_width(&_godot_image);
-}
-
-Error Image::load(const String& path)
-{
- return (Error) godot_image_load(&_godot_image, (godot_string *) &path);
-}
-
-void Image::put_pixel(const int x, const int y, const Color& color, int mipmap_level)
-{
- // @DLScript @Todo
-}
-
-Image Image::resized(const int x, const int y, const Interpolation interpolation)
-{
- return *this; // @DLScript @Todo
-}
-
-Error Image::save_png(const String& path)
-{
- return (Error) godot_image_save_png(&_godot_image, (godot_string *) &path); // @Todo Error enum
-}
-
-Image::~Image()
-{
- godot_image_destroy(&_godot_image);
-}
-
-
-}
diff --git a/src/core/InputEvent.cpp b/src/core/InputEvent.cpp
deleted file mode 100644
index b0080c4..0000000
--- a/src/core/InputEvent.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-#include "InputEvent.hpp"
-
-#include <cstdint>
-#include <memory.h>
-
-#include "Vector2.hpp"
-#include "Transform2D.hpp"
-
-#include <cmath>
-
-#include "String.hpp"
-
-namespace godot {
-
-
-bool InputEvent::operator==(const InputEvent &p_event) const {
- if (type != p_event.type){
- return false;
- }
-
- switch(type) {
- /** Current clang-format style doesn't play well with the aligned return values of that switch. */
- /* clang-format off */
- case NONE:
- return true;
- case KEY:
- return key.unicode == p_event.key.unicode
- && key.scancode == p_event.key.scancode
- && key.echo == p_event.key.echo
- && key.pressed == p_event.key.pressed
- && key.mod == p_event.key.mod;
- case MOUSE_MOTION:
- return mouse_motion.x == p_event.mouse_motion.x
- && mouse_motion.y == p_event.mouse_motion.y
- && mouse_motion.relative_x == p_event.mouse_motion.relative_x
- && mouse_motion.relative_y == p_event.mouse_motion.relative_y
- && mouse_motion.button_mask == p_event.mouse_motion.button_mask
- && key.mod == p_event.key.mod;
- case MOUSE_BUTTON:
- return mouse_button.pressed == p_event.mouse_button.pressed
- && mouse_button.x == p_event.mouse_button.x
- && mouse_button.y == p_event.mouse_button.y
- && mouse_button.button_index == p_event.mouse_button.button_index
- && mouse_button.button_mask == p_event.mouse_button.button_mask
- && key.mod == p_event.key.mod;
- case JOYPAD_MOTION:
- return joy_motion.axis == p_event.joy_motion.axis
- && joy_motion.axis_value == p_event.joy_motion.axis_value;
- case JOYPAD_BUTTON:
- return joy_button.pressed == p_event.joy_button.pressed
- && joy_button.button_index == p_event.joy_button.button_index
- && joy_button.pressure == p_event.joy_button.pressure;
- case SCREEN_TOUCH:
- return screen_touch.pressed == p_event.screen_touch.pressed
- && screen_touch.index == p_event.screen_touch.index
- && screen_touch.x == p_event.screen_touch.x
- && screen_touch.y == p_event.screen_touch.y;
- case SCREEN_DRAG:
- return screen_drag.index == p_event.screen_drag.index
- && screen_drag.x == p_event.screen_drag.x
- && screen_drag.y == p_event.screen_drag.y;
- case ACTION:
- return action.action == p_event.action.action
- && action.pressed == p_event.action.pressed;
- /* clang-format on */
- default:
- ERR_PRINT(String("No logic to compare InputEvents of this type, this shouldn't happen."));
- }
-
- return false;
-}
-InputEvent::operator String() const {
- /*
- String str ="Device "+itos(device)+" ID "+itos(ID)+" ";
-
- switch(type) {
-
- case NONE: {
-
- return "Event: None";
- } break;
- case KEY: {
-
- str+= "Event: Key ";
- str=str+"Unicode: "+String::chr(key.unicode)+" Scan: "+itos( key.scancode )+" Echo: "+String(key.echo?"True":"False")+" Pressed"+String(key.pressed?"True":"False")+" Mod: ";
- if (key.mod.shift)
- str+="S";
- if (key.mod.control)
- str+="C";
- if (key.mod.alt)
- str+="A";
- if (key.mod.meta)
- str+="M";
-
- return str;
- } break;
- case MOUSE_MOTION: {
-
- str+= "Event: Motion ";
- str=str+" Pos: " +itos(mouse_motion.x)+","+itos(mouse_motion.y)+" Rel: "+itos(mouse_motion.relative_x)+","+itos(mouse_motion.relative_y)+" Mask: ";
- for (int i=0;i<8;i++) {
-
- if ((1<<i)&mouse_motion.button_mask)
- str+=itos(i+1);
- }
- str+=" Mod: ";
- if (key.mod.shift)
- str+="S";
- if (key.mod.control)
- str+="C";
- if (key.mod.alt)
- str+="A";
- if (key.mod.meta)
- str+="M";
-
- return str;
- } break;
- case MOUSE_BUTTON: {
- str+= "Event: Button ";
- str=str+"Pressed: "+itos(mouse_button.pressed)+" Pos: " +itos(mouse_button.x)+","+itos(mouse_button.y)+" Button: "+itos(mouse_button.button_index)+" Mask: ";
- for (int i=0;i<8;i++) {
-
- if ((1<<i)&mouse_button.button_mask)
- str+=itos(i+1);
- }
- str+=" Mod: ";
- if (key.mod.shift)
- str+="S";
- if (key.mod.control)
- str+="C";
- if (key.mod.alt)
- str+="A";
- if (key.mod.meta)
- str+="M";
-
- str+=String(" DoubleClick: ")+(mouse_button.doubleclick?"Yes":"No");
-
- return str;
-
- } break;
- case JOYPAD_MOTION: {
- str+= "Event: JoypadMotion ";
- str=str+"Axis: "+itos(joy_motion.axis)+" Value: " +rtos(joy_motion.axis_value);
- return str;
-
- } break;
- case JOYPAD_BUTTON: {
- str+= "Event: JoypadButton ";
- str=str+"Pressed: "+itos(joy_button.pressed)+" Index: " +itos(joy_button.button_index)+" pressure "+rtos(joy_button.pressure);
- return str;
-
- } break;
- case SCREEN_TOUCH: {
- str+= "Event: ScreenTouch ";
- str=str+"Pressed: "+itos(screen_touch.pressed)+" Index: " +itos(screen_touch.index)+" pos "+rtos(screen_touch.x)+","+rtos(screen_touch.y);
- return str;
-
- } break;
- case SCREEN_DRAG: {
- str+= "Event: ScreenDrag ";
- str=str+" Index: " +itos(screen_drag.index)+" pos "+rtos(screen_drag.x)+","+rtos(screen_drag.y);
- return str;
-
- } break;
- case ACTION: {
- str+= "Event: Action: "+InputMap::get_singleton()->get_action_from_id(action.action)+" Pressed: "+itos(action.pressed);
- return str;
-
- } break;
-
- }
- */
-
- return "";
-}
-
-void InputEvent::set_as_action(const String& p_action, bool p_pressed) {
-
- godot_input_event_set_as_action((godot_input_event *) this, (godot_string*) &p_action, p_pressed);
-}
-
-bool InputEvent::is_pressed() const {
-
- switch(type) {
-
- case KEY: return key.pressed;
- case MOUSE_BUTTON: return mouse_button.pressed;
- case JOYPAD_BUTTON: return joy_button.pressed;
- case SCREEN_TOUCH: return screen_touch.pressed;
- case JOYPAD_MOTION: return ::fabs(joy_motion.axis_value) > 0.5;
- case ACTION: return action.pressed;
- default: {}
- }
-
- return false;
-}
-
-bool InputEvent::is_echo() const {
-
- return (type==KEY && key.echo);
-}
-
-bool InputEvent::is_action(const String& p_action) const {
-
- return godot_input_event_is_action((godot_input_event *) this, (godot_string *) &p_action);
-}
-
-bool InputEvent::is_action_pressed(const String& p_action) const {
-
- return is_action(p_action) && is_pressed() && !is_echo();
-}
-
-bool InputEvent::is_action_released(const String& p_action) const {
-
- return is_action(p_action) && !is_pressed();
-}
-
-
-InputEvent InputEvent::xform_by(const Transform2D& p_xform) const {
-
-
- InputEvent ev=*this;
-
- switch(ev.type) {
-
- case InputEvent::MOUSE_BUTTON: {
-
- Vector2 g = p_xform.xform(Vector2(ev.mouse_button.global_x,ev.mouse_button.global_y));
- Vector2 l = p_xform.xform(Vector2(ev.mouse_button.x,ev.mouse_button.y));
- ev.mouse_button.x=l.x;
- ev.mouse_button.y=l.y;
- ev.mouse_button.global_x=g.x;
- ev.mouse_button.global_y=g.y;
-
- } break;
- case InputEvent::MOUSE_MOTION: {
-
- Vector2 g = p_xform.xform(Vector2(ev.mouse_motion.global_x,ev.mouse_motion.global_y));
- Vector2 l = p_xform.xform(Vector2(ev.mouse_motion.x,ev.mouse_motion.y));
- Vector2 r = p_xform.basis_xform(Vector2(ev.mouse_motion.relative_x,ev.mouse_motion.relative_y));
- Vector2 s = p_xform.basis_xform(Vector2(ev.mouse_motion.speed_x,ev.mouse_motion.speed_y));
- ev.mouse_motion.x=l.x;
- ev.mouse_motion.y=l.y;
- ev.mouse_motion.global_x=g.x;
- ev.mouse_motion.global_y=g.y;
- ev.mouse_motion.relative_x=r.x;
- ev.mouse_motion.relative_y=r.y;
- ev.mouse_motion.speed_x=s.x;
- ev.mouse_motion.speed_y=s.y;
-
- } break;
- case InputEvent::SCREEN_TOUCH: {
-
-
- Vector2 t = p_xform.xform(Vector2(ev.screen_touch.x,ev.screen_touch.y));
- ev.screen_touch.x=t.x;
- ev.screen_touch.y=t.y;
-
- } break;
- case InputEvent::SCREEN_DRAG: {
-
-
- Vector2 t = p_xform.xform(Vector2(ev.screen_drag.x,ev.screen_drag.y));
- Vector2 r = p_xform.basis_xform(Vector2(ev.screen_drag.relative_x,ev.screen_drag.relative_y));
- Vector2 s = p_xform.basis_xform(Vector2(ev.screen_drag.speed_x,ev.screen_drag.speed_y));
- ev.screen_drag.x=t.x;
- ev.screen_drag.y=t.y;
- ev.screen_drag.relative_x=r.x;
- ev.screen_drag.relative_y=r.y;
- ev.screen_drag.speed_x=s.x;
- ev.screen_drag.speed_y=s.y;
- } break;
- }
-
- return ev;
-}
-
-
-}
diff --git a/src/core/NodePath.cpp b/src/core/NodePath.cpp
index e5e784b..08ec27a 100644
--- a/src/core/NodePath.cpp
+++ b/src/core/NodePath.cpp
@@ -17,7 +17,7 @@ NodePath::NodePath(const NodePath &other)
{
String from = other;
godot_node_path_new(&_node_path, (godot_string *) &from);
- godot_node_path_copy(&_node_path, &other._node_path);
+ godot_node_path_operator_equal(&_node_path, &other._node_path);
}
NodePath::NodePath(const String &from)
@@ -79,7 +79,7 @@ NodePath::operator String() const
void NodePath::operator =(const NodePath& other)
{
- godot_node_path_copy(&_node_path, &other._node_path);
+ godot_node_path_operator_equal(&_node_path, &other._node_path);
}
NodePath::~NodePath()
diff --git a/src/core/RID.cpp b/src/core/RID.cpp
index 2343475..1431a8a 100644
--- a/src/core/RID.cpp
+++ b/src/core/RID.cpp
@@ -7,17 +7,12 @@ namespace godot {
RID::RID(Object *p)
{
- godot_rid_new(&_godot_rid, p);
+ godot_rid_new_with_resource(&_godot_rid, (const godot_object *) p);
}
int32_t RID::get_rid() const
{
- return godot_rid_get_rid(&_godot_rid);
-}
-
-RID::~RID()
-{
- godot_rid_destroy(&_godot_rid);
+ return godot_rid_get_id(&_godot_rid);
}
diff --git a/src/core/Variant.cpp b/src/core/Variant.cpp
index 7b66547..7a4d575 100644
--- a/src/core/Variant.cpp
+++ b/src/core/Variant.cpp
@@ -129,11 +129,6 @@ Variant::Variant(const Color& p_color)
godot_variant_new_color(&_godot_variant, (godot_color *) &p_color);
}
-Variant::Variant(const Image& p_image)
-{
- godot_variant_new_image(&_godot_variant, (godot_image *) &p_image);
-}
-
Variant::Variant(const NodePath& p_path)
{
godot_variant_new_node_path(&_godot_variant, (godot_node_path *) &p_path);
@@ -149,11 +144,6 @@ Variant::Variant(const Object* p_object)
godot_variant_new_object(&_godot_variant, (godot_object *) p_object);
}
-Variant::Variant(const InputEvent& p_input_event)
-{
- godot_variant_new_input_event(&_godot_variant, (godot_input_event *) &p_input_event);
-}
-
Variant::Variant(const Dictionary& p_dictionary)
{
godot_variant_new_dictionary(&_godot_variant, (godot_dictionary *) &p_dictionary);
@@ -317,11 +307,6 @@ Variant::operator Color() const
godot_color s = godot_variant_as_color(&_godot_variant);
return *(Color *) &s;
}
-Variant::operator Image() const
-{
- godot_image s = godot_variant_as_image(&_godot_variant);
- return *(Image *) &s;
-}
Variant::operator NodePath() const
{
godot_node_path s = godot_variant_as_node_path(&_godot_variant);
@@ -332,11 +317,6 @@ Variant::operator RID() const
godot_rid s = godot_variant_as_rid(&_godot_variant);
return *(RID *) &s;
}
-Variant::operator InputEvent() const
-{
- godot_input_event s = godot_variant_as_input_event(&_godot_variant);
- return *(InputEvent *) &s;
-}
Variant::operator Dictionary() const
{