diff options
| author | Ray <raysan5@gmail.com> | 2016-12-22 11:47:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-12-22 11:47:59 +0100 |
| commit | 4419ee9802d7a45929fb4ecae2163d12fb44f2a7 (patch) | |
| tree | 54862a2fe85937766ca753e32a05642898ca6852 /src | |
| parent | 060d501cd1a8b591d38b3169ee98c416314261a7 (diff) | |
| parent | aaea2eb9a64ad97c54fe115f6fd132d6a00f76ef (diff) | |
| download | raylib-4419ee9802d7a45929fb4ecae2163d12fb44f2a7.tar.gz raylib-4419ee9802d7a45929fb4ecae2163d12fb44f2a7.zip | |
Merge pull request #210 from ficoos/fixes
Fixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio.c | 2 | ||||
| -rw-r--r-- | src/audio.h | 2 | ||||
| -rw-r--r-- | src/physac.h | 9 | ||||
| -rw-r--r-- | src/raylib.h | 17 | ||||
| -rw-r--r-- | src/rlua.h | 7 |
5 files changed, 20 insertions, 17 deletions
diff --git a/src/audio.c b/src/audio.c index a9c07c39..aa89de02 100644 --- a/src/audio.c +++ b/src/audio.c @@ -342,7 +342,7 @@ void UnloadSound(Sound sound) // Update sound buffer with new data // NOTE: data must match sound.format -void UpdateSound(Sound sound, void *data, int numSamples) +void UpdateSound(Sound sound, const void *data, int numSamples) { ALint sampleRate, sampleSize, channels; alGetBufferi(sound.buffer, AL_FREQUENCY, &sampleRate); diff --git a/src/audio.h b/src/audio.h index 2b3c5933..db1bb694 100644 --- a/src/audio.h +++ b/src/audio.h @@ -115,7 +115,7 @@ Wave LoadWaveEx(float *data, int sampleCount, int sampleRate, int sampleSize, in Sound LoadSound(const char *fileName); // Load sound to memory Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource) -void UpdateSound(Sound sound, void *data, int numSamples); // Update sound buffer with new data +void UpdateSound(Sound sound, const void *data, int numSamples); // Update sound buffer with new data void UnloadWave(Wave wave); // Unload wave data void UnloadSound(Sound sound); // Unload sound void PlaySound(Sound sound); // Play a sound diff --git a/src/physac.h b/src/physac.h index e807ffa6..d958c701 100644 --- a/src/physac.h +++ b/src/physac.h @@ -239,9 +239,10 @@ PHYSACDEF void ClosePhysics(void); // Functions required to query time on Windows int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount); int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency); -#elif defined(__linux) +#elif defined(__linux) || defined(PLATFORM_WEB) #include <sys/time.h> // Required for: timespec #include <time.h> // Required for: clock_gettime() + #include <stdint.h> #endif //---------------------------------------------------------------------------------- @@ -266,7 +267,7 @@ PHYSACDEF void ClosePhysics(void); static unsigned int usedMemory = 0; // Total allocated dynamic memory static bool physicsThreadEnabled = false; // Physics thread enabled state static double currentTime = 0; // Current time in milliseconds -#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) +#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(__linux) || defined(PLATFORM_WEB) static double baseTime = 0; // Android and RPI platforms base time #endif static double startTime = 0; // Start time in milliseconds @@ -1942,7 +1943,7 @@ static double GetCurrentTime(void) { double time = 0; - #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) + #if defined(_WIN32) unsigned long long int clockFrequency, currentTime; QueryPerformanceFrequency(&clockFrequency); @@ -1951,7 +1952,7 @@ static double GetCurrentTime(void) time = (double)((double)currentTime/clockFrequency)*1000; #endif - #if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) + #if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(__linux) || defined(PLATFORM_WEB) struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); uint64_t temp = (uint64_t)ts.tv_sec*1000000000LLU + (uint64_t)ts.tv_nsec; diff --git a/src/raylib.h b/src/raylib.h index e7d2b74a..fff0c928 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -549,7 +549,7 @@ typedef enum { // Texture parameters: filter mode // NOTE 1: Filtering considers mipmaps if available in the texture // NOTE 2: Filter is accordingly set for minification and magnification -typedef enum { +typedef enum { FILTER_POINT = 0, // No filter, just pixel aproximation FILTER_BILINEAR, // Linear filtering FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps) @@ -581,12 +581,12 @@ typedef enum { } Gestures; // Camera system modes -typedef enum { - CAMERA_CUSTOM = 0, - CAMERA_FREE, - CAMERA_ORBITAL, - CAMERA_FIRST_PERSON, - CAMERA_THIRD_PERSON +typedef enum { + CAMERA_CUSTOM = 0, + CAMERA_FREE, + CAMERA_ORBITAL, + CAMERA_FIRST_PERSON, + CAMERA_THIRD_PERSON } CameraMode; // Head Mounted Display devices @@ -930,7 +930,8 @@ RLAPI Wave LoadWave(const char *fileName); // Load wa RLAPI Wave LoadWaveEx(float *data, int sampleCount, int sampleRate, int sampleSize, int channels); // Load wave data from float array data (32bit) RLAPI Sound LoadSound(const char *fileName); // Load sound to memory RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data -RLAPI void UpdateSound(Sound sound, void *data, int numSamples); // Update sound buffer with new data +RLAPI void UpdateSound(Sound sound, const void *data, int numSamples);// Update sound buffer with new data +RLAPI Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource) RLAPI void UnloadWave(Wave wave); // Unload wave data RLAPI void UnloadSound(Sound sound); // Unload sound RLAPI void PlaySound(Sound sound); // Play a sound @@ -133,6 +133,7 @@ RLUADEF void CloseLuaDevice(void); // De-initialize Lua system #define LuaPush_AudioStream(L, aud) LuaPushOpaqueType(L, aud) #define LuaGetArgument_string luaL_checkstring +#define LuaGetArgument_ptr (void *)luaL_checkinteger #define LuaGetArgument_int (int)luaL_checkinteger #define LuaGetArgument_unsigned (unsigned)luaL_checkinteger #define LuaGetArgument_char (char)luaL_checkinteger @@ -1198,7 +1199,7 @@ int lua_GetGamepadName(lua_State* L) // TODO: Return gamepad name id int arg1 = LuaGetArgument_int(L, 1); - char * result = GetGamepadName(arg1); + const char * result = GetGamepadName(arg1); //lua_pushboolean(L, result); return 1; } @@ -2863,7 +2864,7 @@ int lua_LoadWaveEx(lua_State* L) { // TODO: Wave LoadWaveEx(float *data, int sampleCount, int sampleRate, int sampleSize, int channels); - int arg1 = 0; + float * arg1 = 0; int arg2 = LuaGetArgument_int(L, 2); int arg3 = LuaGetArgument_int(L, 3); int arg4 = LuaGetArgument_int(L, 4); @@ -2904,7 +2905,7 @@ int lua_UpdateSound(lua_State* L) Sound arg1 = LuaGetArgument_Sound(L, 1); const char * arg2 = LuaGetArgument_string(L, 2); - int * arg3 = LuaGetArgument_int(L, 3); + int arg3 = LuaGetArgument_int(L, 3); UpdateSound(arg1, arg2, arg3); return 0; } |
