You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

506 rivejä
29 KiB

  1. /**********************************************************************************************
  2. *
  3. * raylib 1.2 (www.raylib.com)
  4. *
  5. * A simple and easy-to-use library to learn videogames programming
  6. *
  7. * Features:
  8. * Library written in plain C code (C99)
  9. * Uses C# PascalCase/camelCase notation
  10. * Hardware accelerated with OpenGL (1.1, 3.3+ or ES2)
  11. * Unique OpenGL abstraction layer [rlgl]
  12. * Powerful fonts module with SpriteFonts support
  13. * Multiple textures support, including DDS and mipmaps generation
  14. * Basic 3d support for Shapes, Models, Heightmaps and Billboards
  15. * Powerful math module for Vector and Matrix operations [raymath]
  16. * Audio loading and playing with streaming support (WAV and OGG)
  17. * Multiplatform support, including Android devices, Raspberry Pi and HTML5
  18. *
  19. * Used external libs:
  20. * GLFW3 (www.glfw.org) for window/context management and input
  21. * GLEW for OpenGL extensions loading (3.3+ and ES2)
  22. * stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA, PSD, GIF, HDR, PIC)
  23. * stb_image_write (Sean Barret) for image writting (PNG)
  24. * stb_vorbis (Sean Barret) for ogg audio loading
  25. * OpenAL Soft for audio device/context management
  26. * tinfl for data decompression (DEFLATE algorithm)
  27. *
  28. * Some design decisions:
  29. * 32bit Colors - All defined color are always RGBA
  30. * 32bit Textures - All loaded images are converted automatically to RGBA textures
  31. * SpriteFonts - All loaded sprite-font images are converted to RGBA and POT textures
  32. * One custom default font is loaded automatically when InitWindow()
  33. * If using OpenGL 3.3+ or ES2, one default shader is loaded automatically (internally defined)
  34. *
  35. * -- LICENSE (raylib v1.2, September 2014) --
  36. *
  37. * raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
  38. * BSD-like license that allows static linking with closed source software:
  39. *
  40. * Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
  41. *
  42. * This software is provided "as-is", without any express or implied warranty. In no event
  43. * will the authors be held liable for any damages arising from the use of this software.
  44. *
  45. * Permission is granted to anyone to use this software for any purpose, including commercial
  46. * applications, and to alter it and redistribute it freely, subject to the following restrictions:
  47. *
  48. * 1. The origin of this software must not be misrepresented; you must not claim that you
  49. * wrote the original software. If you use this software in a product, an acknowledgment
  50. * in the product documentation would be appreciated but is not required.
  51. *
  52. * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
  53. * as being the original software.
  54. *
  55. * 3. This notice may not be removed or altered from any source distribution.
  56. *
  57. **********************************************************************************************/
  58. #ifndef RAYLIB_H
  59. #define RAYLIB_H
  60. // Choose your platform here or just define it at compile time: -DPLATFORM_DESKTOP
  61. //#define PLATFORM_DESKTOP // Windows, Linux or OSX
  62. //#define PLATFORM_ANDROID // Android device
  63. //#define PLATFORM_RPI // Raspberry Pi
  64. //#define PLATFORM_WEB // HTML5 (emscripten, asm.js)
  65. // Security check in case no PLATFORM_* defined
  66. #if !defined(PLATFORM_DESKTOP) && !defined(PLATFORM_ANDROID) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEB)
  67. #define PLATFORM_DESKTOP
  68. #endif
  69. #if defined(PLATFORM_ANDROID)
  70. #include <android_native_app_glue.h> // Defines android_app struct
  71. #endif
  72. //----------------------------------------------------------------------------------
  73. // Some basic Defines
  74. //----------------------------------------------------------------------------------
  75. #ifndef PI
  76. #define PI 3.14159265358979323846
  77. #endif
  78. #define DEG2RAD (PI / 180.0f)
  79. #define RAD2DEG (180.0f / PI)
  80. // raylib Config Flags
  81. #define FLAG_FULLSCREEN_MODE 1
  82. #define FLAG_SHOW_LOGO 2
  83. #define FLAG_SHOW_MOUSE_CURSOR 4
  84. #define FLAG_CENTERED_MODE 8
  85. #define FLAG_MSAA_4X_HINT 16
  86. // Keyboard Function Keys
  87. #define KEY_SPACE 32
  88. #define KEY_ESCAPE 256
  89. #define KEY_ENTER 257
  90. #define KEY_BACKSPACE 259
  91. #define KEY_RIGHT 262
  92. #define KEY_LEFT 263
  93. #define KEY_DOWN 264
  94. #define KEY_UP 265
  95. #define KEY_F1 290
  96. #define KEY_F2 291
  97. #define KEY_F3 292
  98. #define KEY_F4 293
  99. #define KEY_F5 294
  100. #define KEY_F6 295
  101. #define KEY_F7 296
  102. #define KEY_F8 297
  103. #define KEY_F9 298
  104. #define KEY_F10 299
  105. #define KEY_LEFT_SHIFT 340
  106. #define KEY_LEFT_CONTROL 341
  107. #define KEY_LEFT_ALT 342
  108. #define KEY_RIGHT_SHIFT 344
  109. #define KEY_RIGHT_CONTROL 345
  110. #define KEY_RIGHT_ALT 346
  111. // Mouse Buttons
  112. #define MOUSE_LEFT_BUTTON 0
  113. #define MOUSE_RIGHT_BUTTON 1
  114. #define MOUSE_MIDDLE_BUTTON 2
  115. // Gamepad Number
  116. #define GAMEPAD_PLAYER1 0
  117. #define GAMEPAD_PLAYER2 1
  118. #define GAMEPAD_PLAYER3 2
  119. #define GAMEPAD_PLAYER4 3
  120. // Gamepad Buttons
  121. // NOTE: Adjusted for a PS3 USB Controller
  122. #define GAMEPAD_BUTTON_A 2
  123. #define GAMEPAD_BUTTON_B 1
  124. #define GAMEPAD_BUTTON_X 3
  125. #define GAMEPAD_BUTTON_Y 4
  126. #define GAMEPAD_BUTTON_R1 7
  127. #define GAMEPAD_BUTTON_R2 5
  128. #define GAMEPAD_BUTTON_L1 6
  129. #define GAMEPAD_BUTTON_L2 8
  130. #define GAMEPAD_BUTTON_SELECT 9
  131. #define GAMEPAD_BUTTON_START 10
  132. // TODO: Review Xbox360 USB Controller Buttons
  133. // Some Basic Colors
  134. // NOTE: Custom raylib color palette for amazing visuals on WHITE background
  135. #define LIGHTGRAY (Color){ 200, 200, 200, 255 } // Light Gray
  136. #define GRAY (Color){ 130, 130, 130, 255 } // Gray
  137. #define DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
  138. #define YELLOW (Color){ 253, 249, 0, 255 } // Yellow
  139. #define GOLD (Color){ 255, 203, 0, 255 } // Gold
  140. #define ORANGE (Color){ 255, 161, 0, 255 } // Orange
  141. #define PINK (Color){ 255, 109, 194, 255 } // Pink
  142. #define RED (Color){ 230, 41, 55, 255 } // Red
  143. #define MAROON (Color){ 190, 33, 55, 255 } // Maroon
  144. #define GREEN (Color){ 0, 228, 48, 255 } // Green
  145. #define LIME (Color){ 0, 158, 47, 255 } // Lime
  146. #define DARKGREEN (Color){ 0, 117, 44, 255 } // Dark Green
  147. #define SKYBLUE (Color){ 102, 191, 255, 255 } // Sky Blue
  148. #define BLUE (Color){ 0, 121, 241, 255 } // Blue
  149. #define DARKBLUE (Color){ 0, 82, 172, 255 } // Dark Blue
  150. #define PURPLE (Color){ 200, 122, 255, 255 } // Purple
  151. #define VIOLET (Color){ 135, 60, 190, 255 } // Violet
  152. #define DARKPURPLE (Color){ 112, 31, 126, 255 } // Dark Purple
  153. #define BEIGE (Color){ 211, 176, 131, 255 } // Beige
  154. #define BROWN (Color){ 127, 106, 79, 255 } // Brown
  155. #define DARKBROWN (Color){ 76, 63, 47, 255 } // Dark Brown
  156. #define WHITE (Color){ 255, 255, 255, 255 } // White
  157. #define BLACK (Color){ 0, 0, 0, 255 } // Black
  158. #define BLANK (Color){ 0, 0, 0, 0 } // Blank (Transparent)
  159. #define MAGENTA (Color){ 255, 0, 255, 255 } // Magenta
  160. #define RAYWHITE (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
  161. //----------------------------------------------------------------------------------
  162. // Types and Structures Definition
  163. //----------------------------------------------------------------------------------
  164. // Boolean type
  165. typedef enum { false, true } bool;
  166. // byte type
  167. typedef unsigned char byte;
  168. // Vector2 type
  169. typedef struct Vector2 {
  170. float x;
  171. float y;
  172. } Vector2;
  173. // Vector3 type
  174. typedef struct Vector3 {
  175. float x;
  176. float y;
  177. float z;
  178. } Vector3;
  179. // Color type, RGBA (32bit)
  180. typedef struct Color {
  181. unsigned char r;
  182. unsigned char g;
  183. unsigned char b;
  184. unsigned char a;
  185. } Color;
  186. // Rectangle type
  187. typedef struct Rectangle {
  188. int x;
  189. int y;
  190. int width;
  191. int height;
  192. } Rectangle;
  193. // Image type, bpp always RGBA (32bit)
  194. // NOTE: Data stored in CPU memory (RAM)
  195. typedef struct Image {
  196. Color *pixels;
  197. int width;
  198. int height;
  199. } Image;
  200. // Texture2D type, bpp always RGBA (32bit)
  201. // NOTE: Data stored in GPU memory
  202. typedef struct Texture2D {
  203. unsigned int id; // OpenGL id
  204. int width;
  205. int height;
  206. } Texture2D;
  207. // Character type (one font glyph)
  208. typedef struct Character {
  209. int value; //char value = ' '; (int)value = 32;
  210. int x;
  211. int y;
  212. int w;
  213. int h;
  214. } Character;
  215. // SpriteFont type, includes texture and charSet array data
  216. typedef struct SpriteFont {
  217. Texture2D texture;
  218. int numChars;
  219. Character *charSet;
  220. } SpriteFont;
  221. // Camera type, defines a camera position/orientation in 3d space
  222. typedef struct Camera {
  223. Vector3 position;
  224. Vector3 target;
  225. Vector3 up;
  226. } Camera;
  227. // Vertex data definning a mesh
  228. typedef struct VertexData {
  229. int vertexCount;
  230. float *vertices; // 3 components per vertex
  231. float *texcoords; // 2 components per vertex
  232. float *normals; // 3 components per vertex
  233. unsigned char *colors; // 4 components per vertex
  234. } VertexData;
  235. // 3d Model type
  236. // NOTE: If using OpenGL 1.1, loaded in CPU (mesh); if OpenGL 3.3+ loaded in GPU (vaoId)
  237. typedef struct Model {
  238. VertexData mesh;
  239. unsigned int vaoId;
  240. unsigned int vboId[4];
  241. unsigned int textureId;
  242. //Matrix transform;
  243. } Model;
  244. // Sound source type
  245. typedef struct Sound {
  246. unsigned int source;
  247. unsigned int buffer;
  248. } Sound;
  249. // Wave type, defines audio wave data
  250. typedef struct Wave {
  251. void *data; // Buffer data pointer
  252. unsigned int dataSize; // Data size in bytes
  253. unsigned int sampleRate;
  254. short bitsPerSample;
  255. short channels;
  256. } Wave;
  257. #ifdef __cplusplus
  258. extern "C" { // Prevents name mangling of functions
  259. #endif
  260. //------------------------------------------------------------------------------------
  261. // Global Variables Definition
  262. //------------------------------------------------------------------------------------
  263. // It's lonely here...
  264. //------------------------------------------------------------------------------------
  265. // Window and Graphics Device Functions (Module: core)
  266. //------------------------------------------------------------------------------------
  267. #if defined(PLATFORM_ANDROID)
  268. void InitWindow(int width, int height, struct android_app *state); // Init Android activity
  269. #elif defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
  270. void InitWindow(int width, int height, const char *title); // Initialize Window and OpenGL Graphics
  271. #endif
  272. void CloseWindow(void); // Close Window and Terminate Context
  273. bool WindowShouldClose(void); // Detect if KEY_ESCAPE pressed or Close icon pressed
  274. void ToggleFullscreen(void); // Fullscreen toggle (only PLATFORM_DESKTOP)
  275. #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
  276. void SetCustomCursor(const char *cursorImage); // Set a custom cursor icon/image
  277. void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
  278. #endif
  279. int GetScreenWidth(void); // Get current screen width
  280. int GetScreenHeight(void); // Get current screen height
  281. int GetKeyPressed(void); // Get latest key pressed
  282. void ClearBackground(Color color); // Sets Background Color
  283. void BeginDrawing(void); // Setup drawing canvas to start drawing
  284. void EndDrawing(void); // End canvas drawing and Swap Buffers (Double Buffering)
  285. void Begin3dMode(Camera cam); // Initializes 3D mode for drawing (Camera setup)
  286. void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode
  287. void SetTargetFPS(int fps); // Set target FPS (maximum)
  288. float GetFPS(void); // Returns current FPS
  289. float GetFrameTime(void); // Returns time in seconds for one frame
  290. Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
  291. int GetHexValue(Color color); // Returns hexadecimal value for a Color
  292. int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
  293. Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
  294. void SetupFlags(char flags); // Enable some window configurations
  295. void ShowLogo(void); // Activates raylib logo at startup (can be done with flags)
  296. //------------------------------------------------------------------------------------
  297. // Input Handling Functions (Module: core)
  298. //------------------------------------------------------------------------------------
  299. #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
  300. bool IsKeyPressed(int key); // Detect if a key has been pressed once
  301. bool IsKeyDown(int key); // Detect if a key is being pressed
  302. bool IsKeyReleased(int key); // Detect if a key has been released once
  303. bool IsKeyUp(int key); // Detect if a key is NOT being pressed
  304. bool IsMouseButtonPressed(int button); // Detect if a mouse button has been pressed once
  305. bool IsMouseButtonDown(int button); // Detect if a mouse button is being pressed
  306. bool IsMouseButtonReleased(int button); // Detect if a mouse button has been released once
  307. bool IsMouseButtonUp(int button); // Detect if a mouse button is NOT being pressed
  308. int GetMouseX(void); // Returns mouse position X
  309. int GetMouseY(void); // Returns mouse position Y
  310. Vector2 GetMousePosition(void); // Returns mouse position XY
  311. void SetMousePosition(Vector2 position); // Set mouse position XY
  312. int GetMouseWheelMove(void); // Returns mouse wheel movement Y
  313. #endif
  314. #if defined(PLATFORM_DESKTOP)
  315. bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
  316. Vector2 GetGamepadMovement(int gamepad); // Return axis movement vector for a gamepad
  317. bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button has been pressed once
  318. bool IsGamepadButtonDown(int gamepad, int button); // Detect if a gamepad button is being pressed
  319. bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad button has been released once
  320. bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad button is NOT being pressed
  321. #endif
  322. #if defined(PLATFORM_ANDROID)
  323. bool IsScreenTouched(void); // Detect screen touch event
  324. int GetTouchX(void); // Returns touch position X
  325. int GetTouchY(void); // Returns touch position Y
  326. Vector2 GetTouchPosition(void); // Returns touch position XY
  327. #endif
  328. //------------------------------------------------------------------------------------
  329. // Basic Shapes Drawing Functions (Module: shapes)
  330. //------------------------------------------------------------------------------------
  331. void DrawPixel(int posX, int posY, Color color); // Draw a pixel
  332. void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version)
  333. void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
  334. void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version)
  335. void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
  336. void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
  337. void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
  338. void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
  339. void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
  340. void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
  341. void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle
  342. void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
  343. void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
  344. void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle
  345. void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline
  346. void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
  347. void DrawPolyEx(Vector2 *points, int numPoints, Color color); // Draw a closed polygon defined by points
  348. void DrawPolyExLines(Vector2 *points, int numPoints, Color color); // Draw polygon lines
  349. bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles
  350. bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); // Check collision between two circles
  351. bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); // Check collision between circle and rectangle
  352. Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
  353. bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
  354. bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
  355. bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
  356. //------------------------------------------------------------------------------------
  357. // Texture Loading and Drawing Functions (Module: textures)
  358. //------------------------------------------------------------------------------------
  359. Image LoadImage(const char *fileName); // Load an image into CPU memory (RAM)
  360. Image LoadImageFromRES(const char *rresName, int resId); // Load an image from rRES file (raylib Resource)
  361. Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory
  362. Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource)
  363. Texture2D LoadTextureFromImage(Image image, bool genMipmaps); // Load a texture from image data (and generate mipmaps)
  364. Texture2D CreateTexture(Image image, bool genMipmaps); // [DEPRECATED] Same as LoadTextureFromImage()
  365. void UnloadImage(Image image); // Unload image from CPU memory (RAM)
  366. void UnloadTexture(Texture2D texture); // Unload texture from GPU memory
  367. void ConvertToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two)
  368. void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
  369. void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2
  370. void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
  371. void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
  372. void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, // Draw a part of a texture defined by a rectangle with 'pro' parameters
  373. float rotation, Color tint);
  374. //------------------------------------------------------------------------------------
  375. // Font Loading and Text Drawing Functions (Module: text)
  376. //------------------------------------------------------------------------------------
  377. SpriteFont GetDefaultFont(void); // Get the default SpriteFont
  378. SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory
  379. void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory
  380. void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
  381. void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, // Draw text using SpriteFont and additional parameters
  382. int fontSize, int spacing, Color tint);
  383. int MeasureText(const char *text, int fontSize); // Measure string width for default font
  384. Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing); // Measure string size for SpriteFont
  385. int GetFontBaseSize(SpriteFont spriteFont); // Returns the base size for a SpriteFont (chars height)
  386. void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
  387. const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
  388. //------------------------------------------------------------------------------------
  389. // Basic 3d Shapes Drawing Functions (Module: models)
  390. //------------------------------------------------------------------------------------
  391. void DrawCube(Vector3 position, float width, float height, float lenght, Color color); // Draw cube
  392. void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
  393. void DrawCubeWires(Vector3 position, float width, float height, float lenght, Color color); // Draw cube wires
  394. void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float lenght, Color color); // Draw cube textured
  395. void DrawSphere(Vector3 centerPos, float radius, Color color); // Draw sphere
  396. void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere with extended parameters
  397. void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere wires
  398. void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone
  399. void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone wires
  400. void DrawQuad(Vector3 vertices[4], Vector2 textcoords[4], Vector3 normals[4], Color colors[4]); // Draw a quad
  401. void DrawPlane(Vector3 centerPos, Vector2 size, Vector3 rotation, Color color); // Draw a plane
  402. void DrawPlaneEx(Vector3 centerPos, Vector2 size, Vector3 rotation, int slicesX, int slicesZ, Color color); // Draw a plane with divisions
  403. void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
  404. void DrawGizmo(Vector3 position); // Draw simple gizmo
  405. void DrawGizmoEx(Vector3 position, Vector3 rotation, float scale); // Draw gizmo with extended parameters
  406. //DrawTorus(), DrawTeapot() are useless...
  407. //------------------------------------------------------------------------------------
  408. // Model 3d Loading and Drawing Functions (Module: models)
  409. //------------------------------------------------------------------------------------
  410. Model LoadModel(const char *fileName); // Load a 3d model (.OBJ)
  411. //Model LoadModelFromRES(const char *rresName, int resId); // TODO: Load a 3d model from rRES file (raylib Resource)
  412. Model LoadHeightmap(Image heightmap, float maxHeight); // Load a heightmap image as a 3d model
  413. Model LoadCubicmap(Image cubicmap); // Load a map image as a 3d model (cubes based)
  414. void UnloadModel(Model model); // Unload 3d model from memory
  415. void SetModelTexture(Model *model, Texture2D texture); // Link a texture to a model
  416. void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
  417. void DrawModelEx(Model model, Vector3 position, Vector3 rotation, Vector3 scale, Color tint); // Draw a model with extended parameters
  418. void DrawModelWires(Model model, Vector3 position, float scale, Color color); // Draw a model wires (with texture if set)
  419. void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture
  420. void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec
  421. //------------------------------------------------------------------------------------
  422. // Audio Loading and Playing Functions (Module: audio)
  423. //------------------------------------------------------------------------------------
  424. void InitAudioDevice(void); // Initialize audio device and context
  425. void CloseAudioDevice(void); // Close the audio device and context (and music stream)
  426. Sound LoadSound(char *fileName); // Load sound to memory
  427. Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
  428. Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
  429. void UnloadSound(Sound sound); // Unload sound
  430. void PlaySound(Sound sound); // Play a sound
  431. void PauseSound(Sound sound); // Pause a sound
  432. void StopSound(Sound sound); // Stop playing a sound
  433. bool SoundIsPlaying(Sound sound); // Check if a sound is currently playing
  434. void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
  435. void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
  436. void PlayMusicStream(char *fileName); // Start music playing (open stream)
  437. void StopMusicStream(void); // Stop music playing (close stream)
  438. void PauseMusicStream(void); // Pause music playing
  439. void ResumeMusicStream(void); // Resume playing paused music
  440. bool MusicIsPlaying(void); // Check if music is playing
  441. void SetMusicVolume(float volume); // Set volume for music (1.0 is max level)
  442. float GetMusicTimeLength(void); // Get current music time length (in seconds)
  443. float GetMusicTimePlayed(void); // Get current music time played (in seconds)
  444. #ifdef __cplusplus
  445. }
  446. #endif
  447. #endif // RAYLIB_H