Commit Graph

1541 Commits

Author SHA1 Message Date
Ray
8a88e65a94 Update src/external/dr_mp3.h 2018-10-17 19:37:53 +02:00
Ray
b8b8936cd7 Review defines 2018-10-16 10:53:01 +02:00
Michael Vetter
d8331bde3a Add FileExists() function 2018-10-14 14:21:02 +02:00
raysan5
68d2b0c071 Corrected description 2018-10-13 16:30:44 +02:00
raysan5
cd6c362485 Corrected func name typo 2018-10-13 16:00:54 +02:00
raysan5
c7b601b624 Renamed new PR function
RENAME: GetLastWriteTime() to GetFileModTime()
2018-10-13 15:59:17 +02:00
ChrisDill
c2b36af60f Added GetLastWriteTime to allow for file reloading
- Added a function to get the last write time of a file. I used this so I can reload files or resources if the time since they were last loaded changes.
2018-10-12 13:53:36 +01:00
Ahmad Fatoum
5945805b15
CMake: remove erroneous status message
OPENGL_VERSION is the version requested by the user,
not the detected one...
2018-10-11 13:52:25 +02:00
Ahmad Fatoum
9b25da5f98
CMake: Fix build breakage trying to set OpenGL version
Fixes #660.
2018-10-11 13:41:47 +02:00
Ray
a12cafe84d
Merge pull request #659 from noshbar/text-memory-leak
Fixes memory leak in text.c
2018-10-11 00:21:25 +02:00
Ray
126ab49221 Minor tweaks 2018-10-10 23:55:36 +02:00
Ray
b8b8e6ab7d
Merge pull request #656 from noshbar/vs2017-fix
Physac.h fix for variable array size declaration.
2018-10-10 23:44:20 +02:00
noshbar
ec6b21bd91 Fixes memory leak in text.c
GenImageFontAtlas() allocates an array of stbrp_rect for the packing functions, but it never frees them.
2018-10-10 22:41:20 +02:00
noshbar
ccaf462cbf GenImageFontAtlas prototype in raylib.h is incorrect.
The prototype of GenImageFontAtlas() in the main raylib.h header has a set of swapped parameter names.
Going through the usage of the function within raylib itself, it appears as if the correct order is:
1) charsCount
2) fontSize

However, it's exposed to the world as the other way around, which may cause some major confusion.
2018-10-10 22:28:17 +02:00
noshbar
7f7f3b7cd5 Physac.h fix for variable array size declaration.
Generating the projects using CMake, targeting VS2017, results in an error when compiling.
This is due to physac.h trying to make a 'vertices' array of size 'int count', making it const does not work, either.

This changes the static declaration to a malloc/free combo.

Tested using the physics-demo.
2018-10-10 21:52:50 +02:00
Ray
f238b9ea3c Small tweak to avoid warning 2018-10-10 12:31:55 +02:00
Ray
a511337ce8 ADDED: GetFileNameWithoutExt 2018-10-10 12:01:59 +02:00
Ray
555fdec958 Corrected issues with VS2017 compilation 2018-10-09 00:20:39 +02:00
Ray
2320c2febf ADDED: ImageExtractPalette() 2018-10-08 18:57:33 +02:00
Ray
4f5937e89b OSX native window keeps breaking... 2018-10-08 18:51:41 +02:00
Ray
717cf77129 Corrected issue with dirent.h inclusion...
...and MacOSX OBJC types definition...
2018-10-08 18:38:39 +02:00
Ray
2652e7d1c1 Avoid multiple gl.h inclusions
Expose native Cocoa Window again...
2018-10-08 18:08:39 +02:00
Ray
81d28c5784 dirent.h implementation for MSVC
This implementation is a bit limited, does not support wide characters directories but it's a temporal solution...

This solution uses "io.h" (like MinGW provided one) while other modern solutions use the "windows.h", that result in duplicate symbols issues... need to review it carefully.
2018-10-08 16:55:01 +02:00
Ray
6e4bd60978 Trying to include dirent.h for MSVC 2018-10-08 16:25:47 +02:00
Ray
2d324f22a7 Corrected issue with native window handler on OSX
Could not be retrieved for now...
2018-10-08 16:12:09 +02:00
Ray
97f6454982 Corrected issue with native handler on OSX 2018-10-08 13:29:42 +02:00
Ray
ca1e309d9d Corrected issue with GetWindowHandle()
Not supported for the moment, issues with Linux (symbol `Font` redefined) and OSX (NSGL type redefined)
2018-10-08 13:14:15 +02:00
Ray
2feea87b61 Multiple changes, check description
REVIEW: Reorganized global variables for consistency
ADDED: GetWindowHandle() to get native window handle
ADDED: GetDirectoryFiles() to get files list for a DIR
2018-10-08 12:29:02 +02:00
Ahmad Fatoum
c4b7d17516
CMake: report what kind of libraries will be built 2018-10-07 21:34:19 +02:00
Ahmad Fatoum
2981713e4f
CMake: accept standard -DBUILD_SHARED_LIBS as well
-DBUILD_SHARED_LIBS=OFF == -DSHARED=OFF -DSTATIC=ON
-DBUILD_SHARED_LIBS=ON  == -DSHARED=ON  -DSTATIC=OFF

Fixes #626.
2018-10-07 21:34:18 +02:00
Ahmad Fatoum
1fe6d9fc06
core: workaround window not being rendered till moved on macOS Mojave
Apple ought to fix their OpenGL implementation, but with OpenGL now
deprecated this might not happen.

This has been reported upstream in GLFW in glfw/glfw#1334.
The workaround comes from kovidgoyal/kitty@b82e74f99

This also fixes the HiDPI (Retina) scaling issues reported in #497,
so the workaround is enabled anywhere __APPLE__ is defined.
2018-10-07 02:14:30 +02:00
Ahmad Fatoum
6572d5ff8c
raylib.h: include <stdbool.h> if available
Previously, if <raylib.h> was #included prior to another header that
defined bool, the compilation would fail.
This is e.g. the case for <perl.h> and <objc/objc.h> which both fall
back to the <stdbool.h> if C99 is available.

The following commit includes <objc/objc.h> in src/core.c, which causes
the same problem.

Avoid this by checking for C99 bool like we already do for C++'s.
2018-10-07 00:39:51 +02:00
Ahmad Fatoum
a56b3c2194
CMake: suppress OpenGL deprecation warnings on macOS Mojave
A single warning at configuration time is enough.
2018-10-07 00:33:05 +02:00
Pablo Marcos Oltra
35634f37c8 Fix physac's fixed time step 2018-10-04 18:29:50 +02:00
Ray
589152b658 Review void pointer incrementation 2018-10-01 15:45:01 +02:00
Ray
d67edb591a Support KXT image file export
[textures] Added SaveKTX()
[rlgl] Exposed rlGetGlTextureFormats()
2018-10-01 15:30:48 +02:00
Ray
ecb787d76f Update version number (internally) 2018-10-01 15:29:34 +02:00
ChrisDill
67dc50ef00 Changed monitor functions to use a index
- Using same idea as SetWindowMonitor to take in a index with 0 being the primary monitor.
2018-09-30 15:20:02 +01:00
ChrisDill
6b84b76b70 Forgot #else in platform check
- Added else so return not compiled twice.
2018-09-29 14:28:07 +01:00
ChrisDill
ed95337eb8 Added platform check
- Added PLATFORM_DESKTOP check for Monitor functions to try to fix issue on android.
- Not sure what return types should be when not on desktop. Added rough guess for now.
2018-09-29 14:10:29 +01:00
ChrisDill
ed79d53e1a Changed tabs to spaces
- Fixed tabs used instead of 4 spaces
2018-09-27 16:23:11 +01:00
ChrisDill
73701c12b2 Merge remote-tracking branch 'upstream/master' 2018-09-27 15:54:02 +01:00
ChrisDill
1836e02c1e Added monitor functions
- Get number of monitors
- Get size, physical size and name of primary monitor. Could pass monitor id instead not sure.
2018-09-27 15:52:56 +01:00
Ray
29eddb9ff3 Updated icon data 2018-09-26 16:02:42 +02:00
Ray
abfbc42df7 PNG image size optimization 2018-09-25 12:53:31 +02:00
Ray
9efe5c6802 Support MP3 wave loading -NOT TESTED- 2018-09-19 15:57:46 +02:00
Ray
be599a9ece enjoy! 2018-09-18 21:34:02 +02:00
Ray
27c3afd91c enjoy! 2018-09-18 21:30:52 +02:00
Ray
2bd18ab91e Support ExportImage() as raw pixel data
Added note on KTX 2.2
2018-09-17 19:00:51 +02:00
Ray
f503fded67 Support image export 2018-09-17 17:06:58 +02:00
Ray
ec5c9686b3 Improved data export capabilities!
REVIEWED: ExportImage()
REVIEWED: ExportMesh()
ADDED: ExportWave()
REMOVED: Internal funcs: SavePNG(), SaveBMP()

NOTE: These changes break the API (parameters order)
2018-09-17 16:56:02 +02:00
Ray
3a1a489545 Removed TABS 2018-09-14 13:00:48 +02:00
Ray
5b09630d45 Update mini_al to v0.8.8
Some minor tweaks around
2018-09-14 12:47:31 +02:00
Ray
f32e23c11b
Merge pull request #641 from ChrisDill/master
Added a few missing functions to raymath
2018-09-13 12:51:45 +02:00
ChrisDill
1e1bbaa40b Added a few missing functions to raymath
- Added Vector2MultiplyV
- Added Vector2DivideV
- Added Vector3Divide
- Added Vector3DivideV
2018-09-13 11:43:10 +01:00
F.H
9f1489dc1d
Update models.c
fix bug with GenMeshPlane() creating too many vertices/texcoords/normals for the plane mesh
2018-09-06 21:11:00 +02:00
Ray
dfb8837c46 Support aliased font texture generation
Useful for bitmaps pixelated fonts where anti-aliasing is not desired!
Change also enables additional font generation mechanisms in a future (cleartype, hinting...).
2018-09-06 16:56:21 +02:00
Ray
1fcb3c0317 Started working on IQM/glTF loaders 2018-09-05 10:59:05 +02:00
Ray
ac31f51c5e Corrected issue with font tint 2018-09-05 10:47:57 +02:00
Ray
d0608b031a Corrected issue with types 2018-09-05 10:47:40 +02:00
raysan5
207b5a26b1 Create release directory if not exist 2018-08-25 18:25:51 +02:00
raysan5
af919e5c9f Review naming to follow raylib conventions
strprbrk() does not follow raylib function name convention but as it is
very similar to the standard strpbrk(), we'll keep the naming... also,
don't like to mix static functions with API functions but as strprbrk()
is just used in the two functions below, it's ok to be there... maybe it
could be refactored in a future or even move the logic inside the
required functions...
2018-08-25 17:55:25 +02:00
Ahmad Fatoum
85213795d1
GetDirectoryPath: return NULL, don't crash when no slash
Noted in #634.
2018-08-25 09:27:41 +02:00
Ahmad Fatoum
5dda105a79
core: Support slashes as well in GetFileName & GetDirectoryPath
Fixes #634.
2018-08-25 09:23:40 +02:00
Oğuzhan Çankaya
2bef76735d
lerp for vector2 and float 2018-08-21 04:14:43 +03:00
Justin Clift
699cadcf98 Add the remaining numeric keypad keys, and a few other missing ones 2018-08-19 18:00:16 +01:00
Justin Clift
6a5dbeace8 Add the plus and minus keys on both the main keyboard and keypad 2018-08-19 14:40:30 +01:00
Ray
506b7b8d7c Corrected issue with batch overflows
When a batch reach its vertex limit, a draw call is issued and batch restarted for refilling but if the draw call was issued for vertex data accumulated inside rlPushMatrix/rlPopMatrix, draw call was issued before the rlPopMatrix, consequently modelview matrix was not properly recovered before the draw call... obviously, it only happened the following draw calls, not the first one...

Now it works ok but this system needs to reviewed, noticed and important frames drop when processing around 20 dynamic batch draw calls, it means filling MAX_QUADS_BATCH (8192) quads of data 20 times per frame, including data updating and sending for draw processing.

Doing some maths, it means:
Vertex data (float) -----> 8192 quads * 4 vertex * 3 comp * 4 byte = 393216 bytes
Texcoords data (float) -> 8192 quads * 4 vertex * 2 comp * 4 byte = 262144 bytes
Color data (uchar) -----> 8192 quads * 4 vertex * 4 comp * 1 byte = 131072 bytes

Thats a total of 786432 bytes (0.75MB) sent to GPU 20 times per frame for processing... I'm testing in an Intel HD Graphics integrated, I imagine is too much data to be sent and and it causes stalls, so the frames drop...
2018-08-17 13:55:46 +02:00
Ray
732b775a1d Proper variables initialization 2018-08-17 11:41:49 +02:00
Ray
4c84208644 Working on batch reset issue
Corrected memory leak!
2018-08-17 01:34:45 +02:00
Ray
eef44fd930
Merge pull request #625 from ChrisDill/master
Raymath dllexport fix
2018-08-16 23:04:17 +02:00
ChrisDill
c669c6762f Improved raymath defines
- Using raylib.h as reference, added define checks for BUILD_LIBTYPE_SHARED and USE_LIBTYPE_SHARED.
2018-08-16 18:20:49 +01:00
ChrisDill
a187361c6f Raymath dllexport fix if _WIN32 defined
- Added check for dllexport to compile if _WIN32 defined.
- If not defined then use the original RMDEF.
2018-08-16 12:54:45 +01:00
ChrisDill
42b52ecdb1 Raymath dllexport fix
- Added __declspec(dllexport) to RMDEF in raymath.h. This allows them to be accessed when importing from raylib.dll.
2018-08-16 11:29:30 +01:00
Ray
b88bfa7267 Review PR formatting 2018-08-14 09:57:31 +02:00
Joseph-Eugene Winzer
1cef8ea1bf Shapes: Simplifies CheckCollisionRecs
By comparing the edges of the rectangles relative to each other we can
determine if they intersect or not.
2018-08-14 00:14:06 +02:00
David Reid
3200b23469 Update mini_al.
This should improve the Raspberry Pi experience.
2018-08-12 13:45:12 +10:00
Ray
00f5f2ead2
Merge pull request #616 from overdev/master
[Feature Request] 9-patch drawing function
2018-08-09 22:42:05 +02:00
Jorge A. Gomes
dab78d59f3
Update textures.c
See raylib/examples/textures/textures_image_9patch.c for how to use `DrawTextureNPatch` function.
2018-08-08 16:42:39 -03:00
Jorge A. Gomes
5f89e35d1c
Update raylib.h 2018-08-08 16:39:10 -03:00
Ray
7634cbeb22 Updated mini_al
Corrected issue with sound playing (pop sound at the end)
2018-08-08 18:26:05 +02:00
Ray
b042fe12e6 Reviewed spacings on latest PR 2018-08-06 20:49:47 +02:00
Ray
61b32e45ed
Merge pull request #618 from kimkulling/fix_compiler_warnings
Fix compiler warnings
2018-08-06 20:43:28 +02:00
Kim Kulling
f5f7ed79b8 Fix compiler warnings of lib 2018-08-05 23:53:34 +02:00
Kim Kulling
b2cac82fa0 Fix compiler warings in texture.c and more. 2018-08-05 00:34:35 +02:00
Kim Kulling
ecf8bff4aa Fix compiler warnings, first part 2018-08-04 10:32:16 +02:00
Jorge A. Gomes
28424141f0
Update textures.c
Added support form vertical and horizontal 3-patches.
Corrected the distortion caused when destRec size is smaller than 4x4. Now even 1x10 or 0x0 sizes are drawn correctly.
2018-08-03 20:53:15 -03:00
Jorge A. Gomes
6ef03ea4e8
Update raylib.h
Added support form vertical and horizontal 3-patches.
Corrected the distortion caused when destRec size is smaller than 4x4. Now even 1x10 or 0x0 sizes are drawn correctly.
2018-08-03 20:50:13 -03:00
Ray
d4bb444fe5
Merge pull request #609 from pamarcos/fix_physac_examples
[physac] Fix Physac examples to be run without creating new thread
2018-08-03 12:47:53 +02:00
Jorge A. Gomes
7cc2a5585b
Update textures.c
Added DrawNinePatch() function implementation.
2018-08-03 04:51:26 -03:00
Jorge A. Gomes
c9ca14e659
Update raylib.h
Added NinePatch struc definition and function prototype.
2018-08-03 04:48:46 -03:00
Ahmad Fatoum
286c41af52
Sync with upstream GLFW pull request
The GLFW tree distributed with raylib has two modifications:

- GLFW_PKG_{DEPS,LIBS} are exported to PARENT_SCOPE, so we can use them
  in our pkg-config file
- An intermediary glfw_objlib target is added, so we can reexport GLFW
  symbols from libraylib.a

rglfw can fix the second point, but for Wayland usage, we would have to
replicate protocol generation, so we just leverage GLFW's existing
support instead.

To make maintenance easier, I have submitted a pull request for
including these modifications to upstream GLFW.
And to make that one easier, this patch dog-foods the modifications,
so raylib users can help find regressions. :-)

glfw/glfw#1307
2018-07-29 23:56:16 +02:00
Ray
7154a83313
Merge pull request #610 from pamarcos/fix_chdir_macos
[games] Prevent GLFW changing working dir to 'Resources'
2018-07-29 23:40:13 +02:00
Pablo Marcos Oltra
907e27ef4e Fix Physac examples to be run without creating new thread 2018-07-29 21:32:39 +02:00
Ahmad Fatoum
78487f7521
CMake: Make the raylib project as a whole embeddable
So user code can use add_subdirectory to build it (similar to what we do
with GLFW or what the projects/CMake/CMakeLists.txt can do).
2018-07-29 21:28:23 +02:00
Pablo Marcos Oltra
89cec68565 Prevent GLFW changing working dir to 'Resources' 2018-07-29 18:38:31 +02:00
Ahmad Fatoum
e82505b873
Add projects/CMake example
The CMakeLists.txt checks for an installed raylib and downloads and
installs one if none is found. Afterwards, it builds core_basic_window.c
2018-07-29 18:27:59 +02:00
Ahmad Fatoum
548dbeb1ca
Fix typo (s/proedural/procedural) 2018-07-29 13:04:16 +02:00
Ahmad Fatoum
2ae6df47fc
CMake: Set -DMACOS_FATLIB=OFF by default
Homebrew doesn't ship 32-bit libraries anymore, so using both
-DUSE_EXTERNAL_GLFW and -DMACOS_FATLIB with a Homebrew GLFW would fail.
With -DUSE_EXTERNAL_GLFW=OFF, this is not a problem, but I think keeping
it off by default makes more sense. If someone wants universal
libraries, they can just toggle it.
2018-07-29 12:35:36 +02:00
Ahmad Fatoum
4d209d45aa
core: Don't use GLFW_TRANSPARENT_FRAMEBUFFER with older GLFWs
PLATFORM_WEB is not the only platform that doesn't define
GLFW_TRANSPARENT_FRAMEBUFFER, it's also recent enough that it's not
included in the most recent GLFW 3.2.1 release, so this error can creep
up when using USE_EXTERNAL_GLFW.
2018-07-29 12:35:36 +02:00