mirror of
https://github.com/raysan5/raylib.git
synced 2025-11-14 14:28:51 +00:00
raylib 1.1
View CHANGELOG for a detailed list of changes
This commit is contained in:
104
src/raylib.h
104
src/raylib.h
@@ -10,13 +10,17 @@
|
||||
* Hardware accelerated with OpenGL (1.1, 3.3+ or ES2)
|
||||
* Unique OpenGL abstraction layer [rlgl]
|
||||
* Powerful fonts module with SpriteFonts support
|
||||
* Multiple textures support, including DDS and mipmaps generation
|
||||
* Basic 3d support for Shapes, Models, Heightmaps and Billboards
|
||||
* Powerful math module for Vector and Matrix operations [raymath]
|
||||
* Audio loading and playing
|
||||
* Audio loading and playing with streaming support
|
||||
*
|
||||
* Used external libs:
|
||||
* GLFW3 (www.glfw.org) for window/context management and input
|
||||
* GLEW for OpenGL extensions loading (3.3+ and ES2)
|
||||
* 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_vorbis (Sean Barret) for ogg audio loading
|
||||
* OpenAL Soft for audio device/context management
|
||||
* tinfl for data decompression (DEFLATE algorithm)
|
||||
*
|
||||
@@ -25,9 +29,9 @@
|
||||
* 32bit Textures - All loaded images are converted automatically to RGBA textures
|
||||
* SpriteFonts - All loaded sprite-font images are converted to RGBA and POT textures
|
||||
* One custom default font is loaded automatically when InitWindow()
|
||||
* If using OpenGL 3.3+, one default shader is loaded automatically (internally defined)
|
||||
* If using OpenGL 3.3+ or ES2, one default shader is loaded automatically (internally defined)
|
||||
*
|
||||
* -- LICENSE (raylib v1.1, March 2014) --
|
||||
* -- LICENSE (raylib v1.1, April 2014) --
|
||||
*
|
||||
* raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||
* BSD-like license that allows static linking with closed source software:
|
||||
@@ -52,9 +56,7 @@
|
||||
**********************************************************************************************/
|
||||
|
||||
#ifndef RAYLIB_H
|
||||
#define RAYLIB_H
|
||||
|
||||
#include "stb_vorbis.h"
|
||||
#define RAYLIB_H
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Some basic Defines
|
||||
@@ -195,11 +197,22 @@ typedef struct Image {
|
||||
// Texture2D type, bpp always RGBA (32bit)
|
||||
// NOTE: Data stored in GPU memory
|
||||
typedef struct Texture2D {
|
||||
unsigned int glId;
|
||||
unsigned int id; // OpenGL id
|
||||
int width;
|
||||
int height;
|
||||
} Texture2D;
|
||||
|
||||
// Character type (one font glyph)
|
||||
// NOTE: Defined in module: text
|
||||
typedef struct Character Character;
|
||||
|
||||
// SpriteFont type, includes texture and charSet array data
|
||||
typedef struct SpriteFont {
|
||||
Texture2D texture;
|
||||
int numChars;
|
||||
Character *charSet;
|
||||
} SpriteFont;
|
||||
|
||||
// Camera type, defines a camera position/orientation in 3d space
|
||||
typedef struct Camera {
|
||||
Vector3 position;
|
||||
@@ -207,18 +220,23 @@ typedef struct Camera {
|
||||
Vector3 up;
|
||||
} Camera;
|
||||
|
||||
typedef struct Character Character;
|
||||
|
||||
// SpriteFont type
|
||||
typedef struct SpriteFont {
|
||||
Texture2D texture;
|
||||
int numChars;
|
||||
Character *charSet;
|
||||
} SpriteFont;
|
||||
// Vertex data definning a mesh
|
||||
typedef struct {
|
||||
int vertexCount;
|
||||
float *vertices; // 3 components per vertex
|
||||
float *texcoords; // 2 components per vertex
|
||||
float *normals; // 3 components per vertex
|
||||
float *colors; // 4 components per vertex
|
||||
} VertexData;
|
||||
|
||||
// 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
|
||||
// NOTE: If using OpenGL 1.1 loaded in CPU (mesh); if OpenGL 3.3+ loaded in GPU (vaoId)
|
||||
typedef struct Model {
|
||||
VertexData mesh;
|
||||
unsigned int vaoId;
|
||||
unsigned int textureId;
|
||||
//Matrix transform;
|
||||
} Model;
|
||||
|
||||
// Sound source type
|
||||
typedef struct Sound {
|
||||
@@ -226,23 +244,6 @@ typedef struct Sound {
|
||||
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
|
||||
@@ -342,7 +343,7 @@ Image LoadImage(const char *fileName);
|
||||
Image LoadImageFromRES(const char *rresName, int resId); // Load an image from rRES file (raylib Resource)
|
||||
Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory
|
||||
Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource)
|
||||
Texture2D CreateTexture(Image image); // Create a Texture2D from Image data
|
||||
Texture2D CreateTexture(Image image, bool genMipmaps); // Create a Texture2D from Image data (and generate mipmaps)
|
||||
void UnloadImage(Image image); // Unload image from CPU memory (RAM)
|
||||
void UnloadTexture(Texture2D texture); // Unload texture from GPU memory
|
||||
|
||||
@@ -359,6 +360,7 @@ void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, V
|
||||
SpriteFont GetDefaultFont(); // Get the default SpriteFont
|
||||
SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory
|
||||
void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory
|
||||
|
||||
void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
||||
void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, // Draw text using SpriteFont and additional parameters
|
||||
int fontSize, int spacing, Color tint);
|
||||
@@ -384,7 +386,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 rot, float scale, bool orbits); // Draw gizmo with extended parameters
|
||||
void DrawGizmoEx(Vector3 position, Vector3 rotation, float scale); // Draw gizmo with extended parameters
|
||||
//DrawTorus(), DrawTeapot() are useless...
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
@@ -394,9 +396,12 @@ Model LoadModel(const char *fileName);
|
||||
//Model LoadModelFromRES(const char *rresName, int resId); // TODO: Load a 3d model from rRES file (raylib Resource)
|
||||
Model LoadHeightmap(Image heightmap, float maxHeight); // Load a heightmap image as a 3d model
|
||||
void UnloadModel(Model model); // Unload 3d model from memory
|
||||
void DrawModel(Model model, Vector3 position, float scale, Color color); // Draw a model
|
||||
void DrawModelEx(Model model, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a textured model
|
||||
void DrawModelWires(Model model, Vector3 position, float scale, Color color); // Draw a model wires
|
||||
void SetModelTexture(Model *model, Texture2D texture); // Link a texture to a model
|
||||
|
||||
void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
|
||||
void DrawModelEx(Model model, Vector3 position, Vector3 rotation, Vector3 scale, Color tint); // Draw a model with extended parameters
|
||||
void DrawModelWires(Model model, Vector3 position, float scale, Color color); // Draw a model wires (with texture if set)
|
||||
|
||||
void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture
|
||||
void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec
|
||||
|
||||
@@ -404,22 +409,25 @@ void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vec
|
||||
// Audio Loading and Playing Functions (Module: audio)
|
||||
//------------------------------------------------------------------------------------
|
||||
void InitAudioDevice(); // Initialize audio device and context
|
||||
void CloseAudioDevice(); // Close the audio device and context
|
||||
void CloseAudioDevice(); // Close the audio device and context (and music stream)
|
||||
|
||||
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 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();
|
||||
void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
||||
void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||
|
||||
void PlayMusicStream(char *fileName); // Start music playing (open stream)
|
||||
void StopMusicStream(); // Stop music playing (close stream)
|
||||
void PauseMusicStream(); // Pause music playing
|
||||
bool MusicIsPlaying(); // Check if music is playing
|
||||
void SetMusicVolume(float volume); // Set volume for music (1.0 is max level)
|
||||
float GetMusicTimeLength(); // Get current music time length (in seconds)
|
||||
float GetMusicTimePlayed(); // Get current music time played (in seconds)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user