Преглед изворни кода

Working on file header comments...

pull/246/head
raysan5 пре 7 година
родитељ
комит
8f5ff64420
8 измењених фајлова са 105 додато и 70 уклоњено
  1. +22
    -19
      src/audio.c
  2. +16
    -12
      src/audio.h
  3. +9
    -2
      src/core.c
  4. +1
    -1
      src/easings.h
  5. +3
    -1
      src/models.c
  6. +33
    -31
      src/raylib.h
  7. +15
    -4
      src/utils.c
  8. +6
    -0
      src/utils.h

+ 22
- 19
src/audio.c Прегледај датотеку

@ -1,26 +1,24 @@
/**********************************************************************************************
*
* raylib.audio
* raylib.audio - Basic funtionality to work with audio
*
* This module provides basic functionality to work with audio:
* Manage audio device (init/close)
* Load and Unload audio files (WAV, OGG, FLAC, XM, MOD)
* Play/Stop/Pause/Resume loaded audio
* Manage mixing channels
* Manage raw audio context
* DESCRIPTION:
*
* NOTES:
*
* Only up to two channels supported: MONO and STEREO (for additional channels, use AL_EXT_MCFORMATS)
* Only the following sample sizes supported: 8bit PCM, 16bit PCM, 32-bit float PCM (using AL_EXT_FLOAT32)
* This module provides basic functionality to:
* - Manage audio device (init/close)
* - Load and unload audio files
* - Format wave data (sample rate, size, channels)
* - Play/Stop/Pause/Resume loaded audio
* - Manage mixing channels
* - Manage raw audio context
*
* CONFIGURATION:
*
* #define AUDIO_STANDALONE
* If defined, the module can be used as standalone library (independently of raylib).
* Define to use the module as standalone library (independently of raylib).
* Required types and functions are defined in the same module.
*
* #define SUPPORT_FILEFORMAT_WAV / SUPPORT_LOAD_WAV / ENABLE_LOAD_WAV
* #define SUPPORT_FILEFORMAT_WAV / SUPPORT_LOAD_WAV
* #define SUPPORT_FILEFORMAT_OGG
* #define SUPPORT_FILEFORMAT_XM
* #define SUPPORT_FILEFORMAT_MOD
@ -29,6 +27,12 @@
* supported by default, to remove support, just comment unrequired #define in this module
*
* #define SUPPORT_RAW_AUDIO_BUFFERS
* Support creating raw audio buffers to send raw data. Buffers must be managed by the user,
* it means initialization, refilling and cleaning.
*
* LIMITATIONS:
* Only up to two channels supported: MONO and STEREO (for additional channels, use AL_EXT_MCFORMATS)
* Only the following sample sizes supported: 8bit PCM, 16bit PCM, 32-bit float PCM (using AL_EXT_FLOAT32)
*
* DEPENDENCIES:
* OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html)
@ -38,12 +42,11 @@
* dr_flac - FLAC audio file loading
*
* CONTRIBUTORS:
*
* Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
* XM audio module support (jar_xm)
* MOD audio module support (jar_mod)
* Mixing channels support
* Raw audio context support
* Joshua Reisenauer (github: @kd7tck):
* - XM audio module support (jar_xm)
* - MOD audio module support (jar_mod)
* - Mixing channels support
* - Raw audio context support
*
*
* LICENSE: zlib/libpng

+ 16
- 12
src/audio.h Прегледај датотеку

@ -1,13 +1,16 @@
/**********************************************************************************************
*
* raylib.audio
* raylib.audio - Basic funtionality to work with audio
*
* This module provides basic functionality to work with audio:
* Manage audio device (init/close)
* Load and Unload audio files (WAV, OGG, FLAC, XM, MOD)
* Play/Stop/Pause/Resume loaded audio
* Manage mixing channels
* Manage raw audio context
* DESCRIPTION:
*
* This module provides basic functionality to:
* - Manage audio device (init/close)
* - Load and unload audio files
* - Format wave data (sample rate, size, channels)
* - Play/Stop/Pause/Resume loaded audio
* - Manage mixing channels
* - Manage raw audio context
*
* DEPENDENCIES:
* OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html)
@ -16,11 +19,12 @@
* jar_mod - MOD audio file loading
* dr_flac - FLAC audio file loading
*
* Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
* XM audio module support (jar_xm)
* MOD audio module support (jar_mod)
* Mixing channels support
* Raw audio context support
* CONTRIBUTORS:
* Joshua Reisenauer (github: @kd7tck):
* - XM audio module support (jar_xm)
* - MOD audio module support (jar_mod)
* - Mixing channels support
* - Raw audio context support
*
*
* LICENSE: zlib/libpng

+ 9
- 2
src/core.c Прегледај датотеку

@ -2,7 +2,14 @@
*
* raylib.core - Basic functions to manage windows, OpenGL context and input on multiple platforms
*
* The following platforms are supported: Windows, Linux, Mac (OSX), Android, Raspberry Pi, HTML5, Oculus Rift CV1
* The following platforms are supported:
* Windows (win32/Win64)
* Linux (tested on Ubuntu)
* Mac (OSX)
* Android (API Level 9 or greater)
* Raspberry Pi (Raspbian)
* HTML5 (Chrome, Firefox)
* Oculus Rift CV1
*
* CONFIGURATION:
*
@ -2006,7 +2013,7 @@ static double GetTime(void)
// Wait for some milliseconds (stop program execution)
static void Wait(float ms)
{
cp">#define SUPPORT_BUSY_WAIT_LOOP
o">//#define SUPPORT_BUSY_WAIT_LOOP
#if defined(SUPPORT_BUSY_WAIT_LOOP)
double prevTime = GetTime();
double nextTime = 0.0;

+ 1
- 1
src/easings.h Прегледај датотеку

@ -122,7 +122,7 @@ EASEDEF float EaseCubicOut(float t, float b, float c, float d) { return (c*((t=t
EASEDEF float EaseCubicInOut(float t, float b, float c, float d)
{
if ((t/=d/2) < 1) return (c/2*t*t*t + b);
return (c/2*((t-=2)*t*t + 2) + b);
return (c/2*((t-=2)*t*t + 2) + b);
}
// Quadratic Easing functions

+ 3
- 1
src/models.c Прегледај датотеку

@ -1,12 +1,14 @@
/**********************************************************************************************
*
* raylib.models - Basic functions to draw 3d shapes and 3d models
* raylib.models - Basic functions to deal with 3d shapes and 3d models
*
* CONFIGURATION:
*
* #define SUPPORT_FILEFORMAT_OBJ / SUPPORT_LOAD_OBJ
* Selected desired fileformats to be supported for loading.
*
* #define SUPPORT_FILEFORMAT_MTL
* Selected desired fileformats to be supported for loading.
*
*
* LICENSE: zlib/libpng

+ 33
- 31
src/raylib.h Прегледај датотеку

@ -1,43 +1,45 @@
/**********************************************************************************************
*
* raylib v1.7.0 (www.raylib.com)
* raylib v1.7.0
*
* A simple and easy-to-use library to learn videogames programming
* A simple and easy-to-use library to learn videogames programming (www.raylib.com)
*
* FEATURES:
* Library written in plain C code (C99)
* Uses PascalCase/camelCase notation
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
* Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
* Multiple textures support, including compressed formats and mipmaps generation
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
* Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
* Audio loading and playing with streaming support and mixing channels [audio]
* VR stereo rendering support with configurable HMD device parameters
* Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1
* Custom color palette for fancy visuals on raywhite background
* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
* Complete binding for Lua [rlua]
* - Library written in plain C code (C99)
* - Uses PascalCase/camelCase notation
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
* - Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
* - Multiple textures support, including compressed formats and mipmaps generation
* - Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
* - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
* - Audio loading and playing with streaming support and mixing channels [audio]
* - VR stereo rendering support with configurable HMD device parameters
* - Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1
* - Custom color palette for fancy visuals on raywhite background
* - Minimal external dependencies (GLFW3, OpenGL, OpenAL)
* - Complete bindings for Lua, Go and Pascal
*
* NOTES:
* 32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
* One custom default font could be loaded automatically when InitWindow() [core]
* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
* If using OpenGL 3.3 or ES2, two default shaders could be loaded automatically (internally defined)
* 32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
* One custom default font could be loaded automatically when InitWindow() [core]
* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
* If using OpenGL 3.3 or ES2, two default shaders could be loaded automatically (internally defined)
*
* DEPENDENCIES:
* GLFW3 (www.glfw.org) for window/context management and input [core]
* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) [rlgl]
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures]
* stb_image_write (Sean Barret) for image writting (PNG) [utils]
* stb_truetype (Sean Barret) for ttf fonts loading [text]
* stb_vorbis (Sean Barret) for ogg audio loading [audio]
* jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
* dr_flac (David Reid) for FLAC audio file loading [audio]
* OpenAL Soft for audio device/context management [audio]
* tinfl for data decompression (DEFLATE algorithm) [utils]
* GLFW3 (www.glfw.org) for window/context management and input [core]
* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) [rlgl]
* OpenAL Soft for audio device/context management [audio]
*
* OPTIONAL DEPENDENCIES:
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures]
* stb_image_write (Sean Barret) for image writting (PNG) [utils]
* stb_truetype (Sean Barret) for ttf fonts loading [text]
* stb_vorbis (Sean Barret) for ogg audio loading [audio]
* jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
* dr_flac (David Reid) for FLAC audio file loading [audio]
* tinfl for data decompression (DEFLATE algorithm) [rres]
*
*
* LICENSE: zlib/libpng

+ 15
- 4
src/utils.c Прегледај датотеку

@ -4,14 +4,20 @@
*
* CONFIGURATION:
*
* #define SUPPORT_SAVE_PNG
* Enable saving PNG fileformat
* #define SUPPORT_SAVE_PNG (defined by default)
* Support saving image data as PNG fileformat
* NOTE: Requires stb_image_write library
*
* #define SUPPORT_SAVE_BMP
* Support saving image data as BMP fileformat
* NOTE: Requires stb_image_write library
*
* #define SUPPORT_TRACELOG
* Show TraceLog() output messages
* NOTE: By default DEBUG traces not shown
*
* #define DO_NOT_TRACE_DEBUG_MSGS
* Avoid showing DEBUG TraceLog() messages
* #define SUPPORT_TRACELOG_DEBUG
* Show TraceLog() DEBUG messages
*
* DEPENDENCIES:
* stb_image_write - PNG writting functions
@ -129,18 +135,23 @@ void TraceLog(int msgType, const char *text, ...)
}
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
#if defined(SUPPORT_SAVE_BMP)
// Creates a BMP image file from an array of pixel data
void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize)
{
stbi_write_bmp(fileName, width, height, compSize, imgData);
}
#endif
#if defined(SUPPORT_SAVE_PNG)
// Creates a PNG image file from an array of pixel data
void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize)
{
stbi_write_png(fileName, width, height, compSize, imgData, width*compSize);
}
#endif
#endif
#if defined(PLATFORM_ANDROID)
// Initialize asset manager from android app

+ 6
- 0
src/utils.h Прегледај датотеку

@ -33,6 +33,8 @@
#include "rres.h"
#define SUPPORT_SAVE_PNG
//----------------------------------------------------------------------------------
// Some basic Defines
//----------------------------------------------------------------------------------
@ -61,9 +63,13 @@ void TraceLog(int msgType, const char *text, ...); // Outputs a trace log messa
const char *GetExtension(const char *fileName); // Returns extension of a filename
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
#if defined(SUPPORT_SAVE_BMP)
void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize);
#endif
#if defined(SUPPORT_SAVE_PNG)
void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize);
#endif
#endif
#if defined(PLATFORM_ANDROID)
void InitAssetManager(AAssetManager *manager); // Initialize asset manager from android app

Loading…
Откажи
Сачувај