Some code tweaks
This commit is contained in:
parent
6e9d3eb0f9
commit
08da91047e
5 changed files with 11 additions and 16 deletions
17
src/audio.c
17
src/audio.c
|
@ -166,15 +166,8 @@ void CloseAudioDevice(void)
|
||||||
// Load sound to memory
|
// Load sound to memory
|
||||||
Sound LoadSound(char *fileName)
|
Sound LoadSound(char *fileName)
|
||||||
{
|
{
|
||||||
Sound sound;
|
Sound sound = { 0 };
|
||||||
Wave wave;
|
Wave wave = { 0 };
|
||||||
|
|
||||||
// Init some default values for wave...
|
|
||||||
wave.data = NULL;
|
|
||||||
wave.dataSize = 0;
|
|
||||||
wave.sampleRate = 0;
|
|
||||||
wave.bitsPerSample = 0;
|
|
||||||
wave.channels = 0;
|
|
||||||
|
|
||||||
// NOTE: The entire file is loaded to memory to play it all at once (no-streaming)
|
// NOTE: The entire file is loaded to memory to play it all at once (no-streaming)
|
||||||
|
|
||||||
|
@ -236,7 +229,7 @@ Sound LoadSound(char *fileName)
|
||||||
// Load sound from wave data
|
// Load sound from wave data
|
||||||
Sound LoadSoundFromWave(Wave wave)
|
Sound LoadSoundFromWave(Wave wave)
|
||||||
{
|
{
|
||||||
Sound sound;
|
Sound sound = { 0 };
|
||||||
|
|
||||||
if (wave.data != NULL)
|
if (wave.data != NULL)
|
||||||
{
|
{
|
||||||
|
@ -290,7 +283,7 @@ Sound LoadSoundFromWave(Wave wave)
|
||||||
Sound LoadSoundFromRES(const char *rresName, int resId)
|
Sound LoadSoundFromRES(const char *rresName, int resId)
|
||||||
{
|
{
|
||||||
// NOTE: rresName could be directly a char array with all the data!!! --> TODO
|
// NOTE: rresName could be directly a char array with all the data!!! --> TODO
|
||||||
Sound sound;
|
Sound sound = { 0 };
|
||||||
|
|
||||||
#if defined(AUDIO_STANDALONE)
|
#if defined(AUDIO_STANDALONE)
|
||||||
TraceLog(WARNING, "Sound loading from rRES resource file not supported on standalone mode");
|
TraceLog(WARNING, "Sound loading from rRES resource file not supported on standalone mode");
|
||||||
|
@ -791,7 +784,7 @@ static Wave LoadWAV(const char *fileName)
|
||||||
WaveFormat waveFormat;
|
WaveFormat waveFormat;
|
||||||
WaveData waveData;
|
WaveData waveData;
|
||||||
|
|
||||||
Wave wave;
|
Wave wave = { 0 };
|
||||||
FILE *wavFile;
|
FILE *wavFile;
|
||||||
|
|
||||||
wavFile = fopen(fileName, "rb");
|
wavFile = fopen(fileName, "rb");
|
||||||
|
|
|
@ -1230,7 +1230,9 @@ Vector2 GetTouchPosition(void)
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PLATFORM_ANDROID)
|
||||||
// Detect if a button has been pressed once
|
// Detect if a button has been pressed once
|
||||||
bool IsButtonPressed(int button)
|
bool IsButtonPressed(int button)
|
||||||
{
|
{
|
||||||
|
|
|
@ -557,7 +557,7 @@ void DrawGizmo(Vector3 position)
|
||||||
// Load a 3d model (from file)
|
// Load a 3d model (from file)
|
||||||
Model LoadModel(const char *fileName)
|
Model LoadModel(const char *fileName)
|
||||||
{
|
{
|
||||||
Model model;
|
Model model = { 0 };
|
||||||
Mesh mesh = { 0 };
|
Mesh mesh = { 0 };
|
||||||
|
|
||||||
// NOTE: Initialize default data for model in case loading fails, maybe a cube?
|
// NOTE: Initialize default data for model in case loading fails, maybe a cube?
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*
|
*
|
||||||
* Used external libs:
|
* Used external libs:
|
||||||
* GLFW3 (www.glfw.org) for window/context management and input
|
* GLFW3 (www.glfw.org) for window/context management and input
|
||||||
* GLAD for OpenGL extensions loading (3.3 Core profile)
|
* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP)
|
||||||
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA, PSD, GIF, HDR, PIC)
|
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA, PSD, GIF, HDR, PIC)
|
||||||
* stb_image_write (Sean Barret) for image writting (PNG)
|
* stb_image_write (Sean Barret) for image writting (PNG)
|
||||||
* stb_vorbis (Sean Barret) for ogg audio loading
|
* stb_vorbis (Sean Barret) for ogg audio loading
|
||||||
|
|
|
@ -397,8 +397,8 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
|
||||||
int recCenterX = rec.x + rec.width/2;
|
int recCenterX = rec.x + rec.width/2;
|
||||||
int recCenterY = rec.y + rec.height/2;
|
int recCenterY = rec.y + rec.height/2;
|
||||||
|
|
||||||
float dx = abs(center.x - recCenterX);
|
float dx = fabs(center.x - recCenterX);
|
||||||
float dy = abs(center.y - recCenterY);
|
float dy = fabs(center.y - recCenterY);
|
||||||
|
|
||||||
if (dx > (rec.width/2 + radius)) { return false; }
|
if (dx > (rec.width/2 + radius)) { return false; }
|
||||||
if (dy > (rec.height/2 + radius)) { return false; }
|
if (dy > (rec.height/2 + radius)) { return false; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue