use crate::ode::ds::{dsFunctions_C, Tdrawstuff};
use std::ffi::{c_uint, c_int, c_char};
pub use drawstuff::drawstuff::*;
pub struct Drawstuff {
}
impl Tdrawstuff for Drawstuff {
fn Debug(&self, msg: *const c_char) {
unsafe {
dsDebug(msg); }
}
fn Error(&self, msg: *const c_char) {
unsafe {
dsError(msg); }
}
fn Print(&self, msg: *const c_char) {
unsafe {
dsPrint(msg); }
}
fn DrawBox(&self, pos: *const f32, rot: *const f32, lxyz: *const f32) {
unsafe {
dsDrawBox(pos, rot, lxyz);
}
}
fn DrawBoxD(&self, pos: *const f64, rot: *const f64, lxyz: *const f64) {
unsafe {
dsDrawBoxD(pos, rot, lxyz);
}
}
fn DrawCapsule(&self, pos: *const f32, rot: *const f32, l: f32, r: f32) {
unsafe {
dsDrawCapsule(pos, rot, l, r);
}
}
fn DrawCapsuleD(&self, pos: *const f64, rot: *const f64, l: f32, r: f32) {
unsafe {
dsDrawCapsuleD(pos, rot, l, r);
}
}
fn DrawConvex(&self, pos: *const f32, rot: *const f32,
planes: *const f32, planecount: c_uint,
points: *const f32, pointcount: c_uint,
polygons: *const c_uint) {
unsafe {
dsDrawConvex(pos, rot, planes, planecount, points, pointcount, polygons);
}
}
fn DrawConvexD(&self, pos: *const f64, rot: *const f64,
planes: *const f64, planecount: c_uint,
points: *const f64, pointcount: c_uint,
polygons: *const c_uint) {
unsafe {
dsDrawConvexD(pos, rot, planes, planecount, points, pointcount, polygons);
}
}
fn DrawCylinder(&self, pos: *const f32, rot: *const f32, l: f32, r: f32) {
unsafe {
dsDrawCylinder(pos, rot, l, r);
}
}
fn DrawCylinderD(&self, pos: *const f64, rot: *const f64, l: f32, r: f32) {
unsafe {
dsDrawCylinderD(pos, rot, l, r);
}
}
fn DrawLine(&self, pos1: *const f32, pos2: *const f32) {
unsafe {
dsDrawLine(pos1, pos2);
}
}
fn DrawLineD(&self, pos1: *const f64, pos2: *const f64) {
unsafe {
dsDrawLineD(pos1, pos2);
}
}
fn DrawSphere(&self, pos: *const f32, rot: *const f32, radius: f32) {
unsafe {
dsDrawSphere(pos, rot, radius);
}
}
fn DrawSphereD(&self, pos: *const f64, rot: *const f64, radius: f32) {
unsafe {
dsDrawSphereD(pos, rot, radius);
}
}
fn DrawTriangle(&self, pos: *const f32, rot: *const f32,
v0: *const f32, v1: *const f32, v2: *const f32, solid: c_int) {
unsafe {
dsDrawTriangle(pos, rot, v0, v1, v2, solid);
}
}
fn DrawTriangleD(&self, pos: *const f64, rot: *const f64,
v0: *const f64, v1: *const f64, v2: *const f64, solid: c_int) {
unsafe {
dsDrawTriangleD(pos, rot, v0, v1, v2, solid);
}
}
fn DrawTriangles(&self, pos: *const f32, rot: *const f32,
v: *const f32, n: c_int, solid: c_int) {
unsafe {
dsDrawTriangles(pos, rot, v, n, solid);
}
}
fn DrawTrianglesD(&self, pos: *const f64, rot: *const f64,
v: *const f64, n: c_int, solid: c_int) {
unsafe {
dsDrawTrianglesD(pos, rot, v, n, solid);
}
}
fn ElapsedTime(&self) -> f64 {
unsafe {
dsElapsedTime()
}
}
fn GetViewpoint(&self, xyz: *mut f32, hpr: *mut f32) {
unsafe {
dsGetViewpoint(xyz, hpr);
}
}
fn SetCapsuleQuality(&self, n: c_int) {
unsafe {
dsSetCapsuleQuality(n);
}
}
fn SetColor(&self, red: f32, green: f32, blue: f32) {
unsafe {
dsSetColor(red, green, blue);
}
}
fn SetColorAlpha(&self, red: f32, green: f32, blue: f32, alpha: f32) {
unsafe {
dsSetColorAlpha(red, green, blue, alpha);
}
}
fn SetDrawMode(&self, mode: c_int) {
unsafe {
dsSetDrawMode(mode);
}
}
fn SetSphereQuality(&self, n: c_int) {
unsafe {
dsSetSphereQuality(n);
}
}
fn SetTexture(&self, texture_number: c_int) {
unsafe {
dsSetTexture(texture_number);
}
}
fn SetViewpoint(&self, xyz: *mut f32, hpr: *mut f32) {
unsafe {
dsSetViewpoint(xyz, hpr);
}
}
fn SimulationLoop(&self, argc: c_int, argv: *mut *mut c_char,
window_width: c_int, window_height: c_int, functions: *mut dsFunctions_C) {
unsafe {
dsSimulationLoop(argc, argv, window_width, window_height,
functions as *mut dsFunctions); }
}
fn Stop(&self) {
unsafe {
dsStop();
}
}
}
impl Drawstuff {
pub fn new() -> Self {
Drawstuff{}
}
pub fn dispose(&mut self) {
()
}
}
impl Drop for Drawstuff {
fn drop(&mut self) {
self.dispose();
}
}