ShadowApex / godot-go

Go language bindings for the Godot Engine's GDNative API.
MIT License
363 stars 31 forks source link

Implement all Godot Variant types in Go. #5

Closed ShadowApex closed 6 years ago

ShadowApex commented 7 years ago

Currently we support basic Godot variant type like godot_string, godot_int, etc. We need to finish implementing the other types as their own Go structures that wrap around the underlying variant.

pastaq commented 7 years ago

Working on Vector2/Vector3.

pastaq commented 7 years ago

Vector 2: https://github.com/ShadowApex/godot-go/pull/14

pastaq commented 7 years ago

Vector3: https://github.com/ShadowApex/godot-go/pull/15

ShadowApex commented 7 years ago

@pastaq I noticed some errors after pulling in your code. Here's the problems I see a lot:

func (v *Vector2) Abs() Vector2 {
    var newVec2 Vector2
    newVec2.vector2 = C.godot_vector2_abs(v.vector2)

    return newVec2
}

The C.godot_vector2_abs() function returns a C.godot_vector2 object, not a *C.godot_vector2. It should instead be implemented like this:

func (v *Vector2) Abs() Vector2 {
    var newVec2 C.godot_vector2
    newVec2 = C.godot_vector2_abs(v.vector2)

    return &Vector2{vector: &newVec2}
}
pastaq commented 7 years ago

Fixed https://github.com/ShadowApex/godot-go/pull/16

pastaq commented 7 years ago

Basis: https://github.com/ShadowApex/godot-go/pull/17

pastaq commented 6 years ago

Quat: https://github.com/ShadowApex/godot-go/pull/20

pastaq commented 6 years ago

Rect2, Rect3, RID update: https://github.com/ShadowApex/godot-go/pull/21

pastaq commented 6 years ago

Color: https://github.com/ShadowApex/godot-go/pull/22