diff options
| author | raysan5 <[email protected]> | 2014-04-09 20:25:26 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2014-04-09 20:25:26 +0200 |
| commit | e6b82cb111c3485c5e6131fe29791f938305bce3 (patch) | |
| tree | 01f1a6968b784d07d63f6bf741c1527145cea25c /src/raylib.h | |
| parent | c04f37d0f5f75c3e112d71444e589513396c9d0f (diff) | |
| download | raylib-e6b82cb111c3485c5e6131fe29791f938305bce3.tar.gz raylib-e6b82cb111c3485c5e6131fe29791f938305bce3.zip | |
Lots of changes, most of them under testing-review
Added a Tracing/Log system
Added OGG stream music support (DOESN'T WORK)
Added Compressed textures support
* This update is probably very buggy...
Diffstat (limited to 'src/raylib.h')
| -rw-r--r-- | src/raylib.h | 78 |
1 files changed, 51 insertions, 27 deletions
diff --git a/src/raylib.h b/src/raylib.h index 450d2e6f..237f635d 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -54,6 +54,8 @@ #ifndef RAYLIB_H #define RAYLIB_H +#include "stb_vorbis.h" + //---------------------------------------------------------------------------------- // Some basic Defines //---------------------------------------------------------------------------------- @@ -153,6 +155,19 @@ // Boolean type typedef enum { false, true } bool; +// Vector2 type +typedef struct Vector2 { + float x; + float y; +} Vector2; + +// Vector3 type +typedef struct Vector3 { + float x; + float y; + float z; +} Vector3; + // Color type, RGBA (32bit) typedef struct Color { unsigned char r; @@ -185,45 +200,49 @@ typedef struct Texture2D { int height; } Texture2D; -// SpriteFont one Character (Glyph) data, defined in text module +// Camera type, defines a camera position/orientation in 3d space +typedef struct Camera { + Vector3 position; + Vector3 target; + Vector3 up; +} Camera; + typedef struct Character Character; -// SpriteFont type, includes texture and charSet array data +// SpriteFont type typedef struct SpriteFont { Texture2D texture; int numChars; Character *charSet; } SpriteFont; -// Vector2 type -typedef struct Vector2 { - float x; - float y; -} Vector2; - -// Vector3 type -typedef struct Vector3 { - float x; - float y; - float z; -} Vector3; - -// Camera type, defines a camera position/orientation in 3d space -typedef struct Camera { - Vector3 position; - Vector3 target; - Vector3 up; -} Camera; +// 3d Model type +// NOTE: If using OpenGL 1.1 loaded in CPU; if OpenGL 3.3+ loaded in GPU +typedef struct Model Model; // Defined in module: rlgl -// Basic 3d Model type -typedef struct Model Model; - -// Basic Sound source and buffer +// Sound source type typedef struct Sound { unsigned int source; unsigned int buffer; } Sound; +typedef struct OggStream OggStream; + +// Music type (streamming) +typedef struct Music { + stb_vorbis *stream; + stb_vorbis_info info; + + unsigned int source; + unsigned int buffers[2]; + + int format; + + int bufferSize; + int totalSamplesLeft; + bool loop; +} Music; + #ifdef __cplusplus extern "C" { // Prevents name mangling of functions #endif @@ -365,7 +384,7 @@ void DrawPlane(Vector3 centerPos, Vector2 size, Vector3 rotation, Color color); void DrawPlaneEx(Vector3 centerPos, Vector2 size, Vector3 rotation, int slicesX, int slicesZ, Color color); // Draw a plane with divisions void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0)) void DrawGizmo(Vector3 position); // Draw simple gizmo -void DrawGizmoEx(Vector3 position, Vector3 rotation, float scale, bool orbits); // Draw gizmo with extended parameters +void DrawGizmoEx(Vector3 position, Vector3 rot, float scale, bool orbits); // Draw gizmo with extended parameters //DrawTorus(), DrawTeapot() are useless... //------------------------------------------------------------------------------------ @@ -389,13 +408,18 @@ void CloseAudioDevice(); // Close the aud Sound LoadSound(char *fileName); // Load sound to memory Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource) void UnloadSound(Sound sound); // Unload sound +Music LoadMusic(char *fileName); +void UnloadMusic(Music music); void PlaySound(Sound sound); // Play a sound void PauseSound(Sound sound); // Pause a sound void StopSound(Sound sound); // Stop playing a sound -bool IsPlaying(Sound sound); // Check if a sound is currently playing +bool SoundIsPlaying(Sound sound); // Check if a sound is currently playing void SetVolume(Sound sound, float volume); // Set volume for a sound (1.0 is base level) void SetPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level) +void PlayMusic(Music music); +void StopMusic(Music music); +bool MusicIsPlaying(); #ifdef __cplusplus } |
