Use stdbool

This commit is contained in:
Milan Nikolic 2018-10-10 14:55:03 +02:00
parent 8db71e7851
commit 8d36ebe392
10 changed files with 42 additions and 40 deletions

View file

@ -39,7 +39,7 @@ func CloseAudioDevice() {
// IsAudioDeviceReady - Check if audio device has been initialized successfully
func IsAudioDeviceReady() bool {
ret := C.IsAudioDeviceReady()
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -135,7 +135,7 @@ func StopSound(sound Sound) {
func IsSoundPlaying(sound Sound) bool {
csound := sound.cptr()
ret := C.IsSoundPlaying(*csound)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -241,7 +241,7 @@ func ResumeMusicStream(music Music) {
func IsMusicPlaying(music Music) bool {
cmusic := *(*C.Music)(unsafe.Pointer(&music))
ret := C.IsMusicPlaying(cmusic)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -311,7 +311,7 @@ func CloseAudioStream(stream AudioStream) {
func IsAudioBufferProcessed(stream AudioStream) bool {
cstream := stream.cptr()
ret := C.IsAudioBufferProcessed(*cstream)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}

View file

@ -34,7 +34,7 @@ package rl
#include "external/glfw/src/egl_context.c"
#include "external/glfw/src/osmesa_context.c"
#cgo linux CFLAGS: -Iexternal -Iexternal/glfw/include -DPLATFORM_DESKTOP
#cgo linux CFLAGS: -Iexternal -Iexternal/glfw/include -DPLATFORM_DESKTOP -Wno-stringop-overflow
#cgo linux,!wayland LDFLAGS: -lGL -lm -pthread -ldl -lrt -lX11
#cgo linux,wayland LDFLAGS: -lGL -lm -pthread -ldl -lrt -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon

View file

@ -58,21 +58,21 @@ func CloseWindow() {
// IsWindowReady - Check if window has been initialized successfully
func IsWindowReady() bool {
ret := C.IsWindowReady()
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
// WindowShouldClose - Detect if KEY_ESCAPE pressed or Close icon pressed
func WindowShouldClose() bool {
ret := C.WindowShouldClose()
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
// IsWindowMinimized - Detect if window has been minimized (or lost focus)
func IsWindowMinimized() bool {
ret := C.IsWindowMinimized()
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -409,7 +409,7 @@ func StorageLoadValue(position int32) int32 {
func IsKeyPressed(key int32) bool {
ckey := (C.int)(key)
ret := C.IsKeyPressed(ckey)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -417,7 +417,7 @@ func IsKeyPressed(key int32) bool {
func IsKeyDown(key int32) bool {
ckey := (C.int)(key)
ret := C.IsKeyDown(ckey)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -425,7 +425,7 @@ func IsKeyDown(key int32) bool {
func IsKeyReleased(key int32) bool {
ckey := (C.int)(key)
ret := C.IsKeyReleased(ckey)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -433,7 +433,7 @@ func IsKeyReleased(key int32) bool {
func IsKeyUp(key int32) bool {
ckey := (C.int)(key)
ret := C.IsKeyUp(ckey)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -454,7 +454,7 @@ func SetExitKey(key int32) {
func IsGamepadAvailable(gamepad int32) bool {
cgamepad := (C.int)(gamepad)
ret := C.IsGamepadAvailable(cgamepad)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -464,7 +464,7 @@ func IsGamepadName(gamepad int32, name string) bool {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
ret := C.IsGamepadName(cgamepad, cname)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -481,7 +481,7 @@ func IsGamepadButtonPressed(gamepad, button int32) bool {
cgamepad := (C.int)(gamepad)
cbutton := (C.int)(button)
ret := C.IsGamepadButtonPressed(cgamepad, cbutton)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -490,7 +490,7 @@ func IsGamepadButtonDown(gamepad, button int32) bool {
cgamepad := (C.int)(gamepad)
cbutton := (C.int)(button)
ret := C.IsGamepadButtonDown(cgamepad, cbutton)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -499,7 +499,7 @@ func IsGamepadButtonReleased(gamepad, button int32) bool {
cgamepad := (C.int)(gamepad)
cbutton := (C.int)(button)
ret := C.IsGamepadButtonReleased(cgamepad, cbutton)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -508,7 +508,7 @@ func IsGamepadButtonUp(gamepad, button int32) bool {
cgamepad := (C.int)(gamepad)
cbutton := (C.int)(button)
ret := C.IsGamepadButtonUp(cgamepad, cbutton)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -540,7 +540,7 @@ func GetGamepadAxisMovement(gamepad, axis int32) float32 {
func IsMouseButtonPressed(button int32) bool {
cbutton := (C.int)(button)
ret := C.IsMouseButtonPressed(cbutton)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -548,7 +548,7 @@ func IsMouseButtonPressed(button int32) bool {
func IsMouseButtonDown(button int32) bool {
cbutton := (C.int)(button)
ret := C.IsMouseButtonDown(cbutton)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -556,7 +556,7 @@ func IsMouseButtonDown(button int32) bool {
func IsMouseButtonReleased(button int32) bool {
cbutton := (C.int)(button)
ret := C.IsMouseButtonReleased(cbutton)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -564,7 +564,7 @@ func IsMouseButtonReleased(button int32) bool {
func IsMouseButtonUp(button int32) bool {
cbutton := (C.int)(button)
ret := C.IsMouseButtonUp(cbutton)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}

View file

@ -16,7 +16,7 @@ func SetGesturesEnabled(gestureFlags uint32) {
func IsGestureDetected(gesture Gestures) bool {
cgesture := (C.int)(gesture)
ret := C.IsGestureDetected(cgesture)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}

View file

@ -413,7 +413,7 @@ func CheckCollisionSpheres(centerA Vector3, radiusA float32, centerB Vector3, ra
ccenterB := centerB.cptr()
cradiusB := (C.float)(radiusB)
ret := C.CheckCollisionSpheres(*ccenterA, cradiusA, *ccenterB, cradiusB)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -422,7 +422,7 @@ func CheckCollisionBoxes(box1 BoundingBox, box2 BoundingBox) bool {
cbox1 := box1.cptr()
cbox2 := box2.cptr()
ret := C.CheckCollisionBoxes(*cbox1, *cbox2)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -432,7 +432,7 @@ func CheckCollisionBoxSphere(box BoundingBox, centerSphere Vector3, radiusSphere
ccenterSphere := centerSphere.cptr()
cradiusSphere := (C.float)(radiusSphere)
ret := C.CheckCollisionBoxSphere(*cbox, *ccenterSphere, cradiusSphere)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -442,7 +442,7 @@ func CheckCollisionRaySphere(ray Ray, spherePosition Vector3, sphereRadius float
cspherePosition := spherePosition.cptr()
csphereRadius := (C.float)(sphereRadius)
ret := C.CheckCollisionRaySphere(*cray, *cspherePosition, csphereRadius)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -453,7 +453,7 @@ func CheckCollisionRaySphereEx(ray Ray, spherePosition Vector3, sphereRadius flo
csphereRadius := (C.float)(sphereRadius)
ccollisionPoint := collisionPoint.cptr()
ret := C.CheckCollisionRaySphereEx(*cray, *cspherePosition, csphereRadius, ccollisionPoint)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -462,6 +462,6 @@ func CheckCollisionRayBox(ray Ray, box BoundingBox) bool {
cray := ray.cptr()
cbox := box.cptr()
ret := C.CheckCollisionRayBox(*cray, *cbox)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}

View file

@ -42,7 +42,7 @@ func HideCursor() {
// IsCursorHidden - Returns true if cursor is not visible
func IsCursorHidden() bool {
ret := C.IsCursorHidden()
v := bool(int(ret) == 1)
v := bool(ret)
return v
}

View file

@ -42,7 +42,7 @@ func HideCursor() {
// IsCursorHidden - Returns true if cursor is not visible
func IsCursorHidden() bool {
ret := C.IsCursorHidden()
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -59,7 +59,7 @@ func DisableCursor() {
// IsFileDropped - Check if a file have been dropped into window
func IsFileDropped() bool {
ret := C.IsFileDropped()
v := bool(int(ret) == 1)
v := bool(ret)
return v
}

View file

@ -355,7 +355,9 @@
// Structures Definition
//----------------------------------------------------------------------------------
// Boolean type
#if !defined(__cplusplus) && !defined(bool)
#if defined(__STDC__) && __STDC_VERSION__ >= 199901L
#include <stdbool.h>
#elif !defined(__cplusplus) && !defined(bool)
typedef enum { false, true } bool;
#endif

View file

@ -209,7 +209,7 @@ func CloseVrSimulator() {
// IsVrSimulatorReady - Detect if VR simulator is ready
func IsVrSimulatorReady() bool {
ret := C.IsVrSimulatorReady()
v := bool(int(ret) == 1)
v := bool(ret)
return v
}

View file

@ -227,7 +227,7 @@ func CheckCollisionRecs(rec1, rec2 Rectangle) bool {
crec1 := rec1.cptr()
crec2 := rec2.cptr()
ret := C.CheckCollisionRecs(*crec1, *crec2)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -238,7 +238,7 @@ func CheckCollisionCircles(center1 Vector2, radius1 float32, center2 Vector2, ra
ccenter2 := center2.cptr()
cradius2 := (C.float)(radius2)
ret := C.CheckCollisionCircles(*ccenter1, cradius1, *ccenter2, cradius2)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -248,7 +248,7 @@ func CheckCollisionCircleRec(center Vector2, radius float32, rec Rectangle) bool
cradius := (C.float)(radius)
crec := rec.cptr()
ret := C.CheckCollisionCircleRec(*ccenter, cradius, *crec)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -266,7 +266,7 @@ func CheckCollisionPointRec(point Vector2, rec Rectangle) bool {
cpoint := point.cptr()
crec := rec.cptr()
ret := C.CheckCollisionPointRec(*cpoint, *crec)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -276,7 +276,7 @@ func CheckCollisionPointCircle(point Vector2, center Vector2, radius float32) bo
ccenter := center.cptr()
cradius := (C.float)(radius)
ret := C.CheckCollisionPointCircle(*cpoint, *ccenter, cradius)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}
@ -287,6 +287,6 @@ func CheckCollisionPointTriangle(point, p1, p2, p3 Vector2) bool {
cp2 := p2.cptr()
cp3 := p3.cptr()
ret := C.CheckCollisionPointTriangle(*cpoint, *cp1, *cp2, *cp3)
v := bool(int(ret) == 1)
v := bool(ret)
return v
}