Commit Graph

338 Commits

Author SHA1 Message Date
raysan5
375adf86a6 Review math usage to reduce temp variables 2018-04-02 15:16:45 +02:00
raysan5
bbdf9f4880 Review InitWindow() to avoid void pointer
Reviewed for PLATFORM_ANDROID and PLATFORM_UWP
2018-04-02 14:49:01 +02:00
Ray
e72b96ada1
Merge pull request #508 from a3f/master
Allow use of main instead of android_main
2018-04-02 10:48:02 +02:00
Ray
564baa22d6
Merge pull request #513 from autious/master
Add orthographic 3d rendering mode
2018-04-01 00:27:20 +02:00
Jacques Heunis
b4e2f5b45c Initialize the timer after the graphics device on desktop and web platforms. (#516)
This is already the order that is used for Android. It doesn't appear to
make a difference on desktop but on web using the timer before it's been
initialized (by glfwInit, inside InitGraphicsDevice) causes the a long
(and variable but often several seconds) sleep between the first and
second frame.

Fixes: 468309d ("Early-exit InitWindow if InitGraphicsDevice fails")
2018-03-31 12:22:44 +02:00
Max Danielsson
6c049fdd76 Move deduplicate aspect variable in begin render.
Changes motivated by commentary in pull request 513
2018-03-27 19:59:54 +02:00
Max Danielsson
5ecee69088 Add 3d orthographic projection mode 2018-03-25 18:33:19 +02:00
Ahmad Fatoum
2c219fb814
Allow use of main instead of android_main
Inspired by #504.
Instead of requiring the user to do PLATFORM_ANDROID #ifdefery,
have the android_main entry point exported by raylib and call
the user-defined main. This way many games could (in theory)
run unmodified on Android and elsewhere.

This is untested!
2018-03-16 21:37:22 +01:00
Ray
61e0e4b4f3 Complete review of raymath for API consistency 2018-03-16 13:47:01 +01:00
Ray San
9318dc98ce Support case-insensitive extension check 2018-03-16 13:09:49 +01:00
Ray
487bc613fd Updated raylib dev version 2018-03-15 12:37:52 +01:00
Ray
6c6d6776c0
Merge pull request #482 from a3f/master
raymath.h: Use C99 inline semantics
2018-03-15 12:27:40 +01:00
Ray San
df50eada53 Added new functions
- SetWindowSize() to scale Windows in runtime
- SetMouseScale() to scale mouse input, useful when rendering game to a
RenderTexture2D that will be scaled to Window size (used on rFXGen tool)
2018-03-09 11:43:53 +01:00
raysan5
85850a955a Removed additional code
GLFW has been updated to latest version, probably this code is not
required any more due to already been integrated into library... but it
needs to be tested...
2018-03-03 16:01:24 +01:00
Ahmad Fatoum
f52d2de582
raymath.h: Use C99 inline semantics
RAYMATH_EXTERN_INLINE was renamed to RAYMATH_HEADER_ONLY, which user code
may define if they want to use it as header-only library. If multiple
files in the same project define RAYMATH_HEADER_ONLY, they might each
have duplicate out-of-line definitions of the same functions.

By default, raymath.h exposes inline definitions, which instructs the
compiler _not_ to generate out-of-line definitons, if out-of-line
definitions are required, those of the file defined with
RAYLIB_IMPLEMENTATION are used instead. There may be only one such file.

In C++ mode, the compiler will select only one out-of-line definition
automatically, so no need to define a RAYLIB_IMPLEMENTATION.

Unfortunately, we have to remove raymath function declaration from
raylib.h as those declarations would lead to duplicate out-of-line
definitions which would yield linker errors. This problem didn't
exist with GNU89 or C++, because there multiple defintions are ok,
but in C99 they aren't.
2018-02-24 23:39:23 +01:00
Ahmad Fatoum
a5881fb9cc
Revert "raymath.h: Use C99 inline semantics"
This reverts commit 6ffc8cb799.
and commit e4d7bbec1e.
which I pushed by mistake...
2018-02-24 15:40:08 +01:00
Ahmad Fatoum
6ffc8cb799
raymath.h: Use C99 inline semantics
RAYMATH_EXTERN_INLINE was renamed to RAYMATH_HEADER_ONLY, which user code
may define if they want to use it as header-only library. If multiple
files in the same project define RAYMATH_HEADER_ONLY, they might each
have duplicate out-of-line definitions of the same functions.

By default, raymath.h exposes inline definitions, which instructs the
compiler _not_ to generate out-of-line definitons, if out-of-line
definitions are required, those of the file defined with
RAYLIB_IMPLEMENTATION are used instead. There may be only one such file.

In C++ mode, the compiler will select only one out-of-line definition
automatically, so no need to define a RAYLIB_IMPLEMENTATION.

Unfortunately, we have to remove raymath function declaration from
raylib.h as those declarations would lead to duplicate out-of-line
definitions which would yield linker errors. This problem didn't
exist with GNU89 or C++, because there multiple defintions are ok,
but in C99 they aren't.
2018-02-24 15:37:37 +01:00
Ray
cd5e2e0f17 Corrected cursor issue for Wayland 2018-02-22 00:01:13 +01:00
Ray
36750ffb9a BREAKING CHANGE: Renamed function for consistency
Rename: GetHexValue() renamed to ColorToInt()
Added: ColorToHSV()
2018-02-12 11:55:22 +01:00
Ray
d90a33b850 Some reviews for Android compilation 2018-02-11 01:48:53 +01:00
Ahmad Fatoum
468309d06c
Early-exit InitWindow if InitGraphicsDevice fails
Otherwise we may run into LoadDefaultFont and crash in rlLoadTexture
Also moves InitTimer() before InitGraphicsDevice(), to allow it to be
tested even if InitWindow ultimately fails.
2018-02-09 22:54:35 +01:00
Ahmad Fatoum
a976e76ae6
InitWindow: return false if no monitor found
Otherwise we run into an assertion failure inside GLFW's glfwGetVideoMode.
Example:
http://www.cpantesters.org/cpan/report/b4ba5894-0bdb-11e8-841e-2c60b04e1d2d

This is related to #456.
2018-02-08 12:06:21 +01:00
raysan5
3a11cc5e31 Incremeted version to align with CMake 2018-02-04 13:44:41 +01:00
raysan5
6dc2f979cc Updated raylib version
Note that this version is under development and could be buggy on some
platforms...
2018-02-04 12:33:46 +01:00
raysan5
c32ed921a2 Security check in case window initialization fails 2018-02-04 12:31:16 +01:00
raysan5
70e0070a85 Reviewed window initialization
In case graphic device could not be created it returns false instead of
failing with an error tracelog (and consequently closing the program).
Window initialization success could be checked with new function
IsWindowReady()
2018-02-04 12:26:28 +01:00
Ahmad Fatoum
26c9176a14
Return false from InitWindow if glfwInit or glfwCreateWindow fails
You can't do much with raylib if glfwInit or glfwCreateWindow fails,
currently it just exits by means of TraceLog(LOG_ERROR.
User code, however, might want to fall back to a text-only UI
or display a warning if raylib can't be used.
2018-02-03 14:53:58 +01:00
Ahmad Fatoum
44cd4faf83
exit(3), don't crash, when glfwCreateWindow fails
glfwSetWindowPos was called on a NULL window, triggering an assert
inside GLFW. Check for failure and exit cleanly by means of
TraceLog(LOG_ERROR instead.
2018-02-03 14:46:26 +01:00
Ray
1d5fbef93d Clear fbo for drawing
Just in case ClearBackground() is not used after BeginTextureMode(), it clears fbo to color defined by previous ClearBackground()
2018-01-26 11:49:00 +01:00
Ray
750323da53
Merge branch 'develop' into testing_uwp 2018-01-19 11:41:51 +01:00
Ray
fcb0cae605 Use busy wait loop
If not using busy wait loop, linkage with WINMM in Windows platform is
required
2018-01-07 23:55:23 +01:00
raysan5
b760f16f9b Reviewed framebuffers cleaning
Issues when dealing with FBOs
2018-01-06 02:43:38 +01:00
raysan5
1a82e1ab26 Added function GetFileName()
Review comments
2018-01-02 02:26:05 +01:00
raysan5
e69424c86f Reviewed text input 2017-12-31 23:50:22 +01:00
raysan5
e517d8fd16 Added function SetTraceLogTypes()
Trace log messages could be configured with this function to select wich
ones are shown
2017-12-24 16:47:33 +01:00
raysan5
e574428343 Some formatting tweaks 2017-12-24 16:12:52 +01:00
Ray San
5290390494 Expose GetTime() function to users
Monotonic time since InitWindow() could be retrieved with this function.
2017-12-19 14:06:54 +01:00
Ray
bc6ae93a48 Added some comments on GetTime()
Reviewing GetTime() functionality
2017-12-18 00:06:57 +01:00
Ray San
53ad53d051 Manually review previous PR 2017-12-15 13:44:31 +01:00
user
2affac820e make raylib not clash with windows-header 2017-12-14 11:52:45 +01:00
user
48d0c93ace make GetTime available to user of library 2017-12-14 11:50:35 +01:00
user
a7f2fedbfb compilefix for function declaration (win only) 2017-12-14 11:45:47 +01:00
user
08fc886afd added proper define checks for png-save if it's disabled 2017-12-14 11:40:08 +01:00
Ahmad Fatoum
203b2f65d1
Fix typo in preprocessor macro 2017-12-10 21:11:04 +01:00
Ray San
3b5a26099e Removed OpenAL Soft dependency on building
OpenAL Soft backend is still available in audio module, I'm thinking if
exposing it for building in some way or just left it there for advance
users to switch to it manually in case of necessity...
2017-12-05 14:01:35 +01:00
Ray
54d0acc3b6 Change version number for develop
Updated raylib version to 1.9-dev for development pourposes.

Next raylib version is planned to implement a big amount of changes, so
the version bump.
2017-12-05 00:05:05 +01:00
Ahmad Fatoum
899e1fbd94
Avoid duplicate definition of feature macro
Feature macros need to be defined before #including any headers,
preferably through the build system, but this is good enough.

Fixes a compile error on my fork's Travis CI.
2017-11-22 22:58:18 +01:00
raysan5
24b12e5e23 Remove PLATFORM_ checks from raylib header
Now header is truly multiplatform...

Actually still a small pending check on XBOX gamepad controls that
hopefully will be removed with next GLFW 3.3
2017-11-12 11:45:35 +01:00
Ray San
b6b58991e6 Working on UWP support
Support Universal Windows Platform (UWP):
- Windows 10 App
- Windows Phone
- Xbox One
2017-11-10 12:37:53 +01:00
Ray San
244007a99b Review Fade() functionality 2017-11-03 12:41:03 +01:00
Ray San
3d755d617a Some code tweaks... 2017-11-02 20:08:52 +01:00
Ray
743cc6add6 Review new build platform: FreeBSD
Corrected issue with RPI_CROSS_COMPILE
2017-10-30 00:14:13 +01:00
Ray San
144b0ed695 Renamed gif writting library 2017-10-02 13:06:04 +02:00
Ray San
c45eeb8024 Code tweaks and comments for Android 2017-09-29 13:56:37 +02:00
raysan5
f3f6d3fd8e Added new functions
SetWindowTitle()
GetExtension()
2017-09-08 09:35:54 +02:00
raysan5
eeca607506 Review transforms to match OpenGL 1.1 2017-08-04 18:34:51 +02:00
raysan5
a766e2c480 Updated Vector math to new naming 2017-07-22 22:15:50 +02:00
raysan5
cbb134946c Corrected GetMouseRay() and rlUnproject()
Now it works great with reviewed maths
2017-07-22 11:02:40 +02:00
raysan5
00d2768bc9 Corrected bug on MatrixPerspective()
Some other tweaks...
2017-07-22 10:35:49 +02:00
raysan5
e52032f646 Complete review of raymath
Now it should be coherent with OpenGL math standards
2017-07-21 17:19:28 +02:00
raysan5
38d9fcb08e Moved some functions to raymath
Exposed some raymath useful functions to raylib API
2017-07-21 15:25:35 +02:00
raysan5
84aff31973 MatrixPerspective() angle required in radians
Consistent with similar functions in raymath
2017-07-21 10:42:41 +02:00
raysan5
d368403a13 Working on PBR materials, renamed some data 2017-07-19 10:09:34 +02:00
Ray
6546474fa4 Manual integration of material-pbr into develop 2017-07-17 00:33:40 +02:00
raysan5
36fcffeaae Incremented version number for reference 2017-07-02 19:29:21 +02:00
raysan5
9f09f6f550 Rename enum LogType names...
...to avoid possible conflicting symbols
2017-07-02 12:35:13 +02:00
Michael Vetter
272073785f Add define to have CLOCK_MONOTONIC work in c99
If we compile with c99 without gnu extensions (gnu99) we need this
define, to have CLOCK_MONOTONIC and similar macros available
2017-06-11 11:20:30 +02:00
raysan5
f54501a355 Review gif recording (simplified) 2017-05-27 14:40:05 +02:00
Ray
e01a1ba10c Support Gif recording 2017-05-18 18:57:11 +02:00
Ray
35fe34ba0f Added some useful functions 2017-05-11 16:24:40 +02:00
Ray
bac50fbba5 Review functions descriptions 2017-05-09 22:03:46 +02:00
Ray
321027a242 Added comments to create transparent framebuffer
Comments to create transparent framebuffer on RPI,
when activate you see though full screen window the console below!
2017-05-09 18:11:02 +02:00
Ray
fd1fe3ac14 Lock cursor on first person camera 2017-05-08 21:03:48 +02:00
Ray
822c2ddad5 Some defines tweaks for consistency 2017-05-08 02:47:44 +02:00
Ray
83aba22e49 Improved hi-res timer on Win32 2017-05-08 02:37:37 +02:00
Ray
39732d04ec Comments review 2017-05-08 00:55:26 +02:00
victorfisac
e197665e1d Added function to set window minimum dimensions...
useful when using FLAG_WINDOW_RESIZABLE.
2017-05-02 15:04:32 +02:00
Ray
86f2d4b9f9 Commented pointer lock on web 2017-04-28 00:29:50 +02:00
Ray
ecfe31bf1d Make TraceLog() public to the API
enum LogType could require some revision...
2017-04-21 00:08:00 +02:00
raysan5
7e65c300b6 Make public TakeScreenshot() function 2017-04-16 13:47:49 +02:00
Ray
d2d4b17633 Web: Support pointer lock 2017-04-08 00:16:03 +02:00
Ray
080a79f0b0 Added IsFileExtension()
Replaced old GetExtension() function
Make IsFileExtension() public to the API
2017-03-29 00:35:42 +02:00
Ray
b5dd18a70c Review Sleep() usage, return to busy-wait-loop 2017-03-28 19:15:27 +02:00
Ray
5387b45431 Working on configuration flags 2017-03-25 12:01:01 +01:00
RDR8
9875198a56 c99 fix, some linux housekeeping 2017-03-24 01:20:24 -05:00
Ray
004117a05c core: configuration flags 2017-03-21 13:22:59 +01:00
Ray
59652c75b4 Review some comments 2017-03-20 20:34:44 +01:00
raysan5
8f5ff64420 Working on file header comments... 2017-03-19 12:52:58 +01:00
raysan5
5d1f661661 Remove Oculus support from code
Moved to custom example, now raylib only supports simulated VR
rendering.
Oculus code was too device dependant... waiting for OpenXR.
2017-03-14 01:05:22 +01:00
raysan5
7154b42f48 Corrected naming issue 2017-03-09 18:52:56 +01:00
Ray
7c888edba1 Corrected typo introduced in last commit 2017-03-09 16:25:15 +01:00
Ray
4ec65c0d25 Corrected issue with reserved words: near, far 2017-03-09 16:23:36 +01:00
Ray
81897e7771 Corrected bugs on RPI compilation 2017-03-09 13:13:13 +01:00
raysan5
d1c9afd1d8 Work on timming functions...
It seems Sleep() behaves weird on my computer, disabled by default
returning to the busy wait loop... also re-implemented DrawFPS() to
avoid frame blitting...
2017-03-05 19:17:00 +01:00
raysan5
9cfaa81a7e Added some flags and functions to manage window
- SetWindowPosition(int x, int y);
- SetWindowMonitor(int monitor);
2017-03-05 10:55:29 +01:00
Ray
05cff44d0a Improved modules description -IN PROGRESS-
Working in modules configuration flags...
2017-02-16 00:50:02 +01:00
raysan5
afcd748fdf Reviewed fread() usage around the code 2017-02-11 23:17:56 +01:00
raysan5
c4bd214cf0 Added function SetWindowIcon()
Only DESKTOP platforms (Windows, Linus, OSX)
2017-02-05 03:00:35 +01:00
Ray
495108a2e9 Updated raylib version to 1.7
Preparing for next version... still some work left... :P
2017-01-29 23:08:19 +01:00
Ray
c85dfd4bc6 Remove unecessary spaces... 2017-01-28 23:02:30 +01:00