Skip to content

Allow unsafe access to underlying C3D structs, perhaps toggled with a feature #79

@AmiuLittle

Description

@AmiuLittle

This probably goes against the point of a safe rust wrapper, but if this can be done it would allow people to interface with other c libraries that are not part of this project.

For example, unsafe access to the underlying C3D_RenderTarget pointer from Target<'screen> can allow someone to use citro2d-sys like so:

...

// assuming that we are in Instance::render_frame_with and a cast_lifetime_to_closure function exists
let render_to = cast_lifetime_to_closure(|pass, target| {
  pass.select_render_target(target).expect("Unable to set render target");
  unsafe {
    C2D_SceneTarget(target.as_raw()); // as_raw would return a *mut pointer, just like the private function
  }

...

I know that y'all are wrapping citro2d into this project, but it's an easy example to reach for given the current state of things.

I came across this while developing my own 3DS game engine in rust. I want to use as much of citro3d-rs as I can, but I can't use citro2d if I use citro3d-rs in it's current state. :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions