From 9e86471b2f28a5d0f32be79419c3923f7e75fdd2 Mon Sep 17 00:00:00 2001 From: JupiterRider <60042618+JupiterRider@users.noreply.github.com> Date: Fri, 7 Apr 2023 21:22:05 +0200 Subject: [PATCH] Remove deprecaded functions, fix build errors/warnings --- raylib/external/qoaplay.c | 4 ++-- raylib/rcamera.go | 40 ++------------------------------------- raylib/rlgl.go | 6 +++--- raylib/rmodels.go | 11 ----------- raylib/rtextures.go | 22 --------------------- 5 files changed, 7 insertions(+), 76 deletions(-) diff --git a/raylib/external/qoaplay.c b/raylib/external/qoaplay.c index 549e9f7..7f937f4 100644 --- a/raylib/external/qoaplay.c +++ b/raylib/external/qoaplay.c @@ -62,7 +62,7 @@ typedef struct { extern "C" { // Prevents name mangling of functions #endif -qoaplay_desc *qoaplay_open(char *path); +qoaplay_desc *qoaplay_open(const char *path); qoaplay_desc *qoaplay_open_memory(const unsigned char *data, int data_size); void qoaplay_close(qoaplay_desc *qoa_ctx); @@ -83,7 +83,7 @@ int qoaplay_get_frame(qoaplay_desc *qoa_ctx); //---------------------------------------------------------------------------------- // Open QOA file, keep FILE pointer to keep reading from file -qoaplay_desc *qoaplay_open(char *path) +qoaplay_desc *qoaplay_open(const char *path) { FILE *file = fopen(path, "rb"); if (!file) return NULL; diff --git a/raylib/rcamera.go b/raylib/rcamera.go index f651645..c99c550 100644 --- a/raylib/rcamera.go +++ b/raylib/rcamera.go @@ -8,44 +8,8 @@ package rl */ import "C" -// SetCameraMode - Set camera mode (multiple camera modes available) -func SetCameraMode(camera Camera, mode CameraMode) { - ccamera := camera.cptr() - cmode := (C.int)(mode) - C.SetCameraMode(*ccamera, cmode) -} - // UpdateCamera - Update camera position for selected mode -func UpdateCamera(camera *Camera) { +func UpdateCamera(camera *Camera, mode CameraMode) { ccamera := camera.cptr() - C.UpdateCamera(ccamera) -} - -// SetCameraPanControl - Set camera pan key to combine with mouse movement (free camera) -func SetCameraPanControl(panKey int32) { - cpanKey := (C.int)(panKey) - C.SetCameraPanControl(cpanKey) -} - -// SetCameraAltControl - Set camera alt key to combine with mouse movement (free camera) -func SetCameraAltControl(altKey int32) { - caltKey := (C.int)(altKey) - C.SetCameraAltControl(caltKey) -} - -// SetCameraSmoothZoomControl - Set camera smooth zoom key to combine with mouse (free camera) -func SetCameraSmoothZoomControl(szKey int32) { - cszKey := (C.int)(szKey) - C.SetCameraSmoothZoomControl(cszKey) -} - -// SetCameraMoveControls - Set camera move controls (1st person and 3rd person cameras) -func SetCameraMoveControls(frontKey int32, backKey int32, rightKey int32, leftKey int32, upKey int32, downKey int32) { - cfrontKey := (C.int)(frontKey) - cbackKey := (C.int)(backKey) - crightKey := (C.int)(rightKey) - cleftKey := (C.int)(leftKey) - cupKey := (C.int)(upKey) - cdownKey := (C.int)(downKey) - C.SetCameraMoveControls(cfrontKey, cbackKey, crightKey, cleftKey, cupKey, cdownKey) + C.UpdateCamera(ccamera, C.int(mode)) } diff --git a/raylib/rlgl.go b/raylib/rlgl.go index b418deb..a1f4997 100644 --- a/raylib/rlgl.go +++ b/raylib/rlgl.go @@ -986,11 +986,11 @@ func GetShaderBufferSize(id uint32) uint32 { } // BindImageTexture - Bind image texture -func BindImageTexture(id uint32, index uint32, format uint32, readonly int32) { +func BindImageTexture(id uint32, index uint32, format int32, readonly bool) { cid := C.uint(id) cindex := C.uint(index) - cformat := C.uint(format) - creadonly := C.int(readonly) + cformat := C.int(format) + creadonly := C.bool(readonly) C.rlBindImageTexture(cid, cindex, cformat, creadonly) } diff --git a/raylib/rmodels.go b/raylib/rmodels.go index 9635d99..1a7c239 100644 --- a/raylib/rmodels.go +++ b/raylib/rmodels.go @@ -97,17 +97,6 @@ func DrawCubeWiresV(position Vector3, size Vector3, col color.RGBA) { C.DrawCubeWiresV(*cposition, *csize, *ccolor) } -// DrawCubeTexture - Draw cube textured -func DrawCubeTexture(texture Texture2D, position Vector3, width float32, height float32, length float32, col color.RGBA) { - ctexture := texture.cptr() - cposition := position.cptr() - cwidth := (C.float)(width) - cheight := (C.float)(height) - clength := (C.float)(length) - ccolor := colorCptr(col) - C.DrawCubeTexture(*ctexture, *cposition, cwidth, cheight, clength, *ccolor) -} - // DrawSphere - Draw sphere func DrawSphere(centerPos Vector3, radius float32, col color.RGBA) { ccenterPos := centerPos.cptr() diff --git a/raylib/rtextures.go b/raylib/rtextures.go index a74d7c0..98358e0 100644 --- a/raylib/rtextures.go +++ b/raylib/rtextures.go @@ -686,28 +686,6 @@ func DrawTextureRec(texture Texture2D, sourceRec Rectangle, position Vector2, ti C.DrawTextureRec(*ctexture, *csourceRec, *cposition, *ctint) } -// DrawTextureQuad - Draw texture quad with tiling and offset parameters -func DrawTextureQuad(texture Texture2D, tiling, offset Vector2, rectangle Rectangle, tint color.RGBA) { - ctexture := texture.cptr() - ctiling := tiling.cptr() - coffset := offset.cptr() - crectangle := rectangle.cptr() - ctint := colorCptr(tint) - C.DrawTextureQuad(*ctexture, *ctiling, *coffset, *crectangle, *ctint) -} - -// DrawTextureTiled - Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest -func DrawTextureTiled(texture Texture2D, sourceRec, destRec Rectangle, origin Vector2, rotation float32, scale float32, tint color.RGBA) { - ctexture := texture.cptr() - csourceRec := sourceRec.cptr() - cdestRec := destRec.cptr() - corigin := origin.cptr() - crotation := (C.float)(rotation) - cscale := (C.float)(scale) - ctint := colorCptr(tint) - C.DrawTextureTiled(*ctexture, *csourceRec, *cdestRec, *corigin, crotation, cscale, *ctint) -} - // DrawTexturePro - Draw a part of a texture defined by a rectangle with 'pro' parameters func DrawTexturePro(texture Texture2D, sourceRec, destRec Rectangle, origin Vector2, rotation float32, tint color.RGBA) { ctexture := texture.cptr()