Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GrapheneBox2DLayout

[12:14] static extends: object

Generated struct layout helper for GIR record Box2D.

Methods

  • layout ()

    Returns the Panama struct layout for Box2D.

class: GrapheneBox2D

[28:7] extends: object

A 2D box, described as the axis-aligned area between a minimum and a maximum vertices lying on the same plane.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GrapheneBox2D (Handle = null)

    Allocates a new #graphene_box2d_t. The contents of the returned structure are undefined.

    • @p Handle is an optional native handle or wrapper whose handle to adopt; when the native constructor is called.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • contains_box (object b)

    Checks whether the #graphene_box2d_t @a contains the given #graphene_box2d_t @b.

    • @p b is a #graphene_box2d_t.
    • @r true if the box is contained in the given box.
  • contains_point (object point)

    Checks whether @box contains the given @point.

    • @p point is the coordinates to check.
    • @r true if the point is contained in the given box.
  • contains_rect (object rect)

    Checks whether @box contains the given @rect.

    • @p rect is the rectangle to check.
    • @r true if the rectangle is contained in the given box.
  • equal (object b)

    Checks whether the two given boxes are equal.

    • @p b is a #graphene_box2d_t.
    • @r true if the boxes are equal.
  • expand (object point)

    Expands the dimensions of @box to include the coordinates at @point.

    • @p point is the coordinates of the point to include.
    • @p res is return location for the expanded box.
    • @r None.
  • expand_scalar (double scalar)

    Expands the dimensions of @box by the given @scalar value. If @scalar is positive, the #graphene_box2d_t will grow; if @scalar is negative, the #graphene_box2d_t will shrink.

    • @p scalar is a scalar value.
    • @p res is return location for the expanded box.
    • @r None.
  • expand_vec2 (object vec)

    Expands the dimensions of @box to include the coordinates of the given vector.

    • @p vec is the coordinates of the point to include, as a #graphene_vec2_t.
    • @p res is return location for the expanded box.
    • @r None.
  • free ()

    Frees the resources allocated by graphene_box2d_alloc().

    • @r None.
  • get_center ()

    Retrieves the coordinates of the center of a #graphene_box2d_t.

    • @p center is return location for the coordinates of the center.
    • @r None.
  • get_height ()

    Retrieves the size of the @box on the Y axis.

    • @r the height of the box.
  • get_max ()

    Retrieves the coordinates of the maximum point of the given #graphene_box2d_t.

    • @p max is return location for the maximum point.
    • @r None.
  • get_min ()

    Retrieves the coordinates of the minimum point of the given #graphene_box2d_t.

    • @p min is return location for the minimum point.
    • @r None.
  • get_minmax ()

    Retrieves the coordinates of the minimum and maximum points of the given #graphene_box2d_t.

    • @p min is return location for the minimum point.
    • @p max is return location for the maximum point.
    • @r None.
  • get_size ()

    Retrieves the size of the box on all three axes, and stores it into the given @size vector.

    • @p size is return location for the size.
    • @r None.
  • get_vertices ()

    Computes the vertices of the given #graphene_box2d_t.

    • @p vertices is return location for an array of 4 #graphene_vec2_t.
    • @r None.
  • get_width ()

    Retrieves the size of the @box on the X axis.

    • @r the width of the box.
  • init (object min, object max)

    Initializes the given #graphene_box2d_t with two vertices.

    • @p min is the coordinates of the minimum vertex.
    • @p max is the coordinates of the maximum vertex.
    • @r the initialized #graphene_box2d_t.
  • init_from_box (object src)

    Initializes the given #graphene_box2d_t with the vertices of another #graphene_box2d_t.

    • @p src is a #graphene_box2d_t.
    • @r the initialized #graphene_box2d_t.
  • init_from_points (list points)

    Initializes the given #graphene_box2d_t with the given array of vertices. If @n_points is 0, the returned box is initialized with graphene_box2d_empty().

    • @p n_points is the number #graphene_point_t in the @points array.
    • @p points is an array of #graphene_point_t.
    • @r the initialized #graphene_box2d_t.
  • init_from_rect (object src)

    Initializes the given #graphene_box2d_t with the origin and size of a #graphene_rect_t.

    • @p src is a #graphene_rect_t.
    • @r the initialized #graphene_box2d_t.
  • init_from_vec2 (object min, object max)

    Initializes the given #graphene_box2d_t with two vertices stored inside #graphene_vec2_t.

    • @p min is the coordinates of the minimum vertex.
    • @p max is the coordinates of the maximum vertex.
    • @r the initialized #graphene_box2d_t.
  • init_from_vectors (list vectors)

    Initializes the given #graphene_box2d_t with the given array of vertices. If @n_vectors is 0, the returned box is initialized with graphene_box2d_empty().

    • @p n_vectors is the number #graphene_vec2_t in the @vectors array.
    • @p vectors is an array of #graphene_vec2_t.
    • @r the initialized #graphene_box2d_t.
  • intersection (object b)

    Intersects the two given #graphene_box2d_t. If the two boxes do not intersect, @res will contain a degenerate box initialized with graphene_box2d_empty().

    • @p b is a #graphene_box2d_t.
    • @p res is return location for the result.
    • @r true if the two boxes intersect.
  • intersects (object b)

    Checks whether two boxes intersect. See also: graphene_box2d_intersection()

    • @p b is a #graphene_box2d_t.
    • @r true if the boxes intersect, and false otherwise.
  • scale_offset (object scale, object offset)

    Applies a scale and an offset to the vertices of the given box. If @scale is %NULL, the box will be scaled by (1.0, 1.0). If @offset is %NULL, the box will be offset by (0.0, 0.0).

    • @p scale is a vector with two scaling factors to be applied to the box.
    • @p offset is the offset to apply to the box.
    • @p res is the transformed box.
    • @r None.
  • to_float ()

    Stores the minimum and maximum vertices of the given #graphene_box2d_t into an array. The array layout is: - min_x - min_y - max_x - max_y

    • @p v is return location for an array of floating point values with at least 4 elements.
    • @r None.
  • to_rect ()

    Stores the minimum and maximum vertices of the given #graphene_box2d_t into a rectangle of equivalent origin and size.

    • @p rect is the rectangle to initialize.
    • @r None.
  • union (object b)

    Unions the two given #graphene_box2d_t.

    • @p b is the box to union to @a.
    • @p res is return location for the result.
    • @r None.