386 Commits

Author SHA1 Message Date
Ray San
cc3b8645df Updated release version 2018-04-10 10:37:48 +02:00
Ray
8e44f7b3c7 Reviewed config.h formatting
Added raylib version to config
2018-04-09 23:01:20 +02:00
Ray
54e24d905a Init frame timming measure variables 2018-04-09 22:28:41 +02:00
Ray
cd616258c6 Merge pull request #522 from a3f/master
Refactor all #define SUPPORT_* into a config.h
2018-04-08 22:46:44 +02:00
Ray
9e7dedf5af Merge pull request #521 from TheLumaio/master
Added GetCollisionRayModel
2018-04-08 22:28:19 +02:00
Ahmad Fatoum
1dbce35247 CMake: Generate config.h from CMakeOptions.txt
I would have liked config.h to be selected by include dir configuration,
but this way is less intrusive.
2018-04-07 23:39:53 +02:00
Ahmad Fatoum
1841afad11 Refactor all #define SUPPORT_* into a config.h
That way, a user needs only to touch a single file to configure what
features raylib is built with.
Include guards are left out intentionally, because config.h should only
be included in source files, not headers.

Later on, config.h can also define the raylib version (#461).
2018-04-07 23:37:48 +02:00
Ahmad Fatoum
d88523f03a Split CMake options into separate CMakeOptions.txt 2018-04-07 22:41:43 +02:00
Milan Nikolic
3caa044bf2 Add GNUInstallDirs and USE_AUDIO/USE_WAYLAND options to CMake (#518) 2018-04-07 16:32:14 +02:00
lumaio teon
7bd0f8b28c Fix mesh picking example 2018-04-07 04:00:06 -04:00
lumaio teon
d2cc5b88df Removed useless GetCollisionRayMesh and libraylib.a 2018-04-07 03:49:56 -04:00
lumaio teon
d003c23ecf Added GetCollisionRayModel 2018-04-06 12:04:09 -04:00
Ray
b8bd1d2ea6 Remove unnecesary NPOT check
Now PLATFORM checks only used on core and utils modules
2018-04-05 19:22:45 +02:00
Ray
005f2ffb75 Simplified some code 2018-04-05 19:18:44 +02:00
Ray
931b672c92 Added: ImageDrawRectangle()
Renamed SaveImageAs() to ExportImage() for consistency on what actually happens with data.
2018-04-04 12:02:20 +02:00
Ray
6edf15b9f9 Added funtion: ExportMesh() 2018-04-04 12:00:54 +02:00
Ray
322cebcbaf Updated to latest raylib changes
Removed OpenAL and GLFW3 dependencies on building.
Reviewed platforms and flags
2018-04-03 22:44:45 +02:00
Ray
9393d1d76f Merge branch 'master' of https://github.com/raysan5/raylib 2018-04-03 12:43:42 +02:00
Ray San
fe1c04d1b8 Removed old code 2018-04-03 12:42:28 +02:00
Ray
533780aadf Review ImageDraw() alpha blending
Not sure if math is ok... just left a commented piece of code that uses pre-multiplied alpha.
2018-04-03 12:42:22 +02:00
Ray
0c0ff2802e Review games Makefile 2018-04-02 18:46:22 +02:00
Ray
3e0de31424 Merge pull request #504 from Martinfx/master
Fix potential bugs from static analysis
2018-04-02 18:10:38 +02:00
Ray
befd363966 Update README.md 2018-04-02 15:38:33 +02:00
raysan5
375adf86a6 Review math usage to reduce temp variables 2018-04-02 15:16:45 +02:00
raysan5
6985953e3d Update release to latest raylib version
Note that only some lib versions have been updated
2018-04-02 14:50:16 +02:00
raysan5
e18e8c6276 Review UWP configuration 2018-04-02 14:49:27 +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
maficccc@gmail.com
201007e426 Fix sscanf() without field limits can crash with huge input data 2018-04-02 13:30:20 +02:00
maficccc@gmail.com
db98dba10f Fix Allocator sizeof operand mismatch 2018-04-02 13:30:20 +02:00
maficccc@gmail.com
03ca9508bf Fix Dead initialization 2018-04-02 13:30:20 +02:00
maficccc@gmail.com
44eedf235d Redundant assignment of 'angle' to itself 2018-04-02 13:30:20 +02:00
maficccc@gmail.com
551cf50685 Fix Uninitialized argument value 2018-04-02 13:30:20 +02:00
maficccc@gmail.com
6a3eca3f92 Fix value stored to 'body' is never read 2018-04-02 13:30:20 +02:00
maficccc@gmail.com
ca9e652f8b Remove dead assignment 2018-04-02 13:30:19 +02:00
Martinfx
28a9a181cb Fix use after free 2018-04-02 13:30:19 +02:00
maficccc@gmail.com
9459186125 Fix call argument is an uninitialized value 2018-04-02 13:30:19 +02:00
maficccc@gmail.com
df74607479 Fix warning: illegal character encoding in string literal 2018-04-02 13:30:19 +02:00
maficccc@gmail.com
e659336c11 Fix value stored to 'num_channels' is never read 2018-04-02 13:30:19 +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
raysan5
bd2c81d481 Review links 2018-04-01 23:33:37 +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
42e64e931b Simplify camera data switch in orthographic 3d example 2018-03-27 21:16:25 +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
e38d28543a Remove state bool in camera projection type example.
Changes made based on commentary in pull request 513
2018-03-27 19:58:42 +02:00
Max Danielsson
d91179f8ab Add orthographic projection example 2018-03-25 18:49:15 +02:00
Max Danielsson
5ecee69088 Add 3d orthographic projection mode 2018-03-25 18:33:19 +02:00
Ray
22c8ea76aa Merge pull request #510 from mackron/patch-2
Fix an infinite loop in ALSA backend of mini_al.
2018-03-20 09:53:08 +01:00
David Reid
a8e2c7de9c Fix an infinite loop in ALSA backend of mini_al. 2018-03-20 18:39:21 +10:00
Ray
deffad1701 Review tabs issue when compiling...
...PLATFORM_ANDROID on Windows, using MinGW-w64 (x86) provided Make (GCC
7.2)
2018-03-19 23:49:14 +01:00
Ray
aab6c11ce1 Merge pull request #509 from mackron/patch-1
Fix a buffer overflow in the OSS/BSD backend of mini_al.
2018-03-18 13:15:32 +01:00
David Reid
4a69c2d75e Fix a buffer overflow in the OSS/BSD backend. 2018-03-18 14:37:41 +10: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
9d8f15c19d Reviewed raymath changes 2018-03-15 12:37:23 +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
4cae2b8829 Merge pull request #505 from Martinfx/max-add-memory-sanitizer
Add memory sanitizer for better debug
2018-03-14 16:11:29 +01:00
maficccc@gmail.com
4c0925067a Add message warning for msan 2018-03-14 15:23:14 +01:00
maficccc@gmail.com
82491fcf6c Add memory sanitizer for better debug 2018-03-14 00:13:23 +01:00
raysan5
b9573e583f Merge branch 'master' of https://github.com/raysan5/raylib 2018-03-11 11:02:03 +01:00
raysan5
d6c1159fce Corrected typo 2018-03-11 11:01:58 +01:00
Ray
8bc2813b0c Merge pull request #500 from victorfisac/fork/master
[fork/master] Fixed some memory leaks and add null checks for consistency
2018-03-11 10:51:15 +01:00
raysan5
a0127d8300 Corrected typo 2018-03-11 10:49:51 +01:00
raysan5
fd5e457bb4 Correct issue with triangleCount 2018-03-11 10:41:49 +01:00
victorfisac
5b4197afeb Updated copyright years 2018-03-10 21:14:11 +01:00
victorfisac
d6fee9da29 Fixed compilation code comment in header 2018-03-10 19:30:25 +01:00
victorfisac
3201bad65a Fixed memory leaks in physics step operations 2018-03-10 19:25:17 +01:00
victorfisac
8f1d6f3850 Merge branch 'master' of github.com:raysan5/raylib into fork/master 2018-03-10 19:10:37 +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
Ray
276847eca9 Correct issue with tangents 2018-03-04 23:24:30 +01:00
maficccc@gmail.com
8cb324b2da Fix result of operation is garbage or undefined 2018-03-04 16:26:49 +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
raysan5
3b4a64f2d6 Updated GLFW library to latest version 2018-03-03 15:58:44 +01:00
Ray
fd2adbe62d Renamed CalculateBoundingBox() to MeshBoundingBox()
Renamed function for consistency with a possible Mesh manipulation functions (maybe added in a future). Naming follows Image*() manipulation functions.
2018-02-26 12:10:45 +01:00
Ray
a7207dc6d4 Removed tangents generation
It has no sense to be inside LoadOBJ(), mesh processing moved to own functions: MeshTangents() and MeshBinormals(). Not exposed to user yet.
2018-02-26 12:02:05 +01:00
Ahmad Fatoum
3f48ffb1b6 Fix two memory leaks in jar_xm.h
Found by LeakSanitizer in #494.
2018-02-26 00:14:19 +01:00
RDR8
18f61948ce Update Makefile
$ make clean
Makefile:296: *** missing separator.  Stop.
2018-02-25 22:27:32 +01:00
Ahmad Fatoum
80bf636f81 Don't exceed signed int range when shifting left
Fixes UB in #489, found by UBSan.
2018-02-25 03:17:57 +01:00
Ahmad Fatoum
76aca9b0d1 Fix possible buffer overflow in LoadBMFont
Width specifier doesn't include NUL terminator.
Fixes #487 found by AddressSanitizer.
2018-02-25 03:03:37 +01:00
Ray
c5f7863689 Merge pull request #492 from a3f/raylib-master
jar_xm: Workaround for unaligned pointer accesses
2018-02-25 00:04:50 +01:00
Ahmad Fatoum
1430d01906 jar_xm: Workaround for unaligned pointer accesses
jar_xm.h does some shady pointer casts leading to unaligned accesses
and breaking strict aliasing. x86 has special circuitry for doing
unaligned accesses, but on other architectures, it may trap and require
kernel fix-up or crash outright. With this patch, one obstacle in
porting raylib to the GameBoy Advance has been removed. Go for it ;-)

To avoid having to rewrite that `mempool' code, insert padding before
structs and instruct the compiler (GCC, most importantly), to be gentle
when optimizing.

This fixes #490 (Unless we got ourselves 256-bit pointers, if so,
hello future!)
2018-02-24 23:59:56 +01:00
Ray
6026ed61a5 Merge pull request #480 from RDR8/master-patch-makefiles
Update Makefiles. Automate example usage of staged libraylib.so.
2018-02-24 23:57:46 +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
ed6962edd3 Make MatrixToFloat and Vector3ToFloat reentrant
Besides making it thread-safe, it suppresses a GCC warning
when making them static inline in an upcoming patch.
2018-02-24 23:39:17 +01:00
RDR8
2b5fc12036 Update Makefiles. Enable example usage of staged libraylib.so. 2018-02-24 14:24:55 -06: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
c9043b5a87 CMake: Add options to use -fsanitize={address,undefined}
To make bugs like #485, #486, #487 and #488 easier to find in future.
2018-02-24 15:37:38 +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
Ahmad Fatoum
e4d7bbec1e Make MatrixToFloat and Vector3ToFloat reentrant
Besides making it thread-safe, it suppresses a GCC warning
when making them static inline in an upcoming patch.
2018-02-24 15:37:37 +01:00
Ray
077bef4286 Support 4 components mesh.tangent data
Added struct Vector4 for convenience
2018-02-24 12:31:32 +01:00
Ray
6d64327a87 Reviewed unloading model data
When UnloadModel() --> UnloadMaterial(), avoid unloading default shader (if used) and avoid unlaoding default texture (if used), that data is managed by raylib internally. The question is... should UnloadModel() also UnloadMaterial()?
2018-02-22 12:39:17 +01:00
Ray
cd5e2e0f17 Corrected cursor issue for Wayland 2018-02-22 00:01:13 +01:00
Ray
326fe09777 Reviewed compilation for OpenGL 1.1 2018-02-21 23:47:48 +01:00
Ray
97bf2706c4 Removed flag -fgnu89-inline 2018-02-21 23:28:34 +01:00
Ray
788049df09 Update README.md 2018-02-20 11:04:02 +01:00
Ray
81546308cd Update README.md 2018-02-20 10:48:34 +01:00
Ray
11612fce27 Reviewed timming system for macOS
Apparently, before macOS Sierra version, clock_gettime was not available, using MATCH timming system instead
2018-02-20 10:30:51 +01:00
Ahmad Fatoum
1652943f98 Docs: Replace references to raylib develop branch
Found by grepping for '(blob|tree)/develop'.  See #443 for more information.
2018-02-19 13:58:25 +01:00
Ahmad Fatoum
d892243d18 CI: Build artifacts for master, not develop tags
See #443 for more information.
2018-02-19 13:56:55 +01:00
Ray
f6231aa8b6 Merge pull request #474 from raysan5/develop
Integrate develop branch (LAST INTEGRATION)
2018-02-19 12:08:35 +01:00
Ray
7e32a627e8 Corrected path backslash 2018-02-19 00:03:24 +01:00
raysan5
0958904eac Added comments to review function ImageTextEx() 2018-02-18 19:29:13 +01:00
raysan5
4492a70a4b Support UTF8 basic characters on ImageTextEx()
Supported UTF8 range equivalent to [128..255] (80h..FFh)
Exposed and renamed text function GetGlyphIndex()
Renamed spriteFont parameter name to simply font
Small security check on transmission mission ending screen
2018-02-18 18:07:57 +01:00
raysan5
50fc4f7164 Reviewed transmission mission game
Support string replacing to generate newspaper headline
ISSUE: UTF8 characters not supported when drawing to Image
2018-02-17 21:23:45 +01:00
Ray
769cf23e53 Merge pull request #470 from jubalh/develop
Add Builder project files
2018-02-16 12:12:59 +01:00
Michael Vetter
883ed20e7c Add note about glfw3 and openAL 2018-02-16 11:53:04 +01:00
Michael Vetter
e0a3a51b75 Builder project: Add note about examples 2018-02-16 11:25:12 +01:00
Michael Vetter
6ebc3fd29a Add core_basic_window project example for Builder 2018-02-16 11:23:02 +01:00
Michael Vetter
988f5b7832 Add Builder project template 2018-02-16 11:20:21 +01:00
Ahmad Fatoum
051040af2d CMake: Remove _RAYLIB suffix from -D{SHARED,STATIC}_RAYLIB
They were named so for compatibility with make, but make doesn't use
the anymore. I always forget whether it's SHARED_RAYLIB or
RAYLIB_SHARED...

For now, RAYLIB_SHARED and STATIC_RAYLIB may still be used,
but print a deprecation warning.
2018-02-16 05:58:18 +01:00
Ray
ffde83d85f Merge pull request #467 from raysan5/develop
Integrate develop branch
2018-02-14 22:44:09 +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
7530a60abc Update README.md 2018-02-12 11:53:47 +01:00
Ray
dd8f0765b8 Merge pull request #465 from raysan5/develop
Integrate develop branch into master
2018-02-12 11:27:26 +01:00
Ray
8af5f9dfe0 Avoid rendering SPACE character! 2018-02-12 11:25:00 +01:00
Ray
51124bfb74 Merge pull request #464 from RDR8/develop-make-install-linux
Linux make install improvements
2018-02-12 11:23:31 +01:00
RDR8
97f8b85429 Update Makefile 2018-02-12 09:19:24 +00:00
RDR8
f742f1289d Update Makefile 2018-02-12 05:17:02 +00:00
RDR8
0be4d802ee Update Makefile 2018-02-12 01:25:08 +00:00
RDR8
5616314069 Update Makefile 2018-02-12 00:15:58 +00:00
RDR8
4c4b564392 Update Makefiles for Linux installation. See prior commit.
These changes are intended to provide context and control over the Linux make install process. make install RAYLIB_LIBTYPE=SHARED now works as expected. libraylib.so is properly installed with attendant runtime links. The examples will be running against the newly installed libraylib.so unless otherwise specified with RAYLIB_RUNTIME_PATH. See raylib/src/Makefile and raylib/examples/Makefile for usage of RAYLIB_INSTALL_PATH, RAYLIB_H_INSTALL_PATH, and RAYLIB_RUNTIME_PATH variables. RAYLIB_RUNTIME_PATH in particular is interesting for portability since sudo isn't needed.
The default configuration and workflow is essentially unchanged and unaffected.
2018-02-11 23:42:22 +00:00
RDR8
e86b4d4e03 Update Makefiles for Linux installation. 2018-02-11 22:58:15 +00:00
Ahmad Fatoum
1be72a2e72 pkg-config: Empty Requires.private on shared-only build
If user doesn't build the static library,
`pkg-config --static --libs raylib` should be equivalent to
`pkg-config --libs raylib`.
2018-02-11 20:10:50 +01:00
Ahmad Fatoum
09b022305f mini_al: Support {Net,Open}BSD OSS
Fixes this build failure:
http://www.cpantesters.org/cpan/report/a069fade-0e1f-11e8-a1cf-bb670eaac09d
2018-02-11 12:20:17 +01:00
Ray
d90a33b850 Some reviews for Android compilation 2018-02-11 01:48:53 +01:00
Ray
231a69417a Corrected masteVolume setting 2018-02-11 01:28:30 +01:00
Ray
7bf6becc94 Reviewed mini_al implementation
- Some functions renamed
- Comments reviewed
- Functions reorganized
2018-02-11 01:12:16 +01:00
Ray
6d922b3e1f Renamed iconography 2018-02-10 23:29:40 +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
Ray
f72b315cb6 Updated external libraries 2018-02-09 00:01:00 +01:00
Ray
2ace360230 Merge pull request #462 from a3f/develop
InitWindow: return false if no monitor found
2018-02-08 12:24:51 +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
Ray
4d5d1e0434 Added function LoadShaderCode()
Allows loading of shader from text code string directly
2018-02-05 01:03:13 +01:00
Ray
b908a4078a Merge pull request #460 from raysan5/develop
Integrate develop branch
2018-02-04 13:47:42 +01:00
raysan5
5437458469 Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2018-02-04 13:46:45 +01:00
raysan5
3a11cc5e31 Incremeted version to align with CMake 2018-02-04 13:44:41 +01:00
Ray
327aec9da4 Merge pull request #459 from a3f/develop
Bump version to 1.9.4
2018-02-04 13:44:20 +01:00
Ahmad Fatoum
19f280f4b7 Bump version to 1.9.4 2018-02-04 13:36:08 +01:00
Ahmad Fatoum
184df917be Travis CI: Don't use external GLFW
While nice to test, this would mean that the tagged release will depend
on GLFW as well… Therefore disable it for now.
2018-02-04 13:35:18 +01:00
Ray
d50e291e86 Merge pull request #458 from raysan5/develop
Integrate develop branch into master
2018-02-04 12:51:24 +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
8f287e72d2 Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2018-02-04 12:26:33 +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
cb66c89dfa CMake: Rename WITH_SYSTEM_GLFW to USE_EXTERNAL_GLFW
for consistency with Makefile. Requested by @raysan5 in #453.
2018-02-04 12:10:23 +01:00
Ray
e2861fa71f Merge pull request #456 from a3f/develop
Return false from InitWindow if glfwInit or glfwCreateWindow fails -TO REVIEW AS DISCUSSED-
2018-02-04 11:55:18 +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
Ahmad Fatoum
2b2b1f91ee CMake: Fix typo in GLFW detection
Let it be noted I utterly dislike their syntax.
2018-02-03 13:30:59 +01:00
Ray
5bb23c6c06 Update README.md 2018-02-03 11:33:05 +01:00
Ray
7918c0bf71 Removed external dependencies 2018-02-03 11:31:54 +01:00
Ahmad Fatoum
7f5fa4d49c CMake: Add tristate option for using system GLFW (#455)
-DWITH_SYSTEM_GLFW=ON: Link against system glfw and fail otherwise
-DWITH_SYSTEM_GLFW=OFF: Use embedded rglfw.c
-DWITH_SYSTEM_GLFW=IF_POSSIBLE: Probe for system glfw but fallback to
                                rglfw if unavailable

Also change Linux 64-bit CI build to install system glfw and use it,
so this doesn't bitrot.

Addresses #453.
2018-02-03 10:17:51 +01:00
Ahmad Fatoum
007ae1b7b3 CMake: Fix typo in MACOS_FATLIB 2018-02-03 09:38:57 +01:00
Ray San
d1ef6869a9 Added function DrawRectangleLinesEx() 2018-02-02 11:01:38 +01:00
Ray
58346414f7 Corrected typo 2018-01-31 15:32:40 +01:00
Ray
44c95af463 Added missing keys definitions 2018-01-31 14:08:08 +01:00
Ray
227880977e Do not ignore Makefiles! 2018-01-29 14:01:06 +01:00
Ray
eb508bf75f Upload GGJ18 game: transmission mission
Game developed in the GGJ18, it has some bugs and ending screen is
incomplete... I'll try to keep working a bit more on it.
2018-01-29 13:46:04 +01:00
Ray
1ce8c80de9 Corrected several issues... 2018-01-28 16:52:18 +01:00
Ahmad Fatoum
f955b2255d GLFW: Fix build error on Linux < v2.6.39
Cherry-pick from upstream glfw/glfw#1196
Found in CPANtesters test of Alien::raylib:
http://www.cpantesters.org/cpan/report/d956d128-0339-11e8-b0d1-b6c4abd39192
2018-01-27 14:53:04 +01:00
Ahmad Fatoum
2090ad8119 CMake: Add missing 0 to minimum version
Removed by mistake.
2018-01-27 02:00:40 +01:00
Ahmad Fatoum
7f7aac643a CMake: Search dependencies and build pkg-config's Libs.private with it 2018-01-27 01:57:21 +01:00
Ahmad Fatoum
1093766669 CMake: remove OpenAL dependency 2018-01-27 01:05:17 +01:00
Ahmad Fatoum
d5bbcbc15f Travis CI: Don't set CFLAGS=-m64 for macOS build 2018-01-27 01:05:17 +01:00
Ahmad Fatoum
1ab3c058f5 Drop libglew-dev as prereq for Travis build
Noted by @eserte in athreef/Alien-raylib#2. Thanks!
2018-01-26 22:14:05 +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
779719f5dc Merge pull request #440 from a3f/develop
Make function calls without prior declaration an error
2018-01-26 01:17:19 +01:00
Ahmad Fatoum
520f317a75 #include header for time() on Windows 2018-01-25 23:12:03 +01:00
Ahmad Fatoum
03ee03e2a6 #include header for glInsertEventMarkerEXT on macOS 2018-01-25 23:00:07 +01:00
Ahmad Fatoum
8be93762d9 Make function calls without prior declaration an error
which is the default behavior on C99 and up.
2018-01-25 22:34:29 +01:00
Ray
c2ec88f930 Support DEBUG library building 2018-01-25 10:07:51 +01:00
Ray
2dcaddc81c Review mipmaps generation issue
When changing image format, mipmaps are lost and regenerated from
scratch
2018-01-23 13:23:34 +01:00
Ray
04af83ff99 Improved pixel formats support
Review rlLoadTexture() function to make it simpler, now OpenGL texture
glInternalFormat, glFormat and glType are retrieved with new function
GetGlFormats()
2018-01-22 00:20:42 +01:00
Ray
cbef78ea18 Review VS2017 projects configurations 2018-01-22 00:17:07 +01:00
Ray
e604fe1ace Added VS2017 UWP project
Reviewed VS2015 UWP project
2018-01-19 13:07:32 +01:00
Ray
8e0a277f7c Reviewed UWP branch integration 2018-01-19 12:02:15 +01:00
Ray
6f73008007 Merge pull request #434 from raysan5/testing_uwp
Integration of UWP support
2018-01-19 11:43:21 +01:00
Ray
750323da53 Merge branch 'develop' into testing_uwp 2018-01-19 11:41:51 +01:00
Ray
5931bd501c Merge pull request #433 from a3f/develop
GCC/Clang: Treat void pointer arithmetic as error
2018-01-18 13:35:09 +01:00
Ahmad Fatoum
30ef3f3122 GCC/Clang: Treat void pointer arithmetic as error
As an extension, GNU C treats sizeof(void) as 1. MSVC doesn't.
Make it an error on GCC/Clang to avoid accidental MSVC breakage.
2018-01-18 13:22:41 +01:00
Ahmad Fatoum
a2edc9d641 MSVC: Fix void pointer arithmetic error
GNU C allows it as a compiler extension, but MSVC doesn't.
2018-01-18 13:20:13 +01:00
Ray
ce9f191f1b Added function: ImageMipmaps() 2018-01-18 00:23:45 +01:00
kai
bdb61306ac CMake: build shape and texture examples (#432) 2018-01-17 20:14:14 +01:00
Ray
727cb1819b Reviewed VS2015 projects
- Support OpenGL 1.1 if selected macro
- Corrected MSVC compiler issues with (void *) data
- Removed raylib.dll project
- Created DEBUG_DLL and RELEASE_DLL configurations
2018-01-17 14:21:23 +01:00
Ray
c8e97df233 Reviewed function GenImagePerlinNoise()
Added support for noise image offset
2018-01-17 00:43:30 +01:00
Ray
dd3b3dbadb Redesigned rlLoadTexture()
- Added support for mipmap levels loading
- Removed internal function LoadTextureCompressed(), not required any
more...
2018-01-16 00:00:05 +01:00
-
61679a4bbc Review releases, removed external dependencies
Not required any more!
2018-01-15 13:59:51 +01:00
-
230e78a23e Code tweak while using OpenAL backend 2018-01-15 13:54:25 +01:00
-
f2a675ae53 Reviewed Makefiles...
- Renamed VERSION to RAYLIB_VERSION
- Renamed API_VERSION to RAYLIB_API_VERSION
- Renamed RAYLIB_RELEASE to RAYLIB_RELEASE_PATH
- Support Web Assembly compilation on PLATFORM_WEB
2018-01-15 13:54:06 +01:00
-
493a67e6d5 Support canvas scaling with window 2018-01-15 12:53:14 +01:00
-
ddf6c65d00 Review Makefiles and templates 2018-01-15 12:52:58 +01:00
Ray
f818ec0e05 Merge pull request #428 from SamNChiet/testing_uwp
Add mouse input and revert keyboard to callback model
2018-01-13 11:00:56 +01:00
Sam C
1f70a8984a Add mouse input and revert keyboard to callback model
Mouse input is implemented, with all bells-and-whistles. This includes
cursor locking and scroll wheel support.

Keyboard input is reverted to a callback model to better reflect the
existing architecture in "core.c"
2018-01-12 20:56:35 -08:00
Ray
278d8575bd Added new function: ImageAlphaCrop() 2018-01-11 10:22:32 +01:00
Ray
c37d2d448d Corrected issue with matrices
Matrix stack system should be reviewed but, in the meantime,
currentMatrix should be reseted in order of 3d to work
2018-01-08 01:03:04 +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
Ray
4dcc02ff1e Launch draw call if buffer limits reached
Note that this solution is a temporal patch, not properly tested and
prone to fail, specially if matrix are pushed into the stack...
2018-01-07 23:54:11 +01:00
raysan5
e4be917d1b Added new image functions
- Added: ImageAlphaClear()
- Added: ImageAlphaPremultiply()
- Reorganized some functions
2018-01-07 00:51:26 +01:00
raysan5
b97134c3e1 Review float pixel format textures support 2018-01-06 18:17:38 +01:00
raysan5
7caa3201d5 Improved pixel formats support
- Renamed enum TextureFormat to PixelFormat for consistency
- Added support for pixel format UNCOMPRESSED_R32
- Using GetPixelDataSize() where required
2018-01-06 13:43:48 +01:00
raysan5
1f0f8c33fa Added function declaration 2018-01-06 02:51:28 +01:00
raysan5
7fa2861160 Added function: GetPixelDataSize()
Just found I need that function...
2018-01-06 02:50:20 +01:00
raysan5
0e48396369 Corrected issue with new functionality
Using default font texture as base white texture for rectangles reduces
draw calls considerably, actually, raygui can be drawn with a single
pass!
2018-01-06 02:44:47 +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
e1baae0249 Removed function DrawRectangleT()
Functionality integrated in DrawRectangle() and selectable with config
flag USE_DEFAULT_FONT_TEXTURE
2018-01-01 16:54:32 +01:00
raysan5
e69424c86f Reviewed text input 2017-12-31 23:50:22 +01:00
Ray
f51dcd8bfa Merge pull request #427 from SamNChiet/testing_uwp
Add Keyboard Input
2017-12-29 09:54:34 +01:00
Sam C
ff984d13db Revert accidental inclusion of binary+build files
This removes the binary files I accidentally tacked onto the "Add keyboard input" commit
2017-12-28 21:05:30 -08:00
Sam C
9941a6f4aa Replace keyboard callbacks with polling 2017-12-28 13:00:03 -08:00
Sam C
c801830bcc Add keyboard input 2017-12-28 10:44:03 -08:00
raysan5
e7cf03b1e4 Minor tweaks 2017-12-28 19:27:02 +01:00
raysan5
7965f983ba Support Wayland display on Linux desktop 2017-12-28 18:14:39 +01:00
raysan5
b19e155b34 Support UNCOMPRESSED_R32G32B32A32 texture format 2017-12-28 17:58:37 +01:00
raysan5
c93bca8c27 Review Makefile config flags
Support external GLFW usage
Renamed some flags for consistency
2017-12-28 17:58:09 +01:00
raysan5
0bd06eec51 Renamed function to SetTraceLog()
I think is clearer this way...
2017-12-24 16:49:54 +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
raysan5
f44dbf21cf Review physac timming system 2017-12-24 15:59:03 +01:00
Ray
0bb90d21c6 Merge pull request #424 from Martinfx/develop
Added next BSD OS
2017-12-23 18:57:26 +01:00
raysan5
b5a1282c6b Updated VS2015 projects
Removed GLFW3 and OpenAL Soft dependencies
2017-12-23 18:52:35 +01:00
Martinfx
dae426d9c6 Fixed path for FreeBSD 2017-12-23 18:29:44 +01:00
Martinfx
9b7a24331d Added next bsd os 2017-12-23 18:12:19 +01:00
Ray San
00c34a035c Updated copyright year 2017-12-20 12:37:08 +01:00
Ray San
27c274bc3c Corrected issue with SaveImageAs()
That function depends on SavePNG() and forces platform check on textures
module, that behaviour should be changed, platform definition should be
only required on core module...
2017-12-20 12:36:47 +01:00
Ray San
e8bb53ed35 Corrected issue on OpenGL ES compilation 2017-12-20 12:35:12 +01:00
Ray San
61afd07bd7 Force OpenAL backend on some platforms
OpenAL audio backend is being forced on HTML5 and OSX
2017-12-20 12:34:18 +01:00
Ray San
1320044e94 Review code formatting 2017-12-20 11:37:43 +01:00
Ray
b63ffcfa0f Some code tweaks
Audio module requires a complete formatting review....
2017-12-20 00:34:31 +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
a7de5bf6d9 Merge pull request #423 from RDR8/patch-1
Update CONTRIBUTING.md
2017-12-19 09:37:43 +01:00
RDR8
22e72cb0a1 Update CONTRIBUTING.md 2017-12-19 02:27:12 -06:00
RDR8
8d5484bbe0 Fix some typos in CONTRIBUTING.md (#422) 2017-12-19 09:19:43 +01:00
Ahmad Fatoum
647d8b2d53 Remove Alien::raylib from bindings list
* `Alien::raylib` downloads raylib, builds it and installs it in the Perl module path (Basically abusing CPAN as package manager)
* `Graphics::Raylib::XS` depends on `Alien::raylib` and reexports all C symbols as XS symbols usable in Perl
* `Graphics::Raylib` depends on `Graphics::Raylib::XS` and is the actual Perl wrapper with a Perlish API, which users should be using
2017-12-18 15:35:10 +01:00
Ray San
f3f3e7cf6d Removed contributors file
Contributors added to contributing file
2017-12-18 12:23:29 +01:00
Ray
bd4aa2459f Create CONTRIBUTING.md 2017-12-18 12:06:58 +01:00
Ray
bc6ae93a48 Added some comments on GetTime()
Reviewing GetTime() functionality
2017-12-18 00:06:57 +01:00
Ray San
b155333178 Support audio module skip on compiling
Some programs like tools could not require audio support
2017-12-15 17:02:29 +01:00
Ray San
e17a9a8216 Updated mini_al to latest version 2017-12-15 17:01:50 +01:00
Ray San
53ad53d051 Manually review previous PR 2017-12-15 13:44:31 +01:00
Ray
bcdde6c65a Merge pull request #420 from questor/develop
Develop
2017-12-15 13:28:33 +01:00
Ray
35d54dd7e4 Merge pull request #421 from a3f/develop
Build shared libs, games and examples on CI
2017-12-14 13:47:25 +01:00
Ahmad Fatoum
263e81b5c9 Build shared libs, games and examples on CI
Now with external OpenAL and GLFW dependencies removed,
we don't have to worry about installing them in CI.
Shared libraries are now always built along with static libs.
Games and examples are built everwhere except for Visual Studio,
because Physac needs pthreads, which VS doesn't provide.
2017-12-14 13:26:10 +01:00
user
2affac820e make raylib not clash with windows-header 2017-12-14 11:52:45 +01:00
user
217917530b fix for eventmarker missed in first cl 2017-12-14 11:51:17 +01:00
user
48d0c93ace make GetTime available to user of library 2017-12-14 11:50:35 +01:00
user
b872de951b fix for GetMatrixModelview (former cl) 2017-12-14 11:49:31 +01:00
user
d51f382ef8 optimized matrixrotate function by removing identity matrix 2017-12-14 11:48:33 +01:00
user
b5395b22cc make raymath compiling with msvc in c++ mode 2017-12-14 11:47:52 +01:00
user
07b522c113 make matrix stack work closer to old opengl implementation 2017-12-14 11:46:38 +01:00
user
a7f2fedbfb compilefix for function declaration (win only) 2017-12-14 11:45:47 +01:00
user
0e18b14605 added debug-event-markers for opengl so that you're able to set markers for renderdoc or other gpu debuggers what your program is currently doing 2017-12-14 11:44:48 +01:00
user
963551ee6e added possibility to get modelview matrix from rlgl to be able to send it to shaders 2017-12-14 11:43:06 +01:00
user
69c8fa409a fixed function declaration differ from implementation 2017-12-14 11:42:06 +01:00
user
54587d7fdb proper if-clauses for disabling functionality in text.c 2017-12-14 11:41:31 +01:00
user
08fc886afd added proper define checks for png-save if it's disabled 2017-12-14 11:40:08 +01:00
Ray
2388cbc3cd Corrected crash on shader loading
If shader file could not be found on loading it crashed, instead added
fallback to default shader!
2017-12-13 20:10:13 +01:00
Ray
a6f9cc5629 Remove rres support
Let the user choose if using rres external library
2017-12-11 11:55:02 +01:00
Ray
3e1d6859db Merge pull request #417 from a3f/develop
Add library versioning to Make/CMake build systems
2017-12-11 11:40:46 +01:00
Ahmad Fatoum
4a7840b752 Remove Meson build system
Less maintenance overhead that way,
given that make/CMake now also do library versioning.
2017-12-11 11:15:14 +01:00
Ahmad Fatoum
d24b89bb0e Add library versioning to Make/CMake build systems
See #401 for the discussion.
Also bumps version number to 1.9.2 without the -dev,
because neither ELF nor MachO like such a suffix.
The -dev suffix will have to be restricted to the git tags.
2017-12-11 10:25:06 +01:00
Ahmad Fatoum
de78fa69bc Fix CI builds after mini_al changes 2017-12-10 21:35:38 +01:00
Ahmad Fatoum
203b2f65d1 Fix typo in preprocessor macro 2017-12-10 21:11:04 +01:00
raysan5
5ae2c0d15b Added Wayland support
Updated to latest GLFW library and working on Wayland support, still
looking how to implement it on raylib because it just exposes
PLATFORM_DESKTOP and defaults to X11 windowing system on Linux...
2017-12-09 19:05:42 +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 San
33eec31575 Updated external libraries dependencies
Added dr_wav for a future use
2017-12-05 13:23:04 +01:00
Ray San
acbfba9250 Updated library features and dependencies 2017-12-05 13:22:26 +01:00
Ray
9d0ee6c2f6 Merge pull request #413 from mackron/dr/mini_al
mini_al integration
2017-12-05 11:23:16 +01:00
David Reid
104391f82b Update mini_al. 2017-12-05 18:49:00 +10: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
Ray San
0cd327ccb2 Moved QuaternionNlerp() function 2017-12-04 11:03:45 +01:00
David Reid
82f88e5df9 Potential fixes for Raspberry Pi. 2017-12-03 11:20:02 +10:00
Ray San
25a232a6f3 Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2017-11-30 16:59:13 +01:00
Ray San
9a7524661f Removed GLFW3 linking and added rglfw 2017-11-30 16:59:09 +01:00
Ray
14b81c20c1 Merge pull request #410 from SamNChiet/testing_uwp
Add UWP gamepad input polling
2017-11-30 09:26:42 +01:00
Sam C
9dbd30c44b Add UWP gamepad input polling
Add a basic UWP gampead poll function with zero changes to code outside of App.cpp
2017-11-29 20:43:41 -08:00
Martinfx
825d15b069 Fixed broken include for AppVeyor 2017-11-29 17:06:40 +01:00
Ray
55396ae2b8 Merge pull request #407 from Martinfx/develop
Added support compilation with cmake for FreeBSD
2017-11-29 14:54:29 +01:00
Martinfx
69a1c19735 Fixed use ${LIBS_PRIVATE} for FreeBSD 2017-11-29 13:17:02 +01:00
Martinfx
2f471414c2 Added compile with cmake for FreeBSD 2017-11-29 00:05:39 +01:00
Martinfx
2cf37708c0 Added glfw support for FreeBSD 2017-11-29 00:04:29 +01:00
Ray San
c9722161d1 Support GetCurrentTime() on macOS 2017-11-27 12:46:40 +01:00
Ahmad Fatoum
ca921e5a53 CMake: Explicitly ask for C99 support
Otherwise using a compiler that defaults to -std=c89 or -std=gnu89 will
fail. Example:
http://www.cpantesters.org/cpan/report/abb85066-d283-11e7-9926-b2f4efb9c382

Apparently, -m32 Travis CI build was broken: -m32 was overridden by
-std=gnu99.  This fixes that.
2017-11-27 02:10:56 +01:00
Ray
7099e4ea4d Merge pull request #400 from a3f/develop
Note that raylib can now be installed via Homebrew
2017-11-26 11:24:35 +01:00
Ahmad Fatoum
a78a1504a8 Note that raylib can be installed via Homebrew
[ci skip]
2017-11-26 10:54:35 +01:00
Ahmad Fatoum
f991a075e1 Build examples and games on Travis CI
They were disabled because they failed to build,
but this patch set fixes the build on Linux and macOS.

This doesn't apply to the AppVeyor build on Windows yet;
it currently fails at linking with OpenAL.
2017-11-25 21:45:31 +01:00
raysan5
853cc6f4c9 Added authorization token 2017-11-25 19:40:05 +01:00
Ahmad Fatoum
d54ea107f7 [CI] Push Github artifacts only on tag
Forgot that one the first time round, which created some unnecssary
releases.
2017-11-24 23:03:02 +01:00
Ahmad Fatoum
13fa61f7d9 CI: Only push binaries for develop branch builds
... for now.
Syntax was confusing Travis CI, AppVeyor is reporting 401,
so lets see if this change at least fixes Travis.

If this doesn't work, it might be that @raysan5's token is required.
2017-11-24 22:53:07 +01:00
Ray
8337787ced Merge pull request #396 from a3f/develop
Setup CMake package target and CI auto-deploy tags
2017-11-24 22:33:08 +01:00
Ahmad Fatoum
49c5a433df Setup CMake package target and CI auto-deploy tags
cmake --build . --target package # or make package if make is used

can now be used to create binary packages for raylib.

AppVeyor and Travis CI are configured to push the artifacts
that result from building git tags to the related Github releases page.
2017-11-24 21:24:35 +01:00
Ray
10dc276423 Merge pull request #395 from a3f/develop
Generate and install pkg-config pc file and allow static/shared builds in one go
2017-11-24 18:49:49 +01:00
Ahmad Fatoum
44376c04fa Generate and install pkg-config pc file
After installation, compiling new programs is possible with
    $ cc game.c `pkg-config --static --libs --cflags raylib`
or
    $ cc game.c `pkg-config --libs --cflags raylib`
depending on configuration

Also adds following configuration options:
- WITH_PIC "Compile static library as position-independent code"
- STATIC_RAYLIB "Build raylib as a static library"
- MACOS_FATLIB  "Build fat library for both i386 and x86_64 on macOS"
2017-11-24 17:15:33 +01:00
David Reid
a0d9913c7c Potential fixes for audio on RPI and Emscripten builds. 2017-11-24 22:13:33 +10:00
David Reid
5463e14886 Audio: Fix a bug with AudioStreams.
This bug is a result of the buffer of an AudioStream being smaller than
that of a period of the backend playback device. In this situation,
AudioStream's would have pauses between buffer updates because the
backend is not able to re-fill the AudioStream buffer's quick enough
due to it's periods being longer than the AudioStream buffer.
2017-11-24 21:54:00 +10:00
Ray
589cec0dd5 Update README.md 2017-11-24 12:40:08 +01:00
Ray
f9d9ff7e48 Update README.md 2017-11-23 10:14:53 +01:00
Ray
83029225d6 Update README.md 2017-11-23 10:13:40 +01:00
Ray
08200f8f40 Merge pull request #393 from a3f/develop
Add AppVeyor CI for automatic Windows Builds
2017-11-23 09:59:36 +01:00
Ahmad Fatoum
17c91bad6f Disable CRT "secure" warnings
Suppresses 88 of the 213 warnings reported when compiling with
MSVC 2015 on AppVeyor.
2017-11-23 07:56:02 +01:00
Ahmad Fatoum
1e1b20c889 Add AppVeyor CI for automatic Windows Builds
We already have automatic Linux and macOS build via Travis CI.
This adds the same for Windows x86 and x86_64 with both
Microsoft Visual Studio 2015 as well as MinGW-w64.
2017-11-23 00:47:58 +01:00
Ray
96e0f0e35e Merge pull request #392 from a3f/develop
Fix macOS build of new rglfw.c approach
2017-11-22 23:16:52 +01:00
Ahmad Fatoum
b2acff66de Fix macOS build of new rglfw.c approach
There have been two problems:

* GLFW itself was compiled with the definitions for compiling
_against_ GLFW (fixed by removing requirement for external glfw)

* rglfw.c was being compiled as C code, although it includes
Objective C files.

This _might_ break the Windows build, needs to be checked.

Fixes #391, but as noted I'd prefer though a separate source directory
and build script for GLFW.
2017-11-22 23:11:41 +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
Ray
f70a0a996c Review file issue 2017-11-22 19:51:38 +01:00
Ray San
9ec8c0f1d6 Updated OSX compilation with clang 2017-11-22 17:30:09 +01:00
Ray San
1be826fb16 Removed useless file 2017-11-22 17:30:09 +01:00
Ray
25ceec9b8f Corrected default textures locations
By default, we look for texture1 for LOC_MAP_SPECULAR and texture2 for
LOC_MAP_NORMAL
2017-11-22 14:56:45 +01:00
David Reid
8b3694a34d Fix a crash in audio mixing code. 2017-11-22 18:36:48 +10:00
Ray
6624672bfa Merge pull request #389 from Martinfx/master
Added  clean to Makefile for FreeBSD
2017-11-21 23:26:01 +01:00
Martinfx
398d793dbb Added FreeBSD clean for Makefile 2017-11-21 19:30:52 +01:00
David Reid
c71b01c8ac Update mini_al with fixes for OpenSL and SDL backends. 2017-11-21 06:35:38 +10:00
David Reid
14b889be41 Update mini_al with a potential fix for HTML5. 2017-11-20 21:47:07 +10:00
David Reid
3238cba47c Log the name of the playback device. 2017-11-19 19:38:23 +10:00
David Reid
49e945f958 Update mini_al with fixes and improvements for Emscripten. 2017-11-19 12:15:01 +10:00
David Reid
84ef860443 Update mini_al with experimental support for SDL/Emscripten. 2017-11-18 22:30:20 +10:00
David Reid
f9144ac5b0 Rename a variable for consistency. 2017-11-18 12:15:48 +10:00
David Reid
3be83dac7e Update mini_al. 2017-11-18 11:51:51 +10:00
David Reid
b9bb80d004 Add some logging and update mini_al. 2017-11-18 10:27:44 +10:00
David Reid
60d7215b2a mini_al: Unify the buffer system for Sounds and AudioStreams. 2017-11-18 08:42:14 +10:00
Ray San
6d317c7afe Remove glfw3 dependency
Full sources already included and compiled with raylib (rglfw)
2017-11-17 18:43:39 +01:00
Ray San
e2e4b8df28 Remove unneeded glfw dependencies
Only required by examples
2017-11-17 18:42:39 +01:00
Ray San
a6877c82c6 Added alternative license to rgif.h library
Just in case of legal conflict with public domain software, added MIT
alternative license.
2017-11-17 18:30:19 +01:00
David Reid
261b00e9e8 Update mini_al. 2017-11-17 21:12:05 +10:00
Ray San
a6416f82a7 Reviewed file comments 2017-11-16 17:59:35 +01:00
David Reid
96be62e88b Update mini_al.h 2017-11-16 21:49:45 +10:00
David Reid
e03afbf2fa Add support for pitch shifting.
This commit should bring the mini_al backend up to feature parity with
the OpenAL backend.
2017-11-15 22:04:23 +10:00
David Reid
322d868841 Fix minor errors with the OpenAL backend. 2017-11-14 21:44:57 +10:00
David Reid
88d2810fa3 Bug fixes for Music with mini_al. 2017-11-14 21:15:50 +10:00
Ray
68024f1b0b Added desktop platform check...
...to define proper values
2017-11-13 21:37:00 +01:00
David Reid
3a96a66fdf Bring up to date with changes to mini_al. 2017-11-13 21:46:29 +10:00
Ray San
9c65caea8c Added GLFW sources to raylib
Compiling GLFW library with raylib avoids external dependencies, this
way we solve version problems in some platforms
2017-11-13 12:09:41 +01:00
Ray San
6105ff9959 Added VS2015 UWP solution 2017-11-13 08:44:17 +01:00
David Reid
e52f4282d6 Update comments. 2017-11-12 22:57:31 +10:00
David Reid
ac4c911ad7 Work on porting Music to mini_al. 2017-11-12 21:55:24 +10:00
David Reid
68bf6c9701 Initial work on porting AudioStream to use mini_al. 2017-11-12 20:59:16 +10: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
raysan5
02dd4d32b5 Allow custom distortion shader - IN PROGRESS - 2017-11-12 11:00:28 +01:00
raysan5
09228752ce Review default shaders usage on loading 2017-11-12 10:33:44 +01:00
David Reid
b0852002b8 Rename SoundInternal to SoundData for consistency with MusicData. 2017-11-12 14:54:37 +10:00
David Reid
75433a670e Initial work on adding support for mini_al. 2017-11-12 14:17:05 +10: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
e12182f59b Merge pull request #384 from nounoursheureux/develop
Store the default shaders
2017-11-10 12:10:49 +01:00
Wilhem Barbier
7ef604fbf5 Store the default shaders 2017-11-09 20:47:22 +01:00
Ray San
0eb222bda1 Issue with libraries renamed on Raspbian Stretch
libEGL and libGLESv2 have been renamed on latest Raspbian Stretch
version (also included on latest Jessie upgrade).

It seems to be done to avoid conflicts between official Mesa libs and
Broadcomm provided ones.
2017-11-07 13:02:15 +01:00
Ray
99d3803d16 Added VS2017 raylib project 2017-11-06 23:56:03 +01:00
Ray San
37986b26cb Corrected issue with text drawing on image 2017-11-06 14:13:50 +01:00
Ray San
2f024dbfef Corrected possible issue on FBO creation
USE_DEPTH_RENDERBUFFER on OpenGL 2.1
2017-11-06 13:58:11 +01:00
Ray San
4fe8e05a7f Review GLSL 120 shaders
Not tested, could have errors
2017-11-06 13:49:33 +01:00
Ray San
81518ccd13 Corrected issue with shader locations init
On RPI, after latest drivers update, models were not rendered properly
cause of that...
2017-11-06 13:41:13 +01:00
Ray
2eceecb7b7 Merge pull request #382 from nounoursheureux/develop
Have SetShaderValue(i) take a const pointer
2017-11-05 22:47:55 +01:00
Wilhem Barbier
879c2f484b SetShaderValue take const pointer 2017-11-05 21:57:29 +01:00
Ray
085779707f Uploaded shaders for GLSL 120 2017-11-05 17:13:17 +01:00
Ray
24657ca789 Review textures to be POT
Could correct possible issues on OpenGL 1.1
2017-11-05 17:06:50 +01:00
Ray
5f65380732 Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2017-11-05 09:58:31 +01:00
Ray
aa6a1b4283 Corrected issue with missing defines 2017-11-05 09:58:25 +01:00
raysan5
36ae9c8c3a Compile DLL avoiding extra dependencies
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin>dumpbin.exe
D:\GitHub\raylib\release\libs\win32\msvc\raylib.dll /DEPENDENTS

Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file D:\GitHub\raylib\release\libs\win32\msvc\raylib.dll

File Type: DLL

Image has the following dependencies:

KERNEL32.dll
glfw3.dll
OpenAL32.dll

Summary

4000 .data
1000 .gfids
23000 .rdata
5000 .reloc
1000 .rsrc
68000 .text
1000 _RDATA
2017-11-04 18:36:15 +01:00
Ray
d43af4918b Improve textures support for OpenGL 2.1 2017-11-04 16:57:46 +01:00
Ray
9e0105a1a3 Corrected function name 2017-11-04 16:57:20 +01:00
Ray San
c570f7ca63 Rebuild dynamic libs for MSVC (VS2015)
Added support for raylib DLL building on MSVC
2017-11-03 17:32:13 +01:00
Ray San
244007a99b Review Fade() functionality 2017-11-03 12:41:03 +01:00
Ray San
3c3d56bb4a Renamed data types to standard names 2017-11-03 12:40:46 +01:00
Ray San
3d755d617a Some code tweaks... 2017-11-02 20:08:52 +01:00
Ray San
415e7e972c Review some issues, view description
- Review RPI compilation (core_drop_files not supported)
- Review ImageFormat(), some issues
- GetTextureData() reviewed for RPI
2017-10-30 13:51:46 +01:00
Ray San
f460b3842e Added new example: text drawing on image 2017-10-30 09:37:16 +01:00
Ray
743cc6add6 Review new build platform: FreeBSD
Corrected issue with RPI_CROSS_COMPILE
2017-10-30 00:14:13 +01:00
raysan5
ecf797cc7d Updated VS2015 project include and link paths 2017-10-29 14:33:35 +01:00
Ray
52cd0395b4 Merge pull request #373 from Martinfx/master
Added support FreeBSD
2017-10-28 22:22:04 +02:00
Martinfx
f897169160 Removed comment 2017-10-28 18:53:32 +02:00
Martinfx
47c7f3624f Added support FreeBSD for example 2017-10-28 18:41:29 +02:00
Martinfx
b3110c14fe Added support FreeBSD 2017-10-28 17:30:02 +02:00
Ray San
ab01cd45bc Review rlReadTexturePixels()
Improve second option to retrieve texture data from fbo...

Still requires some testing...
2017-10-25 12:46:26 +02:00
Ray San
31c8c86d8e Comment tweak...
...while reviewing GetTextureData() functionality on OpenGL ES 2.0
2017-10-25 12:33:44 +02:00
Ray
9b24554698 Added youtube channel link
Hopefully new videos comming soon...
2017-10-25 11:37:19 +02:00
Ray
539a9ca50e Corrected ImageTextEx()
- Added new function: GenImageColor()

ImageDraw() should be reviewed... specially alpha blending...
2017-10-25 01:24:17 +02:00
Ray
cbe0dcedfe Corrected issue with ttf font y-offset 2017-10-25 00:30:58 +02:00
Ray
61b0ab5332 Corrected some issues on game
Now it works! :)
2017-10-24 00:27:25 +02:00
Ray
9668f546d3 Example shader correction 2017-10-23 22:41:06 +02:00
raysan5
bd2e3b2a90 Removed file 2017-10-23 00:21:20 +02:00
victorfisac
dd50348b4d Merge branch 'master' of https://github.com/raysan5/raylib 2017-09-02 08:25:38 +02:00
victorfisac
353912b215 Merge branch 'master' of https://github.com/raysan5/raylib 2017-08-27 12:48:51 +02:00
victorfisac
eb7b5e59bb Merge branch 'master' of https://github.com/raysan5/raylib 2017-07-15 16:05:00 +02:00
victorfisac
f9277f2163 Merge remote-tracking branch 'refs/remotes/raysan5/master' 2017-03-06 09:47:08 +01:00
victorfisac
ce56fcb1ed Merge remote-tracking branch 'refs/remotes/raysan5/master' 2016-02-26 14:32:30 +01:00
384 changed files with 76914 additions and 24199 deletions

25
.gitignore vendored
View File

@@ -83,20 +83,20 @@ xcschememanagement.plist
xcuserdata/ xcuserdata/
DerivedData/ DerivedData/
# external libraries DLLs
!src/external/glfw3/lib/win32/glfw3.dll
!src/external/openal_soft/lib/win32/OpenAL32.dll
# Visual Studio project # Visual Studio project
project/vs2015/*.db project/vs2015/*.db
project/vs2015/*.opendb project/vs2015/*.opendb
project/vs2015.UWP/packages
project/vs2015.UWP/*.db
!project/vs2015/raylib.sln !project/vs2015/raylib.sln
!project/vs2015/raylib/*.vcxproj !project/vs2015/raylib/*.vcxproj
!project/vs2015/examples/*.vcxproj !project/vs2015/examples/*.vcxproj
!project/vs2015/external/glfw3/lib/win32/glfw3.dll !project/vs2017/raylib.sln
!project/vs2015/external/openal_soft/lib/win32/OpenAL32.dll !project/vs2017/raylib/*.vcxproj
!project/vs2015/external/openal_soft/lib/win64/OpenAL32.dll !project/vs2017/examples/*.vcxproj
!project/vs2015/external/lua/lib/win32/lua53.dll !project/vs2015.UWP/raylib/*.vcxproj
!project/vs2015.UWP/*.sln
!project/vs2015.UWP/raylib.App.UWP/*.vcxproj
# Web examples # Web examples
docs/examples/web/*.html docs/examples/web/*.html
@@ -111,15 +111,11 @@ docs/examples/web/*/*.html
!docs/examples/web/shaders/loader.html !docs/examples/web/shaders/loader.html
!docs/examples/web/models/loader.html !docs/examples/web/models/loader.html
# Meson build system
builddir/
# CMake stuff # CMake stuff
CMakeCache.txt CMakeCache.txt
CMakeFiles CMakeFiles
CMakeScripts CMakeScripts
Testing Testing
Makefile
cmake_install.cmake cmake_install.cmake
install_manifest.txt install_manifest.txt
compile_commands.json compile_commands.json
@@ -133,3 +129,8 @@ build
# Ignore Android generated files and folders # Ignore Android generated files and folders
templates/android_project/output templates/android_project/output
# Ignore GNU global tags
GPATH
GRTAGS
GTAGS

View File

@@ -1,50 +1,62 @@
language: c language: c
sudo: required
dist: trusty dist: trusty
git: git:
depth: 3 depth: 3
os: # TODO we could use a 32 bit Docker container for running true 32-bit tests
- osx # services: - docker
- linux
env: matrix:
global: include:
- VERBOSE=1 - os: linux
matrix: env: ARCH=i386
- CFLAGS=-m64 sudo: required
- CFLAGS=-m32 - os: linux
env: ARCH=amd64
sudo: required
- os: osx
env: ARCH=universal
before_script: before_script:
- export CFLAGS="-std=gnu99 $CFLAGS"
before_install: before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then - if [ "$TRAVIS_OS_NAME" == "linux" ]; then
sudo apt-get install -y gcc-multilib sudo apt-get install -y gcc-multilib
libopenal-dev libasound2-dev:$ARCH
libxcursor-dev libxinerama-dev libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH
mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev; libx11-dev:$ARCH libxrandr-dev:$ARCH libxi-dev:$ARCH
wget 'https://github.com/a3f/GLFW-3.2.1-Debian-binary-package/releases/download/v3.2.1/GLFW-3.2.1-Linux.deb' && sudo dpkg -i GLFW-3.2.1-Linux.deb; libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH;
export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH";
if [ "$ARCH" == "i386" ]; then export CFLAGS="-m32"; fi;
if [ "$ARCH" == "amd64" ]; then export CFLAGS="-m64"; fi;
if [ "$GLFW" == "SYSTEM" ]; then
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3_3.2.1-1_amd64.deb';
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3-dev_3.2.1-1_amd64.deb';
sudo dpkg -i libglfw3_3.2.1-1_amd64.deb libglfw3-dev_3.2.1-1_amd64.deb;
fi;
fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export RAYLIB_PACKAGE_SUFFIX="-macOS";
if [ "$GLFW" == "SYSTEM" ]; then brew update; brew install glfw; fi;
fi fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install glfw; fi
- "$CC --version" - "$CC --version"
script: script:
- mkdir build - mkdir build
- cd build - cd build
- cmake -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF .. - cmake -DMACOS_FATLIB=ON -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DUSE_EXTERNAL_GLFW=IF_POSSIBLE ..
- make - make VERBOSE=1
# - make package - make package
# - sudo make install
# deploy:
#deploy: provider: releases
# provider: releases api_key:
# api_key: secure: LvqUIAN/3dJul+Ra2iK3tSaNG5IwsNMmGIwVMy0DK5IBCxiQPBc9pWGiE30RTBPt6Z+N4BhMEE8DtUl+vnISlMoHWNIIhF2zwC66hs/F7zY7qEITMRSmfiLcqxQysknFOnJB06CATgXcFqlEo9j+t4abrG/f3qcb92J4O2uNz336Au2myTx93Q5MxbyA7KiUuEutFnb2dWiPCY4d+sGeXEfsiD2R7aj/8MaWOkoGdZVrTkI9juMgvpImkjQBArvqdjUMeT3MsRrwgOIq5v2GFV9dOl8k1WzPeT8B2JHh00ed/o1/wuFq/cLLOxtYo2+Pv3+xatOrlexoX0WkDm7C9/L1W5U4rLexU3CQ9mMBmHPnp6k/WXZ5QXEE4uUF0+LpN3XlIXzFpdZmZiVV8VLxg2WvyncMmivYiu7/MTkyfZxyKkzwl7sZZslzHA9kOGedGaN7b7/2B77OFHoQK8lKfdFml7jJnarh+89nenNZYMab0E8qkOJOyb2bYlDTa0/2nyxGiyymYgq6YHLNrDbhqB/1LzdgzjMliQ8ri5q9Ux2vjfcqOzhfAmcwFwnY/D6yXJWYi0DWpHZdpKl3du6dYDrypW91/yDWbwiJ/YhrE7ZunzrcB6GH/QkbuzWxdCth39rQAHih8DG01co/K3Gvi4yGjvIH5tFUpyEolMnpMiA=
# secure: XXX file_glob: true
# file_glob: true file: raylib-*.tar.gz
# file: raylib-*.tar.gz skip_cleanup: true
# skip_cleanup: true on:
# on: repo: raysan5/raylib
# branch: master branch: master
# tags: true tags: true

51
CMakeLists.txt Normal file → Executable file
View File

@@ -1,8 +1,54 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
# Config options # Config options
set(BUILD_EXAMPLES ON CACHE BOOL "Build the examples.") option(BUILD_EXAMPLES "Build the examples." ON)
set(BUILD_GAMES ON CACHE BOOL "Build the example games.") option(BUILD_GAMES "Build the example games." ON)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended for run with ASAN)" OFF)
if(CMAKE_VERSION VERSION_LESS "3.1")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")
endif()
else()
set (CMAKE_C_STANDARD 99)
endif()
include(CheckCCompilerFlag)
function(add_if_flag_works flag)
CHECK_C_COMPILER_FLAG("${flag}" COMPILER_HAS_THOSE_TOGGLES)
set(outcome "Failed")
if(COMPILER_HAS_THOSE_TOGGLES)
foreach(var ${ARGN})
set(${var} "${flag} ${${var}}" PARENT_SCOPE)
endforeach()
set(outcome "works")
endif()
message(STATUS "Testing if ${flag} can be used -- ${outcome}")
endfunction()
add_if_flag_works(-Werror=pointer-arith CMAKE_C_FLAGS)
add_if_flag_works(-Werror=implicit-function-declaration CMAKE_C_FLAGS)
# src/external/jar_xm.h does shady stuff
add_if_flag_works(-fno-strict-aliasing CMAKE_C_FLAGS)
if (ENABLE_ASAN)
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
add_if_flag_works(-fsanitize=address CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
endif()
if (ENABLE_UBSAN)
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
add_if_flag_works(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
endif()
if (ENABLE_MSAN)
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
add_if_flag_works(-fsanitize=memory CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
endif()
if (ENABLE_MSAN AND ENABLE_ASAN)
MESSAGE(WARNING "Compiling with both AddressSanitizer and MemorySanitizer is not recommended")
endif()
add_subdirectory(src release) add_subdirectory(src release)
@@ -13,4 +59,3 @@ endif()
if (${BUILD_GAMES}) if (${BUILD_GAMES})
add_subdirectory(games) add_subdirectory(games)
endif() endif()

128
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,128 @@
## Contributing to raylib
Hello contributors! Welcome to raylib!
This document contains a set of guidelines to contribute to the project. These are mostly guidelines, not rules.
Use your best judgement, and feel free to propose changes to this document in a pull-request.
### raylib philosophy
- raylib is a tool to LEARN videogames programming, every single function in raylib should be a tutorial on itself.
- raylib is SIMPLE and EASY-TO-USE, I tried to keep it compact with a small set of functions, if a function is too complex or is not clearly useful, better not to include it.
- raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
- raylib is collaborative; contribution of tutorials / code-examples / bugs-solving / code-comments are highly appreciated.
- raylib's license (and its external libs respective licenses) allow using it for commercial products.
### Some interesting reads to start with
- [raylib history](HISTORY.md)
- [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture)
- [raylib license](LICENSE.md)
- [raylib roadmap](ROADMAP.md)
[raylib Wiki](https://github.com/raysan5/raylib/wiki) contains some information about the library and is open to anyone for edit.
Feel free to review it if required, just take care not to break anything.
### raylib C coding conventions
Despite being written in C, raylib does not follow the standard Hungarian notation for C,
it [follows Pascal-case/camel-case notation](https://github.com/raysan5/raylib/wiki/raylib-coding-conventions),
more common on C# language. All code formatting decisions have been carefully taken
to make it easier for students to read, write and understand code.
Source code is extensively commented for that purpose, raylib primary learning method is:
> learn by reading code and examples
For detailed information on building raylib and examples, please check [raylib Wiki](https://github.com/raysan5/raylib/wiki).
### Opening new Issues
To open new issue for raylib (bug, enhancement, discussion...), just try to follow these rules:
- Make sure the issue has not already been reported before by searching on GitHub under Issues.
- If you're unable to find an open issue addressing the problem, open a new one. Be sure to include a
title and clear description, as much relevant information as possible, and a code sample demonstrating the unexpected behavior.
- If applies, attach some screenshot of the issue and a .zip file with the code sample and required resources.
- On issue description, add a brackets tag about the raylib module that relates to this issue.
If don't know the module, just report the issue, I will review it.
- You can check other issues to see how is being done!
### Sending a Pull-Request
- Make sure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
- Don't send big pull-requests (lots of changelists), they are difficult to review. It's better to send small pull-request, one at a time.
- Verify that changes don't break the build (at least on Windows platform). As many platforms where you can test it, the better, but don't worry
if you cannot test all the platforms.
### raylib bindings
Some people ported raylib to other languages in form of bindings or wrappers to the library, here is a list with the ones I'm aware of:
- [raylib C/C++ version (default)](https://github.com/raysan5/raylib)
- [raylib Lua binding](https://github.com/raysan5/raylib-lua)
- [raylib Go binding](https://github.com/gen2brain/raylib-go)
- [raylib Nim binding](https://gitlab.com/define-private-public/raylib-Nim)
- [raylib Crystal binding](https://gitlab.com/Zatherz/cray)
- [raylib Perl wrapper](https://metacpan.org/pod/Graphics::Raylib)
- raylib Pascal binding with custom IDE (closed-source)
Usually, raylib bindings follow the convention: `raylib-{language}`
Let me know if you're writing a new binding for raylib, I will list it here and I usually
provide the icon/logo for that new language binding.
### Contact information
If you have any doubt, don't hesitate to [contact me](mailto:ray@raylib.com)!.
You can write me a direct mail but you can also contact me on the following networks:
- [raylib forum](http://forum.raylib.com/) - A good place for discussions or to ask for help.
- [raylib gitter](https://gitter.im/raylib) - A direct communication channel for project discussions.
- [raylib twitter](https://twitter.com/raysan5) - My personal twitter account, I usually post about raylib, you can send me PMs.
- [raylib web](http://www.raylib.com/) - On top-right corner there is a bunch of networks where you can find me.
Thank you very much for your time! :)
----
Here is a list of raylib contributors, these people have invested part of their time
contributing (in some way or another) to make the raylib project better. Huge thanks to all of them!
- [Zopokx](https://github.com/Zopokx) for testing the web.
- [Elendow](http://www.elendow.com) for testing and helping on web development.
- Victor Dual for implementing and testing 3D shapes functions.
- Marc Palau for implementing and testing 3D shapes functions and contribute on camera and gestures modules.
- Kevin Gato for improving texture internal formats support and helping on raygui development.
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
- Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- [Sergio Martinez](https://github.com/anidealgift) for helping on raygui development and tools development (raygui_styler).
- [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing PBR materials and lighting systems... among multiple other improvements and multiple tools and games.
- Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5.
- Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5.
- [procedural](https://github.com/procedural) for testing raylib on Linux, correcting some bugs and adding several mouse functions.
- [Chris Hemingway](https://github.com/cHemingway) for improving raylib on OSX build system.
- [Emanuele Petriglia](https://github.com/LelixSuper) for working on multiple GNU/Linux improvements and developing [TicTacToe](https://github.com/LelixSuper/TicTacToe) raylib game.
- [Joshua Reisenauer](https://github.com/kd7tck) for adding audio modules support (XM, MOD) and reviewing audio system.
- [Marcelo Paez](https://github.com/paezao) for his help on OSX to solve High DPI display issue. Thanks Marcelo!
- [Ghassan Al-Mashareqa](https://github.com/ghassanpl) for his amazing contribution with raylib Lua module, I just work over his code to implement [rlua](https://github.com/raysan5/raylib/blob/master/src/rlua.h)
- [Teodor Stoenescu](https://github.com/teodor-stoenescu) for his improvements on OBJ object loading.
- [RDR8](https://github.com/RDR8) for helping with Linux build improvements
- [Saggi Mizrahi](https://github.com/ficoos) for multiple fixes on Linux and audio system
- [Daniel Lemos](https://github.com/xspager) for fixing issues on Linux games building
- [Joel Davis](https://github.com/joeld42) for adding raycast picking utilities and a [great example](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_picking.c)
- [Richard Goodwin](https://github.com/AudioMorphology) for adding RPI touchscreen support
- [Milan Nikolic](https://github.com/gen2brain) for adding Android build support with custom standalone toolchain
- [Michael Vetter](https://github.com/jubalh) for improvements on build system and adding meson support for Linux
- [Wilhem Barbier](https://github.com/nounoursheureux) for adding Image generation functions and some fixes
- [Benjamin Summerton](https://github.com/define-private-public) for improving OSX building and his amazing work on CMake build sytem
- [MartinFX](https://github.com/Martinfx) for adding compilation support for FreeBSD OS
- [Wilhem Barbier](https://github.com/nounoursheureux) for supporting default shaders on shader loading, if shader not provided
- [Ahmad Fatoum](https://github.com/a3f) for implementing continuus integration support for raylib (Travis and AppVeyor) and greatly improving build system.
- [SamNChiet](https://github.com/SamNChiet) for his work on UWP inputs implementation.
- [David Reid](https://github.com/mackron) for a complete review of audio module to support his amazing mini_al audio library.
- [Kai](https://github.com/questor) for multiple code reviews and improvements.
Please, if I forget someone in this list, excuse me and write me an email to remind me to add you!

View File

@@ -1,35 +0,0 @@
I believe that time is the most valuable resource and the following people have invested part of their time
contributing (in some way or another) to make raylib project better. Huge thanks!
- [Zopokx](https://github.com/Zopokx) for testing the web.
- [Elendow](http://www.elendow.com) for testing and helping on web development.
- Victor Dual for implementing and testing 3D shapes functions.
- Marc Palau for implementing and testing 3D shapes functions and contribute on camera and gestures modules.
- Kevin Gato for improving texture internal formats support and helping on raygui development.
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
- Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- [Sergio Martinez](https://github.com/anidealgift) for helping on raygui development and tools development (raygui_styler).
- [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing PBR materials and lighting systems... among multiple other improvements and multiple tools and games.
- Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5.
- Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5.
- [procedural](https://github.com/procedural) for testing raylib on Linux, correcting some bugs and adding several mouse functions.
- [Chris Hemingway](https://github.com/cHemingway) for improving raylib on OSX build system.
- [Emanuele Petriglia](https://github.com/LelixSuper) for working on multiple GNU/Linux improvements and developing [TicTacToe](https://github.com/LelixSuper/TicTacToe) raylib game.
- [Joshua Reisenauer](https://github.com/kd7tck) for adding audio modules support (XM, MOD) and reviewing audio system.
- [Marcelo Paez](https://github.com/paezao) for his help on OSX to solve High DPI display issue. Thanks Marcelo!
- [Ghassan Al-Mashareqa](https://github.com/ghassanpl) for his amazing contribution with raylib Lua module, I just work over his code to implement [rlua](https://github.com/raysan5/raylib/blob/master/src/rlua.h)
- [Teodor Stoenescu](https://github.com/teodor-stoenescu) for his improvements on OBJ object loading.
- [RDR8](https://github.com/RDR8) for helping with Linux build improvements
- [Saggi Mizrahi](https://github.com/ficoos) for multiple fixes on Linux and audio system
- [Daniel Lemos](https://github.com/xspager) for fixing issues on Linux games building
- [Joel Davis](https://github.com/joeld42) for adding raycast picking utilities and a [great example](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_picking.c)
- [Richard Goodwin](https://github.com/AudioMorphology) for adding RPI touchscreen support
- [Milan Nikolic](https://github.com/gen2brain) for adding Android build support with custom standalone toolchain
- [Michael Vetter](https://github.com/jubalh) for improvements on build system and adding meson support for Linux
- [Wilhem Barbier](https://github.com/nounoursheureux) for adding Image generation functions and some fixes
- [Benjamin Summerton](https://github.com/define-private-public) for improving OSX building and his amazing work on CMake build sytem
Please, if I forget someone in this list, excuse me and write me an email to remind me to add you!

View File

@@ -73,12 +73,12 @@ attached to 3d models or used as fullscreen postrocessing effects. A bunch of po
in this release, check raylib/shaders folder. in this release, check raylib/shaders folder.
Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files. Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
A brand new [camera](https://github.com/raysan5/raylib/blob/develop/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person).
Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_first_person.c). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_first_person.c).
New [gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs. New [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
[raygui](https://github.com/raysan5/raylib/blob/develop/src/raygui.h), the new IMGUI (Immediate Mode GUI) module offers a set of functions to create simple user interfaces, [raygui](https://github.com/raysan5/raylib/blob/master/src/raygui.h), the new IMGUI (Immediate Mode GUI) module offers a set of functions to create simple user interfaces,
primary intended for tools development. It's still in experimental state but already fully functional. primary intended for tools development. It's still in experimental state but already fully functional.
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features. Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
@@ -91,18 +91,18 @@ notes on raylib 1.4
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version, On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version,
lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added. lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image. First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
Now a basic image processing can be done before converting the image to texture for usage. Now a basic image processing can be done before converting the image to texture for usage.
SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library). SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library).
Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file. Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional. New [physac](https://github.com/raysan5/raylib/blob/master/src/physac.h) physics module for basic 2D physics support. Still in development but already functional.
Module comes with some usage examples for basic jump and level interaction and also force-based physic movements. Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
[raymath](https://github.com/raysan5/raylib/blob/develop/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline. [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
[gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse.
This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`).
@@ -110,7 +110,7 @@ Gamepad support has also been added (experimental).
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions, Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported). and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported).
A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation. A simple [easings](https://github.com/raysan5/raylib/blob/master/src/easings.h) module has also been added for values animation.
Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn
how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris. how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
@@ -122,7 +122,7 @@ notes on raylib 1.5
On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added. On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/develop/examples/core_oculus_rift.c). VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/master/examples/core_oculus_rift.c).
New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally. New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
@@ -130,15 +130,15 @@ New lighting system: added support for up to 8 configurable lights and 3 light t
Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread. Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/develop/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread. Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/master/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/master/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread.
Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck. Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck.
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/develop/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/develop/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms. Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
This new version is so massive that is difficult to list all the improvements, most of raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/develop/src/rlgl.c) module has been completely redesigned to accomodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/develop/CHANGELOG) file for a more detailed list of changes. This new version is so massive that is difficult to list all the improvements, most of raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c) module has been completely redesigned to accomodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) file for a more detailed list of changes.
Up to 8 new code examples have been added to show the new raylib features and also some samples to show the usage of [rlgl](https://github.com/raysan5/raylib/blob/develop/examples/rlgl_standalone.c) and [audio](https://github.com/raysan5/raylib/blob/develop/examples/audio_standalone.c) raylib modules as standalone libraries. Up to 8 new code examples have been added to show the new raylib features and also some samples to show the usage of [rlgl](https://github.com/raysan5/raylib/blob/master/examples/rlgl_standalone.c) and [audio](https://github.com/raysan5/raylib/blob/master/examples/audio_standalone.c) raylib modules as standalone libraries.
Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5. Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
@@ -149,7 +149,7 @@ On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new v
Complete [raylib Lua binding](https://github.com/raysan5/raylib-lua). All raylib functions plus the +60 code examples have been ported to Lua, now Lua users can enjoy coding videogames in Lua while using all the internal power of raylib. This addition also open the doors to Lua scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to Lua scripts while keep using raylib functionality. Complete [raylib Lua binding](https://github.com/raysan5/raylib-lua). All raylib functions plus the +60 code examples have been ported to Lua, now Lua users can enjoy coding videogames in Lua while using all the internal power of raylib. This addition also open the doors to Lua scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to Lua scripts while keep using raylib functionality.
Completely redesigned [audio module](https://github.com/raysan5/raylib/blob/develop/src/audio.c). Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. [FLAC file format support](https://github.com/raysan5/raylib/blob/develop/src/external/dr_flac.h) has also been added. In the same line, [OpenAL Soft](https://github.com/kcat/openal-soft) backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more! Completely redesigned [audio module](https://github.com/raysan5/raylib/blob/master/src/audio.c). Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. [FLAC file format support](https://github.com/raysan5/raylib/blob/master/src/external/dr_flac.h) has also been added. In the same line, [OpenAL Soft](https://github.com/kcat/openal-soft) backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more!
[Physac](https://github.com/victorfisac/Physac) module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by [@victorfisac](https://github.com/victorfisac), multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing! [Physac](https://github.com/victorfisac/Physac) module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by [@victorfisac](https://github.com/victorfisac), multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
@@ -187,17 +187,17 @@ notes on raylib 1.8
October 2017, around 5 months after latest raylib version, another release is published: raylib 1.8. Again, several modules of the library have been reviewed and some new functionality added. Main changes of this new release are: October 2017, around 5 months after latest raylib version, another release is published: raylib 1.8. Again, several modules of the library have been reviewed and some new functionality added. Main changes of this new release are:
[Procedural image generation](https://github.com/raysan5/raylib/blob/develop/examples/textures/textures_image_generation.c) function, a set of new functions have been added to generate gradients, checked, noise and cellular images from scratch. Image generation could be useful for certain textures or learning pourpouses. [Procedural image generation](https://github.com/raysan5/raylib/blob/master/examples/textures/textures_image_generation.c) function, a set of new functions have been added to generate gradients, checked, noise and cellular images from scratch. Image generation could be useful for certain textures or learning pourpouses.
[Parametric mesh generation](https://github.com/raysan5/raylib/blob/develop/examples/models/models_mesh_generation.c) functions, create 3d meshes from scratch just defining a set of parameters, meshes like cube, sphere, cylinder, torus, knot and more can be very useful for prototyping or for lighting and texture testing. [Parametric mesh generation](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_generation.c) functions, create 3d meshes from scratch just defining a set of parameters, meshes like cube, sphere, cylinder, torus, knot and more can be very useful for prototyping or for lighting and texture testing.
PBR Materials support, a completely redesigned shaders and material system allows advance materials definition and usage, with fully customizable shaders. Some new functions have been added to generate the environment textures required for PBR shading and a a new complete [PBR material example](https://github.com/raysan5/raylib/blob/develop/examples/models/models_material_pbr.c) is also provided for reference. PBR Materials support, a completely redesigned shaders and material system allows advance materials definition and usage, with fully customizable shaders. Some new functions have been added to generate the environment textures required for PBR shading and a a new complete [PBR material example](https://github.com/raysan5/raylib/blob/master/examples/models/models_material_pbr.c) is also provided for reference.
Custom Android APK build pipeline with [simple Makefile](https://github.com/raysan5/raylib/blob/develop/templates/simple_game/Makefile). Actually, full code building mechanism based on plain Makefile has been completely reviewed and Android building has been added for sources and also for examples and templates building into final APK package. This way, raylib Android building has been greatly simplified and integrated seamlessly into standard build scripts. Custom Android APK build pipeline with [simple Makefile](https://github.com/raysan5/raylib/blob/master/templates/simple_game/Makefile). Actually, full code building mechanism based on plain Makefile has been completely reviewed and Android building has been added for sources and also for examples and templates building into final APK package. This way, raylib Android building has been greatly simplified and integrated seamlessly into standard build scripts.
[rlgl](https://github.com/raysan5/raylib/blob/develop/src/rlgl.c) module has been completely reviewed and most of the functions renamed for consistency. This way, standalone usage of rlgl is promoted, with a [complete example provided](https://github.com/raysan5/raylib/blob/develop/examples/others/rlgl_standalone.c). rlgl offers a pseudo-OpenGL 1.1 immediate-mode programming-style layer, with backends to multiple OpenGL versions. [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c) module has been completely reviewed and most of the functions renamed for consistency. This way, standalone usage of rlgl is promoted, with a [complete example provided](https://github.com/raysan5/raylib/blob/master/examples/others/rlgl_standalone.c). rlgl offers a pseudo-OpenGL 1.1 immediate-mode programming-style layer, with backends to multiple OpenGL versions.
[raymath](https://github.com/raysan5/raylib/blob/develop/src/rlgl.c) library has been also reviewed to align with other advance math libraries like [GLM](https://github.com/g-truc/glm). Matrix math has been improved and simplified, some new Quaternion functions have been added and Vector3 functions have been renamed all around the library for consistency with new Vector2 functionality. [raymath](https://github.com/raysan5/raylib/blob/master/src/rlgl.c) library has been also reviewed to align with other advance math libraries like [GLM](https://github.com/g-truc/glm). Matrix math has been improved and simplified, some new Quaternion functions have been added and Vector3 functions have been renamed all around the library for consistency with new Vector2 functionality.
Additionally, as always, examples and templates have been reviewed to work with new version (some new examples have been added), all external libraries have been updated to latest stable version and latest Notepad++ and MinGW have been configured to work with new raylib. For a full list of changes, just check [CHANGELOG](CHANGELOG). Additionally, as always, examples and templates have been reviewed to work with new version (some new examples have been added), all external libraries have been updated to latest stable version and latest Notepad++ and MinGW have been configured to work with new raylib. For a full list of changes, just check [CHANGELOG](CHANGELOG).

View File

@@ -27,7 +27,7 @@ applications, and to alter it and redistribute it freely, subject to the followi
fonts fonts
------ ------
The following fonts [provided with raylib](https://github.com/raysan5/raylib/tree/develop/examples/text/resources/fonts) are free to use (freeware) and have been designed by the following people: The following fonts [provided with raylib](https://github.com/raysan5/raylib/tree/master/examples/text/resources/fonts) are free to use (freeware) and have been designed by the following people:
* Alpha Beta - Brian Kent (AEnigma) * Alpha Beta - Brian Kent (AEnigma)
* Setback - Brian Kent (AEnigma) * Setback - Brian Kent (AEnigma)
@@ -41,9 +41,9 @@ The following fonts [provided with raylib](https://github.com/raysan5/raylib/tre
2d art 2d art
------ ------
[scarfy spritesheet](https://github.com/raysan5/raylib/blob/develop/examples/textures/resources/scarfy.png) and [fudesumi image](https://github.com/raysan5/raylib/blob/develop/examples/textures/resources/fudesumi.png) have been created by [Eiden Marsal](https://www.artstation.com/artist/marshall_z) and licensed as [Creative Commons Attribution-NonCommercial 3.0](https://creativecommons.org/licenses/by-nc/3.0/legalcode) [scarfy spritesheet](https://github.com/raysan5/raylib/blob/master/examples/textures/resources/scarfy.png) and [fudesumi image](https://github.com/raysan5/raylib/blob/master/examples/textures/resources/fudesumi.png) have been created by [Eiden Marsal](https://www.artstation.com/artist/marshall_z) and licensed as [Creative Commons Attribution-NonCommercial 3.0](https://creativecommons.org/licenses/by-nc/3.0/legalcode)
3d models 3d models
--------- ---------
[dwarf 3d model and textures](https://github.com/raysan5/raylib/tree/develop/examples/models/resources/model) have been created by David Moreno and licensed as [Creative Commons Attribution-NonCommercial 3.0](https://creativecommons.org/licenses/by-nc/3.0/legalcode) [dwarf 3d model and textures](https://github.com/raysan5/raylib/tree/master/examples/models/resources/model) have been created by David Moreno and licensed as [Creative Commons Attribution-NonCommercial 3.0](https://creativecommons.org/licenses/by-nc/3.0/legalcode)

View File

@@ -1,4 +1,4 @@
<img align="left" src="https://github.com/raysan5/raylib/blob/master/logo/logo256x256.png" width=256> <img align="left" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_256x256.png" width=256>
**raylib is a simple and easy-to-use library to learn videogames programming.** **raylib is a simple and easy-to-use library to learn videogames programming.**
@@ -11,39 +11,46 @@ no fancy interface, no visual helpers, no auto-debugging... just coding in the m
pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html) pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
[![Build Status](https://travis-ci.org/raysan5/raylib.svg?branch=develop)](https://travis-ci.org/raysan5/raylib) [![Build Status](https://travis-ci.org/raysan5/raylib.svg?branch=develop)](https://travis-ci.org/raysan5/raylib)
[![https://ci.appveyor.com/api/projects/status/github/raysan5/raylib?svg=true](https://ci.appveyor.com/api/projects/status/github/raysan5/raylib?svg=true)](https://ci.appveyor.com/project/raysan5/raylib)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/raylib/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Chat on Discord](https://img.shields.io/discord/308323056592486420.svg?logo=discord)](https://discord.gg/VkzNHUE)
[![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE.md)
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Follow)](https://twitter.com/raysan5)
features features
-------- --------
* Written in plain C code (C99) in PascalCase/camelCase notation * Written in plain C code (C99) in PascalCase/camelCase notation
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2) * Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2 - choose at compile)
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c) * Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
* Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF) * Powerful fonts module with SpriteFonts support (XNA fonts, AngelCode fonts, TTF)
* Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC) * Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
* Basic 3d support for Geometrics, Models, Billboards, Heightmaps and Cubicmaps * Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!
* Flexible Materials system, supporting classic maps and PBR maps * Flexible Materials system, supporting classic maps and PBR maps
* Shaders support, including Model shaders and Postprocessing shaders * Shaders support, including Model shaders and Postprocessing shaders
* Powerful math module for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) * Powerful math module for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
* Audio loading and playing with streaming support (WAV, OGG, FLAC, XM, MOD) * Audio loading and playing with streaming support (WAV, OGG, FLAC, XM, MOD)
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5** * Multiple platforms support: Windows, Linux, FreeBSD, MacOS, UWP, Android, Raspberry Pi, HTML5.
* VR stereo rendering support with configurable HMD device parameters * VR stereo rendering with configurable HMD device parameters
* Minimal external dependencies (GLFW3, OpenGL, OpenAL) * NO external dependencies, all required libraries included with raylib
* Complete bindings to LUA ([raylib-lua](https://github.com/raysan5/raylib-lua)) and Go ([raylib-go](https://github.com/gen2brain/raylib-go)) * Complete bindings to LUA ([raylib-lua](https://github.com/raysan5/raylib-lua)) and Go ([raylib-go](https://github.com/gen2brain/raylib-go))
raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option I found for raylib uses on its [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module the outstanding [GLFW3](http://www.glfw.org/) library, embedded inside raylib in the form of [rglfw](https://github.com/raysan5/raylib/blob/master/src/rglfw.c) module, avoiding that way external dependencies.
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, maintained, ...).
raylib uses on its [audio](https://github.com/raysan5/raylib/blob/master/src/audio.c) module, [OpenAL Soft](http://kcat.strangesoft.net/openal.html) audio library, in multiple flavours, raylib uses on its [audio](https://github.com/raysan5/raylib/blob/master/src/audio.c) module, the amazing [mini_al](https://github.com/dr-soft/mini_al) audio library, single-file header-only and supporting multiple platforms and multiple audio backends.
to accomodate to Android, Raspberry Pi and HTML5.
raylib uses internally multiple single-file header-only libraries to support multiple fileformats loading and saving, all those libraries are embedded with raylib and available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory.
*On Android, `native_app_glue module` (provided by Android NDK) and native Android libraries are used to manage window/context, inputs and activity life cycle.* *On Android, `native_app_glue module` (provided by Android NDK) and native Android libraries are used to manage window/context, inputs and activity life cycle.*
*On Raspberry Pi, Videocore API and EGL libraries are used for window/context management and raw inputs reading.* *On Raspberry Pi, Videocore API and EGL libraries are used for window/context management and raw inputs reading.*
building build and installation
-------- ----------------------
For detailed building instructions, check [raylib Wiki](https://github.com/raysan5/raylib/wiki). Binary releases for Windows, Linux and macOS are available at the [Github Releases](https://github.com/raysan5/raylib/releases) page. raylib is also available via multiple package managers on multiple OS distributions. For more info check [raylib Wiki](https://github.com/raysan5/raylib/wiki).
To build raylib yourself, check out also the [raylib Wiki](https://github.com/raysan5/raylib/wiki) for detailed instructions.
raylib has been developed using exclusively two tools: raylib has been developed using exclusively two tools:
@@ -61,6 +68,7 @@ contact
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib) * Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5) * Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5) * Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
* YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/channel/UC8WIBkhYb5sBNqXO1mZ7WSQ)
If you are using raylib and you enjoy it, please, [let me know][raysan5]. If you are using raylib and you enjoy it, please, [let me know][raysan5].

View File

@@ -4,7 +4,7 @@ roadmap
Current version of raylib is complete and functional but there is still a lot of room for improvement. Current version of raylib is complete and functional but there is still a lot of room for improvement.
Here it is a wish-list with features and ideas to improve the library. Here it is a wish-list with features and ideas to improve the library.
Note that [raylib source code](https://github.com/raysan5/raylib/tree/develop/src) has some *TODO* marks around code with pending things to review and improve. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details! Note that [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has some *TODO* marks around code with pending things to review and improve. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
**raylib 1.x** **raylib 1.x**
- [ ] Basic GPU stats sytem (memory, draws, time...) - [ ] Basic GPU stats sytem (memory, draws, time...)

65
appveyor.yml Normal file
View File

@@ -0,0 +1,65 @@
#os: Visual Studio 2015
clone_depth: 5
cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml
init:
- cmake -E remove c:\programdata\chocolatey\bin\cpack.exe
- set PATH=%PATH:C:\Program Files (x86)\Git\usr\bin;=%
- set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
- if [%BITS%]==[32] set MINGW=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32
- if [%BITS%]==[64] set MINGW=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64
- if [%COMPILER%]==[mingw] set PATH=%MINGW%\bin;%PATH%
- set RAYLIB_PACKAGE_SUFFIX=-Win%BITS%-%COMPILER%
- set VERBOSE=1
environment:
matrix:
- compiler: mingw
bits: 32
examples: ON
- compiler: mingw
bits: 64
examples: ON
- compiler: msvc15
bits: 32
examples: OFF
- compiler: msvc15
bits: 64
examples: OFF
before_build:
- if [%compiler%]==[mingw] set CFLAGS=-m%BITS% & set LDFLAGS=-m%BITS% & set GENERATOR="MinGW Makefiles"
- if [%COMPILER%]==[msvc15] if [%BITS%]==[32] set GENERATOR="Visual Studio 14 2015"
- if [%COMPILER%]==[msvc15] if [%BITS%]==[64] set GENERATOR="Visual Studio 14 2015 Win64"
- mkdir build
- cd build
build_script:
- cmake -G %GENERATOR% -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=%examples% -DBUILD_GAMES=%examples% ..
- cmake --build . --target install
after_build:
- cmake --build . --target package
before_test:
test_script:
artifacts:
- path: 'build\*.zip'
deploy:
- provider: GitHub
auth_token:
secure: OxKnnT3tlkPl9365cOO84rDWU4UkHIYJc0D3r3Tv7rB3HaR2BBhlhCnl7g3nuOJy
artifact: /.*\.zip/
draft: false
prerelease: false
force_update: true
on:
branch: master
appveyor_repo_tag: true # deploy on tag push only

View File

@@ -7,9 +7,20 @@ include("../utils.cmake")
# TODO `build` directory should maybe be something else... # TODO `build` directory should maybe be something else...
# TODO place somewhere else? # TODO place somewhere else?
include_directories("../build/release") include_directories("../build/release")
include_directories("../src/external")
include_directories("../src/external/glfw/include")
# Get the sources together # Get the sources together
set(example_dirs audio core models others physac shaders text texutures) set(example_dirs audio core models others shaders shapes text textures)
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=199309L)
include(CheckSymbolExists)
check_symbol_exists(CLOCK_MONOTONIC time.h HAVE_CLOCK_MONOTONIC)
check_symbol_exists(QueryPerformanceCounter windows.h HAVE_QPC)
set(CMAKE_REQUIRED_DEFINITIONS)
if(HAVE_QPC OR HAVE_CLOCK_MONOTONIC)
set(example_dirs ${example_dirs} physac)
endif()
set(example_sources) set(example_sources)
set(example_resources) set(example_resources)
foreach(example_dir ${example_dirs}) foreach(example_dir ${example_dirs})
@@ -22,6 +33,14 @@ foreach(example_dir ${example_dirs})
list(APPEND example_resources ${resources}) list(APPEND example_resources ${resources})
endforeach() endforeach()
include(CheckIncludeFiles)
check_include_files(OVR_CAPI_GL.h HAVE_OCULUS_CAPI)
if(NOT HAVE_OCULUS_CAPI)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/oculus_rift.c)
endif()
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
# Do each example # Do each example
foreach(example_source ${example_sources}) foreach(example_source ${example_sources})
# Create the basename for the example # Create the basename for the example

View File

@@ -2,7 +2,7 @@
# #
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# #
# Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2018 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software. # will the authors be held liable for any damages arising from the use of this software.
@@ -24,81 +24,138 @@
.PHONY: all clean .PHONY: all clean
# Define required raylib variables # Define required raylib variables
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop() PROJECT_NAME ?= raylib_examples
PLATFORM ?= PLATFORM_DESKTOP RAYLIB_VERSION ?= 1.9.7
RAYLIB_PATH ?= .. RAYLIB_API_VERSION ?= 1
PROJECT_NAME ?= raylib_example RAYLIB_PATH ?= ..
ifeq ($(PLATFORM),PLATFORM_RPI) # Define default options
RAYLIB_PATH ?= /home/pi/raylib
endif
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
# NOTE: Libraries should be provided in the selected form PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_LIBTYPE ?= STATIC
OPENAL_LIBTYPE ?= STATIC
# On PLATFORM_WEB force OpenAL Soft shared library # Locations of your newly installed library and associated headers. See ../src/Makefile
ifeq ($(PLATFORM),PLATFORM_WEB) # On Linux, if you have installed raylib but cannot compile the examples, check that
OPENAL_LIBTYPE = SHARED # the *_INSTALL_PATH values here are the same as those in src/Makefile or point to known locations.
endif # To enable system-wide compile-time and runtime linking to libraylib.so, run ../src/$ sudo make install RAYLIB_LIBTYPE_SHARED.
# To enable compile-time linking to a special version of libraylib.so, change these variables here.
# To enable runtime linking to a special version of libraylib.so, see EXAMPLE_RUNTIME_PATH below.
# If there is a libraylib in both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, at runtime,
# the library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over the one at RAYLIB_INSTALL_PATH.
# RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths.
DESTDIR ?= /usr/local
RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib
# RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files.
RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC
# Build mode for project: DEBUG or RELEASE
RAYLIB_BUILD_MODE ?= RELEASE
# Use external GLFW library instead of rglfw module
# TODO: Review usage on Linux. Target version of choice. Switch on -lglfw or -lglfw3
USE_EXTERNAL_GLFW ?= FALSE
# Use Wayland display server protocol on Linux desktop
# by default it uses X11 windowing system
USE_WAYLAND_DISPLAY ?= FALSE
# NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile)
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
LIBPATH=win32
else else
UNAMEOS=$(shell uname) UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX PLATFORM_OS=LINUX
LIBPATH=linux endif
else ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS=FREEBSD
endif
ifeq ($(UNAMEOS),Darwin) ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX PLATFORM_OS=OSX
LIBPATH=osx
endif
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI cross-compiler UNAMEOS=$(shell uname)
RPI_CROSS_COMPILE ?= NO ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
endif
# RAYLIB_PATH adjustment for different platforms.
# If using GNU make, we can get the full path to the top of the tree. Windows? BSD?
# Required for ldconfig or other tools that do not perform path expansion.
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_PREFIX ?= ..
RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX))
endif
endif
# Default path for raylib on Raspberry Pi, if installed in different path, update it!
# This is not currently used by src/Makefile. Not sure of its origin or usage. Refer to wiki.
# TODO: update install: target in src/Makefile for RPI, consider relation to LINUX.
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_PATH ?= /home/pi/raylib
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH = C:/emsdk EMSDK_PATH = C:/emsdk
EMSCRIPTEN_VERSION = 1.37.21 EMSCRIPTEN_VERSION = 1.37.28
CLANG_VERSION=e1.37.21_64bit CLANG_VERSION=e1.37.28_64bit
PYTHON_VERSION=2.7.5.3_64bit PYTHON_VERSION=2.7.5.3_64bit
NODE_VERSION=4.1.1_64bit NODE_VERSION=4.1.1_64bit
export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
endif endif
# Define raylib release directory for compiled library # Define raylib release directory for compiled library.
# RAYLIB_RELEASE_PATH points to provided binaries or your freshly built version.
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/win32/mingw32 RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/linux RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/osx RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
endif
ifeq ($(PLATFORM_OS),FREEBSD)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/rpi RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5
endif endif
# EXAMPLE_RUNTIME_PATH embeds a custom runtime location of libraylib.so or other desired libraries
# into each example binary compiled with RAYLIB_LIBTYPE=SHARED. It defaults to RAYLIB_RELEASE_PATH
# so that these examples link at runtime with your version of libraylib.so in ../release/libs/linux
# without formal installation from ../src/Makefile. It aids portability and is useful if you have
# multiple versions of raylib, have raylib installed to a non-standard location, or want to
# bundle libraylib.so with your game. Change it to your liking.
# Note: If, at runtime, there is a libraylib.so at both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH,
# The library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over RAYLIB_INSTALL_PATH,
# Implemented for LINUX below with CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH)
# To see the result, run readelf -d core/core_basic_window; looking at the RPATH or RUNPATH attribute.
# To see which libraries a built example is linking to, ldd core/core_basic_window;
# Look for libraylib.so.1 => $(RAYLIB_INSTALL_PATH)/libraylib.so.1 or similar listing.
EXAMPLE_RUNTIME_PATH ?= $(RAYLIB_RELEASE_PATH)
# Define default C compiler: gcc # Define default C compiler: gcc
# NOTE: define g++ compiler if using C++
CC = gcc CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@@ -106,14 +163,20 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# OSX default compiler # OSX default compiler
CC = clang CC = clang
endif endif
ifeq ($(PLATFORM_OS),FREEBSD)
# FreeBSD default compiler
CC = clang
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES) ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# RPI cross-compiler # Define RPI cross-compiler
CC = armv6j-hardfloat-linux-gnueabi-gcc #CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
# HTML5 emscripten compiler # HTML5 emscripten compiler
CC = emcc CC = emcc
endif endif
@@ -129,15 +192,14 @@ endif
# Define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
# -Og enable debugging # -g enable debugging
# -s strip unnecessary data from build # -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
# Additional flags for compiler (if desired) # Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
@@ -148,7 +210,17 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
CFLAGS += -g
#CC = clang
endif
ifeq ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -no-pie -D_DEFAULT_SOURCE CFLAGS += -no-pie -D_DEFAULT_SOURCE
endif
ifeq ($(RAYLIB_LIBTYPE),SHARED)
# Explicitly enable runtime link to libraylib.so
CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH)
endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
@@ -160,23 +232,54 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s USE_PTHREADS=1 # multithreading support # -s USE_PTHREADS=1 # multithreading support
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling -s TOTAL_MEMORY=16777216 --preload-file resources # -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly)
# --preload-file resources # specify a resources folder for data compilation
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 --profiling --preload-file resources
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
EXT = .html
endif endif
# Define include paths for required headers # Define include paths for required headers.
# Precedence: immediately local, raysan5 provided sources
# NOTE: Several external required libraries (stb and others) # NOTE: Several external required libraries (stb and others)
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
# Define additional directories containing required header files # Define additional directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI requried libraries # RPI required libraries
INCLUDE_PATHS += -I/opt/vc/include INCLUDE_PATHS += -I/opt/vc/include
INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux
INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),FREEBSD)
# Consider -L$(RAYLIB_H_INSTALL_PATH)
INCLUDE_PATHS += -I/usr/local/include
endif
ifeq ($(PLATFORM_OS),LINUX)
# Reset everything.
# Precedence: immediately local, installed version, raysan5 provided libs -I$(RAYLIB_H_INSTALL_PATH) -I$(RAYLIB_PATH)/release/include
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -isystem. -isystem$(RAYLIB_PATH)/src -isystem$(RAYLIB_PATH)/release/include -isystem$(RAYLIB_PATH)/src/external
endif
endif
# Define library paths containing required libs # Define library paths containing required libs.
LDFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src # Precedence: immediately local, then raysan5 provided libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),FREEBSD)
# Consider -L$(RAYLIB_INSTALL_PATH)
LDFLAGS += -L. -Lsrc -L/usr/local/lib
endif
ifeq ($(PLATFORM_OS),LINUX)
# Reset everything.
# Precedence: immediately local, installed version, raysan5 provided libs
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L/opt/vc/lib LDFLAGS += -L/opt/vc/lib
@@ -186,50 +289,53 @@ endif
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compiling # Libraries for Windows desktop compilation
# NOTE: GLFW3 and OpenAL Soft libraries should be installed LDLIBS = -lraylib -lopengl32 -lgdi32
LDLIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# Define required flags and libs for OpenAL Soft STATIC/SHARED usage
# NOTE: ALLIBS flag only required for raylib Win32 SHARED library building
ifeq ($(OPENAL_LIBTYPE),STATIC)
LDLIBS += -lopenal32 -lwinmm
CFLAGS += -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition
else
LDLIBS += -lopenal32dll
endif
# Required for physac examples # Required for physac examples
LDLIBS += -static -lpthread LDLIBS += -static -lpthread
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling # Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libegl1-mesa-dev
LDLIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
# On X11 requires also below libraries
# On XWindow requires also below libraries LDLIBS += -lX11
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor # NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
# On Wayland windowing system, additional libraries requires
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
endif
# Explicit link to libc
ifeq ($(RAYLIB_LIBTYPE),SHARED)
LDLIBS += -lc
endif
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling # Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# Libraries for FreeBSD desktop compiling
# NOTE: Required packages: mesa-libs
LDLIBS = -lraylib -lGL -lpthread -lm
# On XWindow requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
# NOTE: It could require additional packages installed: libglfw3-dev
LDLIBS += -lglfw
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# Libraries for Raspberry Pi compiling # Libraries for Raspberry Pi compiling
# NOTE: Required packages: libopenal1 # NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Libraries for web (HTML5) compiling # Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE)/libraylib.bc LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc
endif
# Define output extension to generate a .html file using provided shell
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# Define all object files required # Define all object files required
@@ -266,6 +372,7 @@ EXAMPLES = \
textures/textures_image_processing \ textures/textures_image_processing \
textures/textures_image_drawing \ textures/textures_image_drawing \
textures/textures_image_generation \ textures/textures_image_generation \
textures/textures_image_text \
text/text_sprite_fonts \ text/text_sprite_fonts \
text/text_bmfont_ttf \ text/text_bmfont_ttf \
text/text_raylib_fonts \ text/text_raylib_fonts \
@@ -282,9 +389,9 @@ EXAMPLES = \
models/models_cubicmap \ models/models_cubicmap \
models/models_mesh_picking \ models/models_mesh_picking \
models/models_mesh_generation \ models/models_mesh_generation \
models/models_yaw_pitch_roll \
models/models_material_pbr \ models/models_material_pbr \
models/models_skybox \ models/models_skybox \
models/models_yaw_pitch_roll \
shaders/shaders_model_shader \ shaders/shaders_model_shader \
shaders/shaders_shapes_textures \ shaders/shaders_shapes_textures \
shaders/shaders_custom_uniform \ shaders/shaders_custom_uniform \
@@ -298,7 +405,7 @@ EXAMPLES = \
physac/physics_movement \ physac/physics_movement \
physac/physics_restitution \ physac/physics_restitution \
physac/physics_shatter \ physac/physics_shatter \
fix_dylib \
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST)) CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
@@ -327,7 +434,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
del *.o *.exe /s del *.o *.exe /s
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete find . -type f -perm +ugo+x -delete
@@ -336,10 +443,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
find . -type f -executable -delete find . -type f -executable -delete
rm -f *.o rm -fv *.o
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
del *.o *.html *.js del *.o *.html *.js
endif endif
@echo Cleaning done @echo Cleaning done

View File

@@ -29,11 +29,11 @@ int main()
Vector3 cubePosition = { 0.0f, 1.0f, 0.0f }; Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f }; Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
Ray ray; // Picking line ray Ray ray = {0.0f, 0.0f, 0.0f}; // Picking line ray
bool collision = false; bool collision = false;
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
@@ -45,11 +45,11 @@ int main()
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update camera UpdateCamera(&camera); // Update camera
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{ {
ray = GetMouseRay(GetMousePosition(), camera); ray = GetMouseRay(GetMousePosition(), camera);
// Check collision between ray and box // Check collision between ray and box
collision = CheckCollisionRayBox(ray, collision = CheckCollisionRayBox(ray,
(BoundingBox){(Vector3){ cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2 }, (BoundingBox){(Vector3){ cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2 },
@@ -65,7 +65,7 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
if (collision) if (collision)
{ {
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED); DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED);
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON); DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON);
@@ -77,15 +77,14 @@ int main()
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY); DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY);
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY); DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY);
} }
DrawRay(ray, MAROON); DrawRay(ray, MAROON);
DrawGrid(10, 1.0f); DrawGrid(10, 1.0f);
End3dMode(); End3dMode();
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY); DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, GREEN); if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, GREEN);
DrawFPS(10, 10); DrawFPS(10, 10);
@@ -100,4 +99,4 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

@@ -113,7 +113,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
mat.shader.locs[LOC_MAP_METALNESS] = GetShaderLocation(mat.shader, "metalness.sampler"); mat.shader.locs[LOC_MAP_METALNESS] = GetShaderLocation(mat.shader, "metalness.sampler");
mat.shader.locs[LOC_MAP_NORMAL] = GetShaderLocation(mat.shader, "normals.sampler"); mat.shader.locs[LOC_MAP_NORMAL] = GetShaderLocation(mat.shader, "normals.sampler");
mat.shader.locs[LOC_MAP_ROUGHNESS] = GetShaderLocation(mat.shader, "roughness.sampler"); mat.shader.locs[LOC_MAP_ROUGHNESS] = GetShaderLocation(mat.shader, "roughness.sampler");
mat.shader.locs[LOC_MAP_OCCUSION] = GetShaderLocation(mat.shader, "occlusion.sampler"); mat.shader.locs[LOC_MAP_OCCLUSION] = GetShaderLocation(mat.shader, "occlusion.sampler");
//mat.shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(mat.shader, "emission.sampler"); //mat.shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(mat.shader, "emission.sampler");
//mat.shader.locs[LOC_MAP_HEIGHT] = GetShaderLocation(mat.shader, "height.sampler"); //mat.shader.locs[LOC_MAP_HEIGHT] = GetShaderLocation(mat.shader, "height.sampler");
mat.shader.locs[LOC_MAP_IRRADIANCE] = GetShaderLocation(mat.shader, "irradianceMap"); mat.shader.locs[LOC_MAP_IRRADIANCE] = GetShaderLocation(mat.shader, "irradianceMap");

View File

@@ -38,7 +38,7 @@ int main()
tower.material.maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture tower.material.maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
BoundingBox towerBBox = CalculateBoundingBox(tower.mesh); BoundingBox towerBBox = MeshBoundingBox(tower.mesh); // Get mesh bounding box
bool hitMeshBBox = false; bool hitMeshBBox = false;
bool hitTriangle = false; bool hitTriangle = false;
@@ -101,8 +101,8 @@ int main()
{ {
hitMeshBBox = true; hitMeshBBox = true;
// Check ray collision against mesh // Check ray collision against model
meshHitInfo = GetCollisionRayMesh(ray, &tower.mesh); meshHitInfo = GetCollisionRayModel(ray, &tower);
if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance)) if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance))
{ {

View File

@@ -0,0 +1,112 @@
/*******************************************************************************************
*
* raylib [models] example - Show the difference between perspective and orthographic projection
*
* This program is heavily based on the geometric objects example
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define FOVY_PERSPECTIVE 45.0f
#define WIDTH_ORTHOGRAPHIC 10.0f
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes");
// Define the camera to look into our 3d world
Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, FOVY_PERSPECTIVE, CAMERA_PERSPECTIVE };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
//
// Input
//----------------------------------------------------------------------------------
if(IsKeyPressed(KEY_SPACE))
{
if(camera.type == CAMERA_PERSPECTIVE)
{
camera.fovy = WIDTH_ORTHOGRAPHIC;
camera.type = CAMERA_ORTHOGRAPHIC;
}
else
{
camera.fovy = FOVY_PERSPECTIVE;
camera.type = CAMERA_PERSPECTIVE;
}
}
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RED);
DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, GOLD);
DrawCubeWires((Vector3){-4.0f, 0.0f, -2.0f}, 3.0f, 6.0f, 2.0f, MAROON);
DrawSphere((Vector3){-1.0f, 0.0f, -2.0f}, 1.0f, GREEN);
DrawSphereWires((Vector3){1.0f, 0.0f, 2.0f}, 2.0f, 16, 16, LIME);
DrawCylinder((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, SKYBLUE);
DrawCylinderWires((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, DARKBLUE);
DrawCylinderWires((Vector3){4.5f, -1.0f, 2.0f}, 1.0f, 1.0f, 2.0f, 6, BROWN);
DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, GOLD);
DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, PINK);
DrawGrid(10, 1.0f); // Draw a grid
End3dMode();
DrawFPS(10, 10);
DrawText("Press Spacebar to switch camera type", 10, 40, 24, BLACK);
if(camera.type == CAMERA_ORTHOGRAPHIC)
{
DrawText("Orthographic", 10, 65, 24, BLACK);
}
else if(camera.type == CAMERA_PERSPECTIVE)
{
DrawText("Perspective", 10, 65, 24, BLACK);
}
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -62,7 +62,7 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
DrawModel(skybox, Vector3Zero(), 1.0f, WHITE); DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE);
DrawGrid(10, 1.0f); DrawGrid(10, 1.0f);

View File

@@ -5,7 +5,7 @@
* This example has been created using raylib 1.8 (www.raylib.com) * This example has been created using raylib 1.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Example based on Berni work on Raspberry Pi: * Example based on Berni work on Raspberry Pi:
* http://forum.raylib.com/index.php?p=/discussion/124/line-versus-triangle-drawing-order * http://forum.raylib.com/index.php?p=/discussion/124/line-versus-triangle-drawing-order
* *
* Copyright (c) 2017 Ramon Santamaria (@raysan5) * Copyright (c) 2017 Ramon Santamaria (@raysan5)
@@ -30,25 +30,25 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [models] example - plane rotations (yaw, pitch, roll)"); InitWindow(screenWidth, screenHeight, "raylib [models] example - plane rotations (yaw, pitch, roll)");
Texture2D texAngleGauge = LoadTexture("resources/angle_gauge.png"); Texture2D texAngleGauge = LoadTexture("resources/angle_gauge.png");
Texture2D texBackground = LoadTexture("resources/background.png"); Texture2D texBackground = LoadTexture("resources/background.png");
Texture2D texPitch = LoadTexture("resources/pitch.png"); Texture2D texPitch = LoadTexture("resources/pitch.png");
Texture2D texPlane = LoadTexture("resources/plane.png"); Texture2D texPlane = LoadTexture("resources/plane.png");
RenderTexture2D framebuffer = LoadRenderTexture(192, 192); RenderTexture2D framebuffer = LoadRenderTexture(192, 192);
// Model loading // Model loading
Model model = LoadModel("resources/plane.obj"); // Load OBJ model Model model = LoadModel("resources/plane.obj"); // Load OBJ model
model.material.maps[MAP_DIFFUSE].texture = LoadTexture("resources/plane_diffuse.png"); // Set map diffuse texture model.material.maps[MAP_DIFFUSE].texture = LoadTexture("resources/plane_diffuse.png"); // Set map diffuse texture
GenTextureMipmaps(&model.material.maps[MAP_DIFFUSE].texture); GenTextureMipmaps(&model.material.maps[MAP_DIFFUSE].texture);
Camera camera = { 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 0.0f, 60.0f, -120.0f };// Camera position perspective camera.position = (Vector3){ 0.0f, 60.0f, -120.0f };// Camera position perspective
camera.target = (Vector3){ 0.0f, 12.0f, 0.0f }; // Camera looking at point camera.target = (Vector3){ 0.0f, 12.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 30.0f; // Camera field-of-view Y camera.fovy = 30.0f; // Camera field-of-view Y
float pitch = 0.0f; float pitch = 0.0f;
float roll = 0.0f; float roll = 0.0f;
float yaw = 0.0f; float yaw = 0.0f;
@@ -61,7 +61,7 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Plane roll (x-axis) controls // Plane roll (x-axis) controls
if (IsKeyDown(KEY_LEFT)) roll += 1.0f; if (IsKeyDown(KEY_LEFT)) roll += 1.0f;
else if (IsKeyDown(KEY_RIGHT)) roll -= 1.0f; else if (IsKeyDown(KEY_RIGHT)) roll -= 1.0f;
@@ -70,7 +70,7 @@ int main()
if (roll > 0.0f) roll -= 0.5f; if (roll > 0.0f) roll -= 0.5f;
else if (roll < 0.0f) roll += 0.5f; else if (roll < 0.0f) roll += 0.5f;
} }
// Plane yaw (y-axis) controls // Plane yaw (y-axis) controls
if (IsKeyDown(KEY_S)) yaw += 1.0f; if (IsKeyDown(KEY_S)) yaw += 1.0f;
else if (IsKeyDown(KEY_A)) yaw -= 1.0f; else if (IsKeyDown(KEY_A)) yaw -= 1.0f;
@@ -79,7 +79,7 @@ int main()
if (yaw > 0.0f) yaw -= 0.5f; if (yaw > 0.0f) yaw -= 0.5f;
else if (yaw < 0.0f) yaw += 0.5f; else if (yaw < 0.0f) yaw += 0.5f;
} }
// Plane pitch (z-axis) controls // Plane pitch (z-axis) controls
if (IsKeyDown(KEY_DOWN)) pitch += 0.6f; if (IsKeyDown(KEY_DOWN)) pitch += 0.6f;
else if (IsKeyDown(KEY_UP)) pitch -= 0.6f; else if (IsKeyDown(KEY_UP)) pitch -= 0.6f;
@@ -88,7 +88,7 @@ int main()
if (pitch > 0.3f) pitch -= 0.3f; if (pitch > 0.3f) pitch -= 0.3f;
else if (pitch < -0.3f) pitch += 0.3f; else if (pitch < -0.3f) pitch += 0.3f;
} }
// Wraps the phase of an angle to fit between -180 and +180 degrees // Wraps the phase of an angle to fit between -180 and +180 degrees
int pitchOffset = pitch; int pitchOffset = pitch;
while (pitchOffset > 180) pitchOffset -= 360; while (pitchOffset > 180) pitchOffset -= 360;
@@ -96,20 +96,20 @@ int main()
pitchOffset *= 10; pitchOffset *= 10;
Matrix transform = MatrixIdentity(); Matrix transform = MatrixIdentity();
transform = MatrixMultiply(transform, MatrixRotateZ(DEG2RAD*roll)); transform = MatrixMultiply(transform, MatrixRotateZ(DEG2RAD*roll));
transform = MatrixMultiply(transform, MatrixRotateX(DEG2RAD*pitch)); transform = MatrixMultiply(transform, MatrixRotateX(DEG2RAD*pitch));
transform = MatrixMultiply(transform, MatrixRotateY(DEG2RAD*yaw)); transform = MatrixMultiply(transform, MatrixRotateY(DEG2RAD*yaw));
model.transform = transform; model.transform = transform;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
// Draw framebuffer texture (Ahrs Display) // Draw framebuffer texture (Ahrs Display)
int centerX = framebuffer.texture.width/2; int centerX = framebuffer.texture.width/2;
int centerY = framebuffer.texture.height/2; int centerY = framebuffer.texture.height/2;
@@ -119,18 +119,18 @@ int main()
BeginBlendMode(BLEND_ALPHA); BeginBlendMode(BLEND_ALPHA);
DrawTexturePro(texBackground, (Rectangle){0,0,texBackground.width, texBackground.height}, DrawTexturePro(texBackground, (Rectangle){ 0, 0, texBackground.width, texBackground.height },
(Rectangle){ centerX, centerY, texBackground.width*scaleFactor, texBackground.height*scaleFactor}, (Rectangle){ centerX, centerY, texBackground.width*scaleFactor, texBackground.height*scaleFactor},
(Vector2){texBackground.width/2*scaleFactor, texBackground.height/2*scaleFactor + pitchOffset*scaleFactor}, roll, WHITE); (Vector2){ texBackground.width/2*scaleFactor, texBackground.height/2*scaleFactor + pitchOffset*scaleFactor }, roll, WHITE);
DrawTexturePro(texPitch, (Rectangle){ 0, 0, texPitch.width, texPitch.height }, DrawTexturePro(texPitch, (Rectangle){ 0, 0, texPitch.width, texPitch.height },
(Rectangle){ centerX, centerY, texPitch.width*scaleFactor, texPitch.height*scaleFactor }, (Rectangle){ centerX, centerY, texPitch.width*scaleFactor, texPitch.height*scaleFactor },
(Vector2){ texPitch.width/2*scaleFactor, texPitch.height/2*scaleFactor + pitchOffset*scaleFactor }, roll, WHITE); (Vector2){ texPitch.width/2*scaleFactor, texPitch.height/2*scaleFactor + pitchOffset*scaleFactor }, roll, WHITE);
DrawTexturePro(texPlane, (Rectangle){0,0,texPlane.width, texPlane.height }, DrawTexturePro(texPlane, (Rectangle){ 0, 0, texPlane.width, texPlane.height },
(Rectangle){ centerX, centerY, texPlane.width*scaleFactor, texPlane.height*scaleFactor }, (Rectangle){ centerX, centerY, texPlane.width*scaleFactor, texPlane.height*scaleFactor },
(Vector2){texPlane.width/2*scaleFactor, texPlane.height/2*scaleFactor }, 0, WHITE); (Vector2){ texPlane.width/2*scaleFactor, texPlane.height/2*scaleFactor }, 0, WHITE);
EndBlendMode(); EndBlendMode();
EndTextureMode(); EndTextureMode();
@@ -144,10 +144,10 @@ int main()
End3dMode(); End3dMode();
// Draw 2D GUI stuff // Draw 2D GUI stuff
DrawAngleGauge(texAngleGauge, 80, 80, roll, "roll", RED); DrawAngleGauge(texAngleGauge, 80, 70, roll, "roll", RED);
DrawAngleGauge(texAngleGauge, 190, 80, pitch, "pitch", GREEN); DrawAngleGauge(texAngleGauge, 190, 70, pitch, "pitch", GREEN);
DrawAngleGauge(texAngleGauge, 300, 80, yaw, "yaw", SKYBLUE); DrawAngleGauge(texAngleGauge, 300, 70, yaw, "yaw", SKYBLUE);
DrawRectangle(30, 360, 260, 70, Fade(SKYBLUE, 0.5f)); DrawRectangle(30, 360, 260, 70, Fade(SKYBLUE, 0.5f));
DrawRectangleLines(30, 360, 260, 70, Fade(DARKBLUE, 0.5f)); DrawRectangleLines(30, 360, 260, 70, Fade(DARKBLUE, 0.5f));
DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 370, 10, DARKGRAY); DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 370, 10, DARKGRAY);
@@ -155,31 +155,31 @@ int main()
DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 410, 10, DARKGRAY); DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 410, 10, DARKGRAY);
// Draw framebuffer texture // Draw framebuffer texture
DrawTextureRec(framebuffer.texture, (Rectangle){ 0, 0, framebuffer.texture.width, -framebuffer.texture.height }, DrawTextureRec(framebuffer.texture, (Rectangle){ 0, 0, framebuffer.texture.width, -framebuffer.texture.height },
(Vector2){ screenWidth - framebuffer.texture.width - 20, 20 }, Fade(WHITE, 0.8f)); (Vector2){ screenWidth - framebuffer.texture.width - 20, 20 }, Fade(WHITE, 0.8f));
DrawRectangleLines(screenWidth - framebuffer.texture.width - 20, 20, framebuffer.texture.width, framebuffer.texture.height, DARKGRAY); DrawRectangleLines(screenWidth - framebuffer.texture.width - 20, 20, framebuffer.texture.width, framebuffer.texture.height, DARKGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Unload all loaded data // Unload all loaded data
UnloadModel(model); UnloadModel(model);
UnloadRenderTexture(framebuffer); UnloadRenderTexture(framebuffer);
UnloadTexture(texAngleGauge); UnloadTexture(texAngleGauge);
UnloadTexture(texBackground); UnloadTexture(texBackground);
UnloadTexture(texPitch); UnloadTexture(texPitch);
UnloadTexture(texPlane); UnloadTexture(texPlane);
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }
@@ -192,7 +192,7 @@ void DrawAngleGauge(Texture2D angleGauge, int x, int y, float angle, char title[
int textSize = 20; int textSize = 20;
DrawTexturePro(angleGauge, srcRec, dstRec, origin, angle, color); DrawTexturePro(angleGauge, srcRec, dstRec, origin, angle, color);
DrawText(FormatText("%5.1f<EFBFBD>", angle), x - MeasureText(FormatText("%5.1f<EFBFBD>", angle), textSize) / 2, y + 10, textSize, DARKGRAY); DrawText(FormatText("%5.1f", angle), x - MeasureText(FormatText("%5.1f", angle), textSize) / 2, y + 10, textSize, DARKGRAY);
DrawText(title, x - MeasureText(title, textSize) / 2, y + 60, textSize, DARKGRAY); DrawText(title, x - MeasureText(title, textSize) / 2, y + 60, textSize, DARKGRAY);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -12,7 +12,7 @@
in vec3 vertexPosition; in vec3 vertexPosition;
in vec2 vertexTexCoord; in vec2 vertexTexCoord;
in vec3 vertexNormal; in vec3 vertexNormal;
in vec3 vertexTangent; in vec4 vertexTangent;
// Input uniform values // Input uniform values
uniform mat4 mvp; uniform mat4 mvp;
@@ -28,7 +28,7 @@ out vec3 fragBinormal;
void main() void main()
{ {
// Calculate binormal from vertex normal and tangent // Calculate binormal from vertex normal and tangent
vec3 vertexBinormal = cross(vertexNormal, vertexTangent); vec3 vertexBinormal = cross(vertexNormal, vec3(vertexTangent));
// Calculate fragment normal based on normal transformations // Calculate fragment normal based on normal transformations
mat3 normalMatrix = transpose(inverse(mat3(mMatrix))); mat3 normalMatrix = transpose(inverse(mat3(mMatrix)));
@@ -39,7 +39,7 @@ void main()
// Send vertex attributes to fragment shader // Send vertex attributes to fragment shader
fragTexCoord = vertexTexCoord; fragTexCoord = vertexTexCoord;
fragNormal = normalize(normalMatrix*vertexNormal); fragNormal = normalize(normalMatrix*vertexNormal);
fragTangent = normalize(normalMatrix*vertexTangent); fragTangent = normalize(normalMatrix*vec3(vertexTangent));
fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal)*fragNormal); fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal)*fragNormal);
fragBinormal = normalize(normalMatrix*vertexBinormal); fragBinormal = normalize(normalMatrix*vertexBinormal);
fragBinormal = cross(fragNormal, fragTangent); fragBinormal = cross(fragNormal, fragTangent);

View File

@@ -26,14 +26,11 @@
********************************************************************************************/ ********************************************************************************************/
#include <stdio.h> #include <stdio.h>
#include "audio.h"
#if defined(_WIN32) #if defined(_WIN32)
#include <conio.h> // Windows only, no stardard library #include <conio.h> // Windows only, no stardard library
#endif
#include "audio.h"
#if defined(__linux__)
#else
#include <stdio.h> #include <stdio.h>
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
@@ -79,13 +76,13 @@ int main()
{ {
// Initialization // Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
unsigned char key; static unsigned char key;
InitAudioDevice(); InitAudioDevice();
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
Music music = LoadMusicStream("resources/audio/guitar_noodling.ogg"); Music music = LoadMusicStream("resources/audio/guitar_noodling.ogg");
PlayMusicStream(music); PlayMusicStream(music);
@@ -102,23 +99,23 @@ int main()
PlaySound(fxWav); PlaySound(fxWav);
key = 0; key = 0;
} }
if (key == 'd') if (key == 'd')
{ {
PlaySound(fxOgg); PlaySound(fxOgg);
key = 0; key = 0;
} }
UpdateMusicStream(music); UpdateMusicStream(music);
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadSound(fxWav); // Unload sound data UnloadSound(fxWav); // Unload sound data
UnloadSound(fxOgg); // Unload sound data UnloadSound(fxOgg); // Unload sound data
UnloadMusicStream(music); // Unload music stream data UnloadMusicStream(music); // Unload music stream data
CloseAudioDevice(); CloseAudioDevice();
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@@ -10,7 +10,6 @@
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
#include <stdlib.h> // Required for: malloc(), free() #include <stdlib.h> // Required for: malloc(), free()
#define MAX_BUNNIES 100000 // 100K bunnies #define MAX_BUNNIES 100000 // 100K bunnies
@@ -29,15 +28,16 @@ int main()
int screenHeight = 960; int screenHeight = 960;
InitWindow(screenWidth, screenHeight, "raylib example - Bunnymark"); InitWindow(screenWidth, screenHeight, "raylib example - Bunnymark");
Texture2D texBunny = LoadTexture("resources/wabbit_alpha.png"); Texture2D texBunny = LoadTexture("resources/wabbit_alpha.png");
Bunny *bunnies = (Bunny *)malloc(MAX_BUNNIES*sizeof(Bunny)); // Bunnies array Bunny *bunnies = (Bunny *)malloc(MAX_BUNNIES*sizeof(Bunny)); // Bunnies array
int bunniesCount = 0; // Bunnies counter int bunniesCount = 0; // Bunnies counter
SetTargetFPS(60); SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
@@ -54,7 +54,7 @@ int main()
bunniesCount++; bunniesCount++;
} }
} }
// Update bunnies // Update bunnies
for (int i = 0; i < bunniesCount; i++) for (int i = 0; i < bunniesCount; i++)
{ {
@@ -65,14 +65,14 @@ int main()
if ((bunnies[i].position.y > GetScreenHeight()) || (bunnies[i].position.y < 0)) bunnies[i].speed.y *= -1; if ((bunnies[i].position.y > GetScreenHeight()) || (bunnies[i].position.y < 0)) bunnies[i].speed.y *= -1;
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
for (int i = 0; i <= bunniesCount; i++) for (int i = 0; i < bunniesCount; i++)
{ {
// NOTE: When internal QUADS batch limit is reached, a draw call is launched and // NOTE: When internal QUADS batch limit is reached, a draw call is launched and
// batching buffer starts being filled again; before launching the draw call, // batching buffer starts being filled again; before launching the draw call,
@@ -80,11 +80,10 @@ int main()
// a stall and consequently a frame drop, limiting number of bunnies drawn at 60 fps // a stall and consequently a frame drop, limiting number of bunnies drawn at 60 fps
DrawTexture(texBunny, bunnies[i].position.x, bunnies[i].position.y, RAYWHITE); DrawTexture(texBunny, bunnies[i].position.x, bunnies[i].position.y, RAYWHITE);
} }
DrawRectangle(0, 0, screenWidth, 40, LIGHTGRAY); DrawRectangle(0, 0, screenWidth, 40, LIGHTGRAY);
DrawText("raylib bunnymark", 10, 10, 20, DARKGRAY); DrawText("raylib bunnymark", 10, 10, 20, DARKGRAY);
DrawText(FormatText("bunnies: %i", bunniesCount), 400, 10, 20, RED); DrawText(FormatText("bunnies: %i", bunniesCount), 400, 10, 20, RED);
DrawFPS(260, 10); DrawFPS(260, 10);
EndDrawing(); EndDrawing();
@@ -94,9 +93,9 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
free(bunnies); free(bunnies);
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

@@ -10,7 +10,7 @@ varying vec2 fragTexCoord;
varying vec4 fragColor; varying vec4 fragColor;
varying vec3 fragNormal; varying vec3 fragNormal;
uniform mat4 mvpMatrix; uniform mat4 mvp;
void main() void main()
{ {
@@ -19,5 +19,5 @@ void main()
fragColor = vertexColor; fragColor = vertexColor;
fragNormal = vertexNormal; fragNormal = vertexNormal;
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); gl_Position = mvp*vec4(vertexPosition, 1.0);
} }

View File

@@ -10,7 +10,7 @@ out vec2 fragTexCoord;
out vec4 fragColor; out vec4 fragColor;
out vec3 fragNormal; out vec3 fragNormal;
uniform mat4 mvpMatrix; uniform mat4 mvp;
void main() void main()
{ {
@@ -19,5 +19,5 @@ void main()
fragColor = vertexColor; fragColor = vertexColor;
fragNormal = vertexNormal; fragNormal = vertexNormal;
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); gl_Position = mvp*vec4(vertexPosition, 1.0);
} }

View File

@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
* *
* Copyright (c) 2017 Victor Fisac * Copyright (c) 2016-2018 Victor Fisac
* *
********************************************************************************************/ ********************************************************************************************/
@@ -32,6 +32,7 @@ int main()
// Physac logo drawing position // Physac logo drawing position
int logoX = screenWidth - MeasureText("Physac", 30) - 10; int logoX = screenWidth - MeasureText("Physac", 30) - 10;
int logoY = 15; int logoY = 15;
bool needsReset = false;
// Initialize physics and default physics bodies // Initialize physics and default physics bodies
InitPhysics(); InitPhysics();
@@ -52,10 +53,9 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed('R')) // Reset physics input // Delay initialization of variables due to physics reset async
if (needsReset)
{ {
ResetPhysics();
floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10); floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10);
floor->enabled = false; floor->enabled = false;
@@ -63,6 +63,13 @@ int main()
circle->enabled = false; circle->enabled = false;
} }
// Reset physics input
if (IsKeyPressed('R'))
{
ResetPhysics();
needsReset = true;
}
// Physics body creation inputs // Physics body creation inputs
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) CreatePhysicsBodyPolygon(GetMousePosition(), GetRandomValue(20, 80), GetRandomValue(3, 8), 10); if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) CreatePhysicsBodyPolygon(GetMousePosition(), GetRandomValue(20, 80), GetRandomValue(3, 8), 10);
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) CreatePhysicsBodyCircle(GetMousePosition(), GetRandomValue(10, 45), 10); else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) CreatePhysicsBodyCircle(GetMousePosition(), GetRandomValue(10, 45), 10);

View File

@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
* *
* Copyright (c) 2017 Victor Fisac * Copyright (c) 2016-2018 Victor Fisac
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
* *
* Copyright (c) 2017 Victor Fisac * Copyright (c) 2016-2018 Victor Fisac
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
* *
* Copyright (c) 2017 Victor Fisac * Copyright (c) 2016-2018 Victor Fisac
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
* *
* Copyright (c) 2017 Victor Fisac * Copyright (c) 2016-2018 Victor Fisac
* *
********************************************************************************************/ ********************************************************************************************/
@@ -32,14 +32,15 @@ int main()
// Physac logo drawing position // Physac logo drawing position
int logoX = screenWidth - MeasureText("Physac", 30) - 10; int logoX = screenWidth - MeasureText("Physac", 30) - 10;
int logoY = 15; int logoY = 15;
bool needsReset = false;
// Initialize physics and default physics bodies // Initialize physics and default physics bodies
InitPhysics(); InitPhysics();
SetPhysicsGravity(0, 0); SetPhysicsGravity(0, 0);
// Create random polygon physics body to shatter // Create random polygon physics body to shatter
PhysicsBody body = CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10); CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
SetTargetFPS(60); SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -48,12 +49,17 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Delay initialization of variables due to physics reset asynchronous
if (needsReset)
{
// Create random polygon physics body to shatter
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
}
if (IsKeyPressed('R')) // Reset physics input if (IsKeyPressed('R')) // Reset physics input
{ {
ResetPhysics(); ResetPhysics();
needsReset = true;
// Create random polygon physics body to shatter
body = CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
} }
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) // Physics shatter input if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) // Physics shatter input

View File

@@ -0,0 +1,22 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
uniform vec2 resolution = vec2(800, 450);
void main()
{
// Texel color fetching from texture sampler
vec4 texelColor = texture2D(texture0, fragTexCoord);
// NOTE: Implement here your fragment shader code
gl_FragColor = texelColor*colDiffuse;
}

View File

@@ -0,0 +1,26 @@
#version 120
// Input vertex attributes
attribute vec3 vertexPosition;
attribute vec2 vertexTexCoord;
attribute vec3 vertexNormal;
attribute vec4 vertexColor;
// Input uniform values
uniform mat4 mvp;
// Output vertex attributes (to fragment shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// NOTE: Add here your custom variables
void main()
{
// Send vertex attributes to fragment shader
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
// Calculate final vertex position
gl_Position = mvp*vec4(vertexPosition, 1.0);
}

View File

@@ -0,0 +1,37 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
const vec2 size = vec2(800, 450); // render size
const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance
const float quality = 2.5; // lower = smaller glow, better quality
void main()
{
vec4 sum = vec4(0);
vec2 sizeFactor = vec2(1)/size*quality;
// Texel color fetching from texture sampler
vec4 source = texture2D(texture0, fragTexCoord);
const int range = 2; // should be = (samples - 1)/2;
for (int x = -range; x <= range; x++)
{
for (int y = -range; y <= range; y++)
{
sum += texture2D(texture0, fragTexCoord + vec2(x, y)*sizeFactor);
}
}
// Calculate final fragment color
gl_FragColor = ((sum/(samples*samples)) + source)*colDiffuse;
}

View File

@@ -0,0 +1,32 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
// NOTE: Render size values must be passed from code
const float renderWidth = 800.0;
const float renderHeight = 450.0;
vec3 offset = vec3(0.0, 1.3846153846, 3.2307692308);
vec3 weight = vec3(0.2270270270, 0.3162162162, 0.0702702703);
void main()
{
// Texel color fetching from texture sampler
vec3 tc = texture2D(texture0, fragTexCoord).rgb*weight.x;
tc += texture2D(texture0, fragTexCoord + vec2(offset.y)/renderWidth, 0.0).rgb*weight.y;
tc += texture2D(texture0, fragTexCoord - vec2(offset.y)/renderWidth, 0.0).rgb*weight.y;
tc += texture2D(texture0, fragTexCoord + vec2(offset.z)/renderWidth, 0.0).rgb*weight.z;
tc += texture2D(texture0, fragTexCoord - vec2(offset.z)/renderWidth, 0.0).rgb*weight.z;
gl_FragColor = vec4(tc, 1.0);
}

View File

@@ -0,0 +1,45 @@
# version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
float hatchOffsetY = 5.0;
float lumThreshold01 = 0.9;
float lumThreshold02 = 0.7;
float lumThreshold03 = 0.5;
float lumThreshold04 = 0.3;
void main()
{
vec3 tc = vec3(1.0, 1.0, 1.0);
float lum = length(texture2D(texture0, fragTexCoord).rgb);
if (lum < lumThreshold01)
{
if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
}
if (lum < lumThreshold02)
{
if (mod(gl_FragCoord .x - gl_FragCoord .y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
}
if (lum < lumThreshold03)
{
if (mod(gl_FragCoord .x + gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
}
if (lum < lumThreshold04)
{
if (mod(gl_FragCoord .x - gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
}
gl_FragColor = vec4(tc, 1.0);
}

View File

@@ -0,0 +1,55 @@
# version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
// NOTE: Render size values must be passed from code
const float renderWidth = 800.0;
const float renderHeight = 450.0;
float stitchingSize = 6.0;
int invert = 0;
vec4 PostFX(sampler2D tex, vec2 uv)
{
vec4 c = vec4(0.0);
float size = stitchingSize;
vec2 cPos = uv * vec2(renderWidth, renderHeight);
vec2 tlPos = floor(cPos / vec2(size, size));
tlPos *= size;
int remX = int(mod(cPos.x, size));
int remY = int(mod(cPos.y, size));
if (remX == 0 && remY == 0) tlPos = cPos;
vec2 blPos = tlPos;
blPos.y += (size - 1.0);
if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y)))))
{
if (invert == 1) c = vec4(0.2, 0.15, 0.05, 1.0);
else c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4;
}
else
{
if (invert == 1) c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4;
else c = vec4(0.0, 0.0, 0.0, 1.0);
}
return c;
}
void main()
{
vec3 tc = PostFX(texture0, fragTexCoord).rgb;
gl_FragColor = vec4(tc, 1.0);
}

View File

@@ -0,0 +1,52 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
// Input uniform values
uniform sampler2D texture0;
// NOTE: Default parameters for Oculus Rift DK2 device
const vec2 LeftLensCenter = vec2(0.2863248, 0.5);
const vec2 RightLensCenter = vec2(0.7136753, 0.5);
const vec2 LeftScreenCenter = vec2(0.25, 0.5);
const vec2 RightScreenCenter = vec2(0.75, 0.5);
const vec2 Scale = vec2(0.25, 0.45);
const vec2 ScaleIn = vec2(4.0, 2.5);
const vec4 HmdWarpParam = vec4(1.0, 0.22, 0.24, 0.0);
const vec4 ChromaAbParam = vec4(0.996, -0.004, 1.014, 0.0);
void main()
{
// The following two variables need to be set per eye
vec2 LensCenter = fragTexCoord.x < 0.5 ? LeftLensCenter : RightLensCenter;
vec2 ScreenCenter = fragTexCoord.x < 0.5 ? LeftScreenCenter : RightScreenCenter;
// Scales input texture coordinates for distortion: vec2 HmdWarp(vec2 fragTexCoord, vec2 LensCenter)
vec2 theta = (fragTexCoord - LensCenter)*ScaleIn; // Scales to [-1, 1]
float rSq = theta.x*theta.x + theta.y*theta.y;
vec2 theta1 = theta*(HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z*rSq*rSq + HmdWarpParam.w*rSq*rSq*rSq);
//vec2 tc = LensCenter + Scale*theta1;
// Detect whether blue texture coordinates are out of range since these will scaled out the furthest
vec2 thetaBlue = theta1*(ChromaAbParam.z + ChromaAbParam.w*rSq);
vec2 tcBlue = LensCenter + Scale*thetaBlue;
if (any(bvec2(clamp(tcBlue, ScreenCenter - vec2(0.25, 0.5), ScreenCenter + vec2(0.25, 0.5)) - tcBlue))) gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
else
{
// Do blue texture lookup
float blue = texture2D(texture0, tcBlue).b;
// Do green lookup (no scaling)
vec2 tcGreen = LensCenter + Scale*theta1;
float green = texture2D(texture0, tcGreen).g;
// Do red scale and lookup
vec2 thetaRed = theta1*(ChromaAbParam.x + ChromaAbParam.y*rSq);
vec2 tcRed = LensCenter + Scale*thetaRed;
float red = texture2D(texture0, tcRed).r;
gl_FragColor = vec4(red, green, blue, 1.0);
}
}

View File

@@ -0,0 +1,35 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
void main()
{
vec4 color = texture2D(texture0, fragTexCoord);
color += texture2D(texture0, fragTexCoord + 0.001);
color += texture2D(texture0, fragTexCoord + 0.003);
color += texture2D(texture0, fragTexCoord + 0.005);
color += texture2D(texture0, fragTexCoord + 0.007);
color += texture2D(texture0, fragTexCoord + 0.009);
color += texture2D(texture0, fragTexCoord + 0.011);
color += texture2D(texture0, fragTexCoord - 0.001);
color += texture2D(texture0, fragTexCoord - 0.003);
color += texture2D(texture0, fragTexCoord - 0.005);
color += texture2D(texture0, fragTexCoord - 0.007);
color += texture2D(texture0, fragTexCoord - 0.009);
color += texture2D(texture0, fragTexCoord - 0.011);
color.rgb = vec3((color.r + color.g + color.b)/3.0);
color = color/9.5;
gl_FragColor = color;
}

View File

@@ -0,0 +1,41 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
const float PI = 3.1415926535;
void main()
{
float aperture = 178.0;
float apertureHalf = 0.5 * aperture * (PI / 180.0);
float maxFactor = sin(apertureHalf);
vec2 uv = vec2(0.0);
vec2 xy = 2.0 * fragTexCoord.xy - 1.0;
float d = length(xy);
if (d < (2.0 - maxFactor))
{
d = length(xy * maxFactor);
float z = sqrt(1.0 - d * d);
float r = atan(d, z) / PI;
float phi = atan(xy.y, xy.x);
uv.x = r * cos(phi) + 0.5;
uv.y = r * sin(phi) + 0.5;
}
else
{
uv = fragTexCoord.xy;
}
gl_FragColor = texture2D(texture0, uv);
}

View File

@@ -0,0 +1,23 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
void main()
{
// Texel color fetching from texture sampler
vec4 texelColor = texture2D(texture0, fragTexCoord)*colDiffuse*fragColor;
// Convert texel color to grayscale using NTSC conversion weights
float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114));
// Calculate final fragment color
gl_FragColor = vec4(gray, gray, gray, texelColor.a);
}

View File

@@ -0,0 +1,30 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
// NOTE: Render size values must be passed from code
const float renderWidth = 800.0;
const float renderHeight = 450.0;
float pixelWidth = 5.0;
float pixelHeight = 5.0;
void main()
{
float dx = pixelWidth*(1.0/renderWidth);
float dy = pixelHeight*(1.0/renderHeight);
vec2 coord = vec2(dx*floor(fragTexCoord.x/dx), dy*floor(fragTexCoord.y/dy));
vec3 tc = texture2D(texture0, coord).rgb;
gl_FragColor = vec4(tc, 1.0);
}

View File

@@ -0,0 +1,27 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
float gamma = 0.6;
float numColors = 8.0;
void main()
{
vec3 color = texture2D(texture0, fragTexCoord.xy).rgb;
color = pow(color, vec3(gamma, gamma, gamma));
color = color*numColors;
color = floor(color);
color = color/numColors;
color = pow(color, vec3(1.0/gamma));
gl_FragColor = vec4(color, 1.0);
}

View File

@@ -0,0 +1,29 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
void main()
{
vec3 color = texture2D(texture0, fragTexCoord).rgb;
vec3 colors[3];
colors[0] = vec3(0.0, 0.0, 1.0);
colors[1] = vec3(1.0, 1.0, 0.0);
colors[2] = vec3(1.0, 0.0, 0.0);
float lum = (color.r + color.g + color.b)/3.0;
vec3 tc = vec3(0.0, 0.0, 0.0);
if (lum < 0.5) tc = mix(colors[0], colors[1], lum/0.5);
else tc = mix(colors[1], colors[2], (lum - 0.5)/0.5);
gl_FragColor = vec4(tc, 1.0);
}

View File

@@ -0,0 +1,42 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
float offset = 0.0;
float frequency = 450.0/3.0;
uniform float time;
void main()
{
/*
// Scanlines method 1
float tval = 0; //time
vec2 uv = 0.5 + (fragTexCoord - 0.5)*(0.9 + 0.01*sin(0.5*tval));
vec4 color = texture2D(texture0, fragTexCoord);
color = clamp(color*0.5 + 0.5*color*color*1.2, 0.0, 1.0);
color *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0 - uv.x)*(1.0 - uv.y);
color *= vec4(0.8, 1.0, 0.7, 1);
color *= 0.9 + 0.1*sin(10.0*tval + uv.y*1000.0);
color *= 0.97 + 0.03*sin(110.0*tval);
fragColor = color;
*/
// Scanlines method 2
float globalPos = (fragTexCoord.y + offset) * frequency;
float wavePos = cos((fract(globalPos) - 0.5)*3.14);
vec4 color = texture2D(texture0, fragTexCoord);
gl_FragColor = mix(vec4(0.0, 0.3, 0.0, 0.0), color, wavePos);
}

View File

@@ -0,0 +1,38 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
vec2 resolution = vec2(800.0, 450.0);
void main()
{
float x = 1.0/resolution.x;
float y = 1.0/resolution.y;
vec4 horizEdge = vec4(0.0);
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0;
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0;
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
vec4 vertEdge = vec4(0.0);
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0;
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0;
vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb));
gl_FragColor = vec4(edge, texture2D(texture0, fragTexCoord).a);
}

View File

@@ -0,0 +1,44 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
// NOTE: Render size values should be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
float radius = 250.0;
float angle = 0.8;
uniform vec2 center;
void main()
{
vec2 texSize = vec2(renderWidth, renderHeight);
vec2 tc = fragTexCoord*texSize;
tc -= center;
float dist = length(tc);
if (dist < radius)
{
float percent = (radius - dist)/radius;
float theta = percent*percent*angle*8.0;
float s = sin(theta);
float c = cos(theta);
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
}
tc += center;
vec4 color = texture2D(texture0, tc/texSize)*colDiffuse*fragColor;;
gl_FragColor = vec4(color.rgb, 1.0);;
}

View File

@@ -20,10 +20,8 @@
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330 #define GLSL_VERSION 330
#define DEFAULT_VERTEX_SHADER "resources/shaders/glsl330/base.vs"
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB #else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100 #define GLSL_VERSION 100
#define DEFAULT_VERTEX_SHADER "resources/shaders/glsl100/base.vs"
#endif #endif
#define MAX_POSTPRO_SHADERS 12 #define MAX_POSTPRO_SHADERS 12
@@ -85,18 +83,19 @@ int main()
// NOTE 2: We load the correct shader depending on GLSL version // NOTE 2: We load the correct shader depending on GLSL version
Shader shaders[MAX_POSTPRO_SHADERS]; Shader shaders[MAX_POSTPRO_SHADERS];
shaders[FX_GRAYSCALE] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION)); // NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
shaders[FX_POSTERIZATION] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/posterization.fs", GLSL_VERSION)); shaders[FX_GRAYSCALE] = LoadShader(0, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION));
shaders[FX_DREAM_VISION] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/dream_vision.fs", GLSL_VERSION)); shaders[FX_POSTERIZATION] = LoadShader(0, FormatText("resources/shaders/glsl%i/posterization.fs", GLSL_VERSION));
shaders[FX_PIXELIZER] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/pixelizer.fs", GLSL_VERSION)); shaders[FX_DREAM_VISION] = LoadShader(0, FormatText("resources/shaders/glsl%i/dream_vision.fs", GLSL_VERSION));
shaders[FX_CROSS_HATCHING] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/cross_hatching.fs", GLSL_VERSION)); shaders[FX_PIXELIZER] = LoadShader(0, FormatText("resources/shaders/glsl%i/pixelizer.fs", GLSL_VERSION));
shaders[FX_CROSS_STITCHING] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/cross_stitching.fs", GLSL_VERSION)); shaders[FX_CROSS_HATCHING] = LoadShader(0, FormatText("resources/shaders/glsl%i/cross_hatching.fs", GLSL_VERSION));
shaders[FX_PREDATOR_VIEW] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/predator.fs", GLSL_VERSION)); shaders[FX_CROSS_STITCHING] = LoadShader(0, FormatText("resources/shaders/glsl%i/cross_stitching.fs", GLSL_VERSION));
shaders[FX_SCANLINES] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/scanlines.fs", GLSL_VERSION)); shaders[FX_PREDATOR_VIEW] = LoadShader(0, FormatText("resources/shaders/glsl%i/predator.fs", GLSL_VERSION));
shaders[FX_FISHEYE] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/fisheye.fs", GLSL_VERSION)); shaders[FX_SCANLINES] = LoadShader(0, FormatText("resources/shaders/glsl%i/scanlines.fs", GLSL_VERSION));
shaders[FX_SOBEL] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/sobel.fs", GLSL_VERSION)); shaders[FX_FISHEYE] = LoadShader(0, FormatText("resources/shaders/glsl%i/fisheye.fs", GLSL_VERSION));
shaders[FX_BLOOM] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/bloom.fs", GLSL_VERSION)); shaders[FX_SOBEL] = LoadShader(0, FormatText("resources/shaders/glsl%i/sobel.fs", GLSL_VERSION));
shaders[FX_BLUR] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/blur.fs", GLSL_VERSION)); shaders[FX_BLOOM] = LoadShader(0, FormatText("resources/shaders/glsl%i/bloom.fs", GLSL_VERSION));
shaders[FX_BLUR] = LoadShader(0, FormatText("resources/shaders/glsl%i/blur.fs", GLSL_VERSION));
int currentShader = FX_GRAYSCALE; int currentShader = FX_GRAYSCALE;
@@ -177,4 +176,4 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

@@ -52,7 +52,7 @@ int main()
letterCount++; letterCount++;
} }
if (key == KEY_BACKSPACE) if (IsKeyPressed(KEY_BACKSPACE))
{ {
letterCount--; letterCount--;
name[letterCount] = '\0'; name[letterCount] = '\0';

View File

@@ -32,7 +32,7 @@ int main()
GenTextureMipmaps(&font.texture); GenTextureMipmaps(&font.texture);
float fontSize = font.baseSize; float fontSize = font.baseSize;
Vector2 fontPosition = { 40, screenHeight/2 + 50 }; Vector2 fontPosition = { 40, screenHeight/2 - 50 };
Vector2 textSize; Vector2 textSize;
SetTextureFilter(font.texture, FILTER_POINT); SetTextureFilter(font.texture, FILTER_POINT);

Binary file not shown.

View File

@@ -24,10 +24,10 @@ int main()
Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE); Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE);
Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE); Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE);
Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.f, WHITE, BLACK); Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, WHITE, BLACK);
Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE); Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE);
Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f); Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f);
Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 8.f); Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 50, 50, 4.0f);
Image cellular = GenImageCellular(screenWidth, screenHeight, 32); Image cellular = GenImageCellular(screenWidth, screenHeight, 32);
Texture2D textures[NUM_TEXTURES]; Texture2D textures[NUM_TEXTURES];

View File

@@ -0,0 +1,83 @@
/*******************************************************************************************
*
* raylib [texture] example - Image text drawing using TTF generated spritefont
*
* This example has been created using raylib 1.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [texture] example - image text drawing");
// TTF SpriteFont loading with custom generation parameters
SpriteFont font = LoadSpriteFontEx("resources/KAISG.ttf", 64, 0, 0);
Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
// Draw over image using custom font
ImageDrawTextEx(&parrots, (Vector2){ 20, 20 }, font, "[Parrots font drawing]", font.baseSize, 0, WHITE);
Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
Vector2 position = { screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 20 };
bool showFont = false;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_SPACE)) showFont = true;
else showFont = false;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
if (!showFont)
{
// Draw texture with text already drawn inside
DrawTextureV(texture, position, WHITE);
// Draw text directly using sprite font
DrawTextEx(font, "[Parrots font drawing]", (Vector2){ position.x + 20,
position.y + 20 + 280 }, font.baseSize, 0, WHITE);
}
else DrawTexture(font.texture, screenWidth/2 - font.texture.width/2, 50, BLACK);
DrawText("PRESS SPACE to SEE USED SPRITEFONT ", 290, 420, 10, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
UnloadSpriteFont(font); // Unload custom spritefont
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 KiB

View File

@@ -2,7 +2,7 @@
# #
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# #
# Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2018 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software. # will the authors be held liable for any damages arising from the use of this software.
@@ -29,72 +29,87 @@ PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH ?= .. RAYLIB_PATH ?= ..
PROJECT_NAME ?= sample_game PROJECT_NAME ?= sample_game
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Default path for raylib on Raspberry Pi, if installed in different path, update it!
# NOTE: Libraries should be provided in the selected form ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_PATH ?= /home/pi/raylib
OPENAL_LIBTYPE ?= STATIC
# On PLATFORM_WEB force OpenAL Soft shared library
ifeq ($(PLATFORM),PLATFORM_WEB)
OPENAL_LIBTYPE = SHARED
endif endif
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC
# Use external GLFW library instead of rglfw module
USE_EXTERNAL_GLFW ?= FALSE
# Use Wayland display server protocol on Linux desktop
# by default it uses X11 windowing system
USE_WAYLAND_DISPLAY ?= FALSE
# NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile)
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
LIBPATH=win32
else else
UNAMEOS=$(shell uname) UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX PLATFORM_OS=LINUX
LIBPATH=linux endif
else ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS=FREEBSD
endif
ifeq ($(UNAMEOS),Darwin) ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX PLATFORM_OS=OSX
LIBPATH=osx
endif
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI cross-compiler UNAMEOS=$(shell uname)
RPI_CROSS_COMPILE ?= NO ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH = C:/emsdk EMSDK_PATH = C:/emsdk
EMSCRIPTEN_VERSION = 1.37.21 EMSCRIPTEN_VERSION = 1.37.28
CLANG_VERSION=e1.37.21_64bit CLANG_VERSION=e1.37.28_64bit
PYTHON_VERSION=2.7.5.3_64bit PYTHON_VERSION=2.7.5.3_64bit
NODE_VERSION=4.1.1_64bit NODE_VERSION=4.1.1_64bit
export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
endif endif
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs
# Define raylib release directory for compiled library # Define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/win32/mingw32 RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/linux RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/osx RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
endif
ifeq ($(PLATFORM_OS),FREEBSD)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/rpi RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5
endif endif
# Define default C compiler: gcc # Define default C compiler: gcc
# NOTE: define g++ compiler if using C++
CC = gcc CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@@ -102,11 +117,16 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# OSX default compiler # OSX default compiler
CC = clang CC = clang
endif endif
ifeq ($(PLATFORM_OS),FREEBSD)
# FreeBSD default compiler
CC = clang
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES) ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# RPI cross-compiler # Define RPI cross-compiler
CC = armv6j-hardfloat-linux-gnueabi-gcc #CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
@@ -125,19 +145,23 @@ endif
# Define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
# -Og enable debugging # -g enable debugging
# -s strip unnecessary data from build # -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
# Additional flags for compiler (if desired) # Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
CFLAGS += -no-pie -D_DEFAULT_SOURCE CFLAGS += -no-pie -D_DEFAULT_SOURCE
endif endif
@@ -151,7 +175,13 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s USE_PTHREADS=1 # multithreading support # -s USE_PTHREADS=1 # multithreading support
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling -s TOTAL_MEMORY=16777216 --preload-file resources # -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly)
# --preload-file resources # specify a resources folder for data compilation
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 --profiling --preload-file resources
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
EXT = .html
endif endif
# Define include paths for required headers # Define include paths for required headers
@@ -167,7 +197,14 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
# Define library paths containing required libs # Define library paths containing required libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),FREEBSD)
INCLUDE_PATHS += -I/usr/local/include
LDFLAGS += -L. -Lsrc -L/usr/local/lib
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L/opt/vc/lib LDFLAGS += -L/opt/vc/lib
@@ -177,57 +214,53 @@ endif
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compiling # Libraries for Windows desktop compilation
# NOTE: GLFW3 and OpenAL Soft libraries should be installed LDLIBS = -lraylib -lopengl32 -lgdi32
LDLIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# Define required flags and libs for OpenAL Soft STATIC/SHARED usage
# NOTE: ALLIBS flag only required for raylib Win32 SHARED library building
ifeq ($(OPENAL_LIBTYPE),STATIC)
LDLIBS += -lopenal32 -lwinmm
CFLAGS += -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition
else
LDLIBS += -lopenal32dll
endif
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling # Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libegl1-mesa-dev
LDLIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
# On XWindow requires also below libraries # On X11 requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LDLIBS += -lX11
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
# On Wayland windowing system, additional libraries requires
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
endif
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling # Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# Libraries for FreeBSD desktop compiling
# NOTE: Required packages: mesa-libs
LDLIBS = -lraylib -lGL -lpthread -lm
# On XWindow requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
# NOTE: It could require additional packages installed: libglfw3-dev
LDLIBS += -lglfw
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# Libraries for Raspberry Pi compiling # Libraries for Raspberry Pi compiling
# NOTE: Required packages: libopenal1 # NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Libraries for web (HTML5) compiling # Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE)/libraylib.bc LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc
endif endif
# Define additional parameters and flags for windows # Define all source files required
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains raylib icon for windows .exe
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
# Define output extension to generate a .html file using provided shell
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif
# define all object files required
SAMPLES = \ SAMPLES = \
arkanoid \ arkanoid \
asteroids \ asteroids \
@@ -246,17 +279,11 @@ all: $(SAMPLES)
%: %.c %: %.c
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
mingw32-make -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$< $(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$<
else else
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
endif endif
# fix dylib install path name for each executable (MAC)
fix_dylib:
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -print0 | xargs -t -0 -R 1 -I file install_name_tool -change libglfw.3.0.dylib ../external/glfw3/lib/osx/libglfw.3.0.dylib file
endif
# Clean everything # Clean everything
clean: clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@@ -279,3 +306,4 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
del *.o *.html *.js del *.o *.html *.js
endif endif
@echo Cleaning done @echo Cleaning done

View File

@@ -18,10 +18,6 @@
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -83,19 +79,11 @@ static void UpdateDrawFrame(void); // Update and Draw (one frame)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: arkanoid"); InitWindow(screenWidth, screenHeight, "sample game: arkanoid");
#endif
InitGame(); InitGame();
@@ -122,9 +110,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -338,4 +325,4 @@ void UpdateDrawFrame(void)
{ {
UpdateGame(); UpdateGame();
DrawGame(); DrawGame();
} }

View File

@@ -15,10 +15,6 @@
#include <math.h> #include <math.h>
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -101,19 +97,11 @@ static void UpdateDrawFrame(void); // Update and Draw (one frame)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: asteroids"); InitWindow(screenWidth, screenHeight, "sample game: asteroids");
#endif
InitGame(); InitGame();
@@ -140,9 +128,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -578,4 +565,4 @@ void UpdateDrawFrame(void)
{ {
UpdateGame(); UpdateGame();
DrawGame(); DrawGame();
} }

View File

@@ -15,10 +15,6 @@
#include <math.h> #include <math.h>
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -84,19 +80,11 @@ static void UpdateDrawFrame(void); // Update and Draw (one frame)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: asteroids survival"); InitWindow(screenWidth, screenHeight, "sample game: asteroids survival");
#endif
InitGame(); InitGame();
@@ -123,9 +111,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -388,4 +375,4 @@ void UpdateDrawFrame(void)
{ {
UpdateGame(); UpdateGame();
DrawGame(); DrawGame();
} }

View File

@@ -1,8 +1,8 @@
#************************************************************************************************** #**************************************************************************************************
# #
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten) # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# #
# Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2018 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software. # will the authors be held liable for any damages arising from the use of this software.
@@ -23,223 +23,268 @@
.PHONY: all clean .PHONY: all clean
# define raylib platform to compile for # Define required raylib variables
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop() # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH ?= ..\..
PROJECT_NAME ?= drturtle
# define NO to use OpenAL Soft as static library (shared by default) # Default path for raylib on Raspberry Pi, if installed in different path, update it!
SHARED_OPENAL ?= NO ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_PATH ?= /home/pi/raylib
ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO
endif endif
# define raylib directory for include and library # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_PATH ?= C:\raylib\raylib RAYLIB_LIBTYPE ?= STATIC
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Use external GLFW library instead of rglfw module
USE_EXTERNAL_GLFW ?= FALSE
# Use Wayland display server protocol on Linux desktop
# by default it uses X11 windowing system
USE_WAYLAND_DISPLAY ?= FALSE
# NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile)
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
LIBPATH=win32
else else
UNAMEOS:=$(shell uname) UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX PLATFORM_OS=LINUX
LIBPATH=linux endif
else ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS=FREEBSD
endif
ifeq ($(UNAMEOS),Darwin) ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX PLATFORM_OS=OSX
LIBPATH=osx
endif
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI)
UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
endif
# define compiler: gcc for C program, define as g++ for C++
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# define emscripten compiler # Emscripten required variables
CC = emcc EMSDK_PATH = C:/emsdk
else EMSCRIPTEN_VERSION = 1.37.28
ifeq ($(PLATFORM_OS),OSX) CLANG_VERSION=e1.37.28_64bit
# define llvm compiler for mac PYTHON_VERSION=2.7.5.3_64bit
CC = clang NODE_VERSION=4.1.1_64bit
else export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
# define default gcc compiler EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
CC = gcc
endif
endif endif
# define compiler flags: RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs
# -O2 defines optimization level
# -Og enable debugging # Define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
endif
ifeq ($(PLATFORM_OS),FREEBSD)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5
endif
# Define default C compiler: gcc
# NOTE: define g++ compiler if using C++
CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# OSX default compiler
CC = clang
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# FreeBSD default compiler
CC = clang
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# Define RPI cross-compiler
#CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# HTML5 emscripten compiler
CC = emcc
endif
# Define default make program: Mingw32-make
MAKE = mingw32-make
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX)
MAKE = make
endif
endif
# Define compiler flags:
# -O1 defines optimization level
# -g enable debugging
# -s strip unnecessary data from build # -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
# Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS = -O2 -s -Wall -std=c99 # resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE CFLAGS += -no-pie -D_DEFAULT_SOURCE
endif
ifeq ($(PLATFORM_OS),OSX)
CFLAGS = -O2 -s -Wall -std=c99
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS += -std=gnu99
endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 -s TOTAL_MEMORY=33554432 --profiling --preload-file resources # -O2 # if used, also set --memory-init-file 0
# -O2 # if used, also set --memory-init-file 0 # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s USE_PTHREADS=1 # multithreading support
# --preload-file file.res # embbed file.res resource into .data file # -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly)
# --preload-file resources # specify a resources folder for data compilation
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 --profiling --preload-file resources
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
EXT = .html
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define raylib release directory for compiled library # Define include paths for required headers
# NOTE: Several external required libraries (stb and others)
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
# Define additional directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI requried libraries
INCLUDE_PATHS += -I/opt/vc/include
INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux
INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
endif
# Define library paths containing required libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),FREEBSD)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32 INCLUDE_PATHS += -I/usr/local/include
endif LDFLAGS += -L. -Lsrc -L/usr/local/lib
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
endif
# define any directories containing required header files
INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads LDFLAGS += -L/opt/vc/lib
endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# external libraries headers
# GLFW3
INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
# OpenAL Soft
INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
endif
ifeq ($(PLATFORM_OS),LINUX)
# you may optionally create this directory and install raylib
# and related headers there. Edit ../src/Makefile appropriately.
INCLUDES += -I/usr/local/include/raylib
endif
ifeq ($(PLATFORM_OS),OSX)
# additional directories for MacOS
endif
endif endif
# define library paths containing required libs # Define any libraries required on linking
LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS += -L/opt/vc/lib
endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# add standard directories for GNU/Linux
ifeq ($(PLATFORM_OS),WINDOWS)
# external libraries to link with
# GLFW3
LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
# OpenAL Soft
LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
endif
endif
# define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compilation
LDLIBS = -lraylib -lopengl32 -lgdi32
endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# libraries for Debian GNU/Linux desktop compiling # Libraries for Debian GNU/Linux desktop compiling
# requires the following packages: # NOTE: Required packages: libegl1-mesa-dev
# libglfw3-dev libopenal-dev libegl1-mesa-dev LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
# on XWindow requires also below libraries # On X11 requires also below libraries
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LDLIBS += -lX11
else # NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
ifeq ($(PLATFORM_OS),OSX) #LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
# libraries for OSX 10.9 desktop compiling
# requires the following packages: # On Wayland windowing system, additional libraries requires
# libglfw3-dev libopenal-dev libegl1-mesa-dev ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
else
# libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# if static OpenAL Soft required, define the corresponding libs
ifeq ($(SHARED_OPENAL),NO)
LIBS += -lopenal32 -lwinmm
CFLAGS += -Wl,-allow-multiple-definition
else
LIBS += -lopenal32dll
endif endif
endif endif
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# Libraries for FreeBSD desktop compiling
# NOTE: Required packages: mesa-libs
LDLIBS = -lraylib -lGL -lpthread -lm
# On XWindow requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
# NOTE: It could require additional packages installed: libglfw3-dev
LDLIBS += -lglfw
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# libraries for Raspberry Pi compiling # Libraries for Raspberry Pi compiling
# NOTE: OpenAL Soft library should be installed (libopenal1 package) # NOTE: Required packages: libasound2-dev (ALSA)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# NOTE: Set the correct path to libraylib.bc # Libraries for web (HTML5) compiling
LIBS = $(RAYLIB_RELEASE)/libraylib.bc LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc
endif endif
# define additional parameters and flags for windows # Define all source files required
ifeq ($(PLATFORM_OS),WINDOWS) SCREENS = drturtle_final_web \
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
WINFLAGS = $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif
# define all screen object files required
SCREENS = \
# typing 'make' will invoke the default target entry # typing 'make' will invoke the default target entry
default: drturtle all: $(SCREENS)
# compile program %: %.c
drturtle: drturtle_final_web.c $(SCREENS) ifeq ($(PLATFORM),PLATFORM_ANDROID)
$(CC) -o $@$(EXT) $^ $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) $(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$<
else
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
endif
# clean everything # Clean everything
clean: clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
del *.o *.exe /s
endif
ifeq ($(PLATFORM_OS),LINUX)
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete find . -type f -perm +ugo+x -delete
rm -f *.o rm -f *.o
else
ifeq ($(PLATFORM_OS),LINUX)
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
else
del *.o *.exe /s
endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
@@ -251,7 +296,3 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
@echo Cleaning done @echo Cleaning done
# instead of defining every module one by one, we can define a pattern
# this pattern below will automatically compile every module defined on $(OBJS)
#%.exe : %.c
# $(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM)

View File

@@ -13,10 +13,6 @@
#include "raylib.h" #include "raylib.h"
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -72,19 +68,11 @@ static void UpdateDrawFrame(void); // Update and Draw (one frame)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: floppy"); InitWindow(screenWidth, screenHeight, "sample game: floppy");
#endif
InitGame(); InitGame();
@@ -111,9 +99,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module Functions Definitions (local) // Module Functions Definitions (local)
@@ -250,4 +237,4 @@ void UpdateDrawFrame(void)
{ {
UpdateGame(); UpdateGame();
DrawGame(); DrawGame();
} }

View File

@@ -13,10 +13,6 @@
#include "raylib.h" #include "raylib.h"
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -81,19 +77,11 @@ static void UpdateDrawFrame(void); // Update and Draw (one frame)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: gold fever"); InitWindow(screenWidth, screenHeight, "sample game: gold fever");
#endif
InitGame(); InitGame();
@@ -120,9 +108,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -291,4 +278,4 @@ void UpdateDrawFrame(void)
{ {
UpdateGame(); UpdateGame();
DrawGame(); DrawGame();
} }

View File

@@ -18,10 +18,6 @@
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -120,19 +116,11 @@ static bool UpdateBall(int playerTurn);
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: gorilas"); InitWindow(screenWidth, screenHeight, "sample game: gorilas");
#endif
InitGame(); InitGame();
@@ -159,9 +147,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -576,4 +563,4 @@ static bool UpdateBall(int playerTurn)
} }
return false; return false;
} }

View File

@@ -2,7 +2,7 @@
# #
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# #
# Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2018 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software. # will the authors be held liable for any damages arising from the use of this software.
@@ -29,72 +29,87 @@ PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH ?= ..\.. RAYLIB_PATH ?= ..\..
PROJECT_NAME ?= just_do PROJECT_NAME ?= just_do
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Default path for raylib on Raspberry Pi, if installed in different path, update it!
# NOTE: Libraries should be provided in the selected form ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_PATH ?= /home/pi/raylib
OPENAL_LIBTYPE ?= STATIC
# On PLATFORM_WEB force OpenAL Soft shared library
ifeq ($(PLATFORM),PLATFORM_WEB)
OPENAL_LIBTYPE = SHARED
endif endif
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC
# Use external GLFW library instead of rglfw module
USE_EXTERNAL_GLFW ?= FALSE
# Use Wayland display server protocol on Linux desktop
# by default it uses X11 windowing system
USE_WAYLAND_DISPLAY ?= FALSE
# NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile)
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
LIBPATH=win32
else else
UNAMEOS=$(shell uname) UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX PLATFORM_OS=LINUX
LIBPATH=linux endif
else ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS=FREEBSD
endif
ifeq ($(UNAMEOS),Darwin) ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX PLATFORM_OS=OSX
LIBPATH=osx
endif
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI cross-compiler UNAMEOS=$(shell uname)
RPI_CROSS_COMPILE ?= NO ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH = C:/emsdk EMSDK_PATH = C:/emsdk
EMSCRIPTEN_VERSION = 1.37.21 EMSCRIPTEN_VERSION = 1.37.28
CLANG_VERSION=e1.37.21_64bit CLANG_VERSION=e1.37.28_64bit
PYTHON_VERSION=2.7.5.3_64bit PYTHON_VERSION=2.7.5.3_64bit
NODE_VERSION=4.1.1_64bit NODE_VERSION=4.1.1_64bit
export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
endif endif
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs
# Define raylib release directory for compiled library # Define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/win32/mingw32 RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/linux RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/osx RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
endif
ifeq ($(PLATFORM_OS),FREEBSD)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/rpi RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5
endif endif
# Define default C compiler: gcc # Define default C compiler: gcc
# NOTE: define g++ compiler if using C++
CC = gcc CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@@ -102,11 +117,16 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# OSX default compiler # OSX default compiler
CC = clang CC = clang
endif endif
ifeq ($(PLATFORM_OS),FREEBSD)
# FreeBSD default compiler
CC = clang
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES) ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# RPI cross-compiler # Define RPI cross-compiler
CC = armv6j-hardfloat-linux-gnueabi-gcc #CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
@@ -125,19 +145,23 @@ endif
# Define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
# -Og enable debugging # -g enable debugging
# -s strip unnecessary data from build # -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
# Additional flags for compiler (if desired) # Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
CFLAGS += -no-pie -D_DEFAULT_SOURCE CFLAGS += -no-pie -D_DEFAULT_SOURCE
endif endif
@@ -151,7 +175,13 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s USE_PTHREADS=1 # multithreading support # -s USE_PTHREADS=1 # multithreading support
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling -s TOTAL_MEMORY=16777216 --preload-file resources # -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly)
# --preload-file resources # specify a resources folder for data compilation
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 --profiling --preload-file resources
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
EXT = .html
endif endif
# Define include paths for required headers # Define include paths for required headers
@@ -167,7 +197,14 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
# Define library paths containing required libs # Define library paths containing required libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),FREEBSD)
INCLUDE_PATHS += -I/usr/local/include
LDFLAGS += -L. -Lsrc -L/usr/local/lib
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L/opt/vc/lib LDFLAGS += -L/opt/vc/lib
@@ -177,54 +214,50 @@ endif
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compiling # Libraries for Windows desktop compilation
# NOTE: GLFW3 and OpenAL Soft libraries should be installed LDLIBS = -lraylib -lopengl32 -lgdi32
LDLIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# Define required flags and libs for OpenAL Soft STATIC/SHARED usage
# NOTE: ALLIBS flag only required for raylib Win32 SHARED library building
ifeq ($(OPENAL_LIBTYPE),STATIC)
LDLIBS += -lopenal32 -lwinmm
CFLAGS += -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition
else
LDLIBS += -lopenal32dll
endif
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling # Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libegl1-mesa-dev
LDLIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
# On XWindow requires also below libraries # On X11 requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LDLIBS += -lX11
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
# On Wayland windowing system, additional libraries requires
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
endif
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling # Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# Libraries for FreeBSD desktop compiling
# NOTE: Required packages: mesa-libs
LDLIBS = -lraylib -lGL -lpthread -lm
# On XWindow requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
# NOTE: It could require additional packages installed: libglfw3-dev
LDLIBS += -lglfw
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# Libraries for Raspberry Pi compiling # Libraries for Raspberry Pi compiling
# NOTE: Required packages: libopenal1 # NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Libraries for web (HTML5) compiling # Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE)/libraylib.bc LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc
endif
# Define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains raylib icon for windows .exe
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
# Define output extension to generate a .html file using provided shell
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# Define all source files required # Define all source files required

View File

@@ -53,26 +53,21 @@ APP_COMPANY_NAME ?= raylib
APP_PRODUCT_NAME ?= rgame APP_PRODUCT_NAME ?= rgame
APP_VERSION_CODE ?= 1 APP_VERSION_CODE ?= 1
APP_VERSION_NAME ?= 1.0 APP_VERSION_NAME ?= 1.0
APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\logo36x36.png APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\raylib_36x36.png
APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\logo48x48.png APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\raylib_48x48.png
APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\logo72x72.png APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\raylib_72x72.png
APP_SCREEN_ORIENTATION ?= landscape APP_SCREEN_ORIENTATION ?= landscape
APP_KEYSTORE_PASS ?= raylib APP_KEYSTORE_PASS ?= raylib
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_LIBTYPE ?= STATIC
OPENAL_LIBTYPE ?= STATIC
RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
OPENAL_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
# Shared libs must be added to APK if required # Shared libs must be added to APK if required
# NOTE: Generated NativeLoader.java automatically load those libraries # NOTE: Generated NativeLoader.java automatically load those libraries
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so
endif endif
ifeq ($(OPENAL_LIBTYPE),SHARED)
PROJECT_SHARED_LIBS += lib/armeabi-v7a/libopenal.so
endif
# Compiler and archiver # Compiler and archiver
# NOTE: GCC is being deprectated in Android NDK r16 # NOTE: GCC is being deprectated in Android NDK r16
@@ -101,7 +96,7 @@ LDFLAGS += -L. -L$(PROJECT_BUILD_PATH)/obj -L$(PROJECT_BUILD_PATH)/lib/armeabi-v
# Define any libraries to link into executable # Define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
LDLIBS = -lraylib -lnative_app_glue -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm -ldl LDLIBS = -lraylib -lnative_app_glue -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm -ldl
# Generate target objects list from PROJECT_SOURCE_FILES # Generate target objects list from PROJECT_SOURCE_FILES
OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES)) OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES))
@@ -154,15 +149,9 @@ copy_project_required_libs:
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so
endif endif
ifeq ($(OPENAL_LIBTYPE),SHARED)
copy /Y $(OPENAL_LIB_PATH)\libopenal.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.so
endif
ifeq ($(RAYLIB_LIBTYPE),STATIC) ifeq ($(RAYLIB_LIBTYPE),STATIC)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a
endif endif
ifeq ($(OPENAL_LIBTYPE),STATIC)
copy /Y $(OPENAL_LIB_PATH)\libopenal.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.a
endif
# Copy project required resources: strings.xml, icon.png, assets # Copy project required resources: strings.xml, icon.png, assets
# NOTE: Required strings.xml is generated and game resources are copied to assets folder # NOTE: Required strings.xml is generated and game resources are copied to assets folder
@@ -182,9 +171,6 @@ generate_loader_script:
@echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
ifeq ($(OPENAL_LIBTYPE),SHARED)
@echo System.loadLibrary("openal"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
endif
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
@echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
endif endif

View File

@@ -16,10 +16,6 @@
#include "raylib.h" #include "raylib.h"
#include "screens/screens.h" // NOTE: Defines currentScreen #include "screens/screens.h" // NOTE: Defines currentScreen
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -53,19 +49,11 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Main entry point // Main entry point
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "GGJ15 - JUST DO"); InitWindow(screenWidth, screenHeight, "GGJ15 - JUST DO");
#endif
// Load global data here (assets that must be available in all screens, i.e. fonts) // Load global data here (assets that must be available in all screens, i.e. fonts)
InitAudioDevice(); InitAudioDevice();
@@ -104,9 +92,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@@ -370,4 +357,4 @@ void UpdateDrawFrame(void)
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }

View File

@@ -2,7 +2,7 @@
# #
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# #
# Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2018 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software. # will the authors be held liable for any damages arising from the use of this software.
@@ -29,72 +29,87 @@ PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH ?= ..\.. RAYLIB_PATH ?= ..\..
PROJECT_NAME ?= koala_seasons PROJECT_NAME ?= koala_seasons
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Default path for raylib on Raspberry Pi, if installed in different path, update it!
# NOTE: Libraries should be provided in the selected form ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_PATH ?= /home/pi/raylib
OPENAL_LIBTYPE ?= STATIC
# On PLATFORM_WEB force OpenAL Soft shared library
ifeq ($(PLATFORM),PLATFORM_WEB)
OPENAL_LIBTYPE = SHARED
endif endif
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC
# Use external GLFW library instead of rglfw module
USE_EXTERNAL_GLFW ?= FALSE
# Use Wayland display server protocol on Linux desktop
# by default it uses X11 windowing system
USE_WAYLAND_DISPLAY ?= FALSE
# NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile)
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
LIBPATH=win32
else else
UNAMEOS=$(shell uname) UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX PLATFORM_OS=LINUX
LIBPATH=linux endif
else ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS=FREEBSD
endif
ifeq ($(UNAMEOS),Darwin) ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX PLATFORM_OS=OSX
LIBPATH=osx
endif
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI cross-compiler UNAMEOS=$(shell uname)
RPI_CROSS_COMPILE ?= NO ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH = C:/emsdk EMSDK_PATH = C:/emsdk
EMSCRIPTEN_VERSION = 1.37.21 EMSCRIPTEN_VERSION = 1.37.28
CLANG_VERSION=e1.37.21_64bit CLANG_VERSION=e1.37.28_64bit
PYTHON_VERSION=2.7.5.3_64bit PYTHON_VERSION=2.7.5.3_64bit
NODE_VERSION=4.1.1_64bit NODE_VERSION=4.1.1_64bit
export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
endif endif
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs
# Define raylib release directory for compiled library # Define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/win32/mingw32 RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/linux RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/osx RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
endif
ifeq ($(PLATFORM_OS),FREEBSD)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/rpi RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5
endif endif
# Define default C compiler: gcc # Define default C compiler: gcc
# NOTE: define g++ compiler if using C++
CC = gcc CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@@ -102,11 +117,16 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# OSX default compiler # OSX default compiler
CC = clang CC = clang
endif endif
ifeq ($(PLATFORM_OS),FREEBSD)
# FreeBSD default compiler
CC = clang
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES) ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# RPI cross-compiler # Define RPI cross-compiler
CC = armv6j-hardfloat-linux-gnueabi-gcc #CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
@@ -125,19 +145,23 @@ endif
# Define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
# -Og enable debugging # -g enable debugging
# -s strip unnecessary data from build # -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
# Additional flags for compiler (if desired) # Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
CFLAGS += -no-pie -D_DEFAULT_SOURCE CFLAGS += -no-pie -D_DEFAULT_SOURCE
endif endif
@@ -151,7 +175,13 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s USE_PTHREADS=1 # multithreading support # -s USE_PTHREADS=1 # multithreading support
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling -s TOTAL_MEMORY=16777216 --preload-file resources # -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly)
# --preload-file resources # specify a resources folder for data compilation
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 --profiling --preload-file resources
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
EXT = .html
endif endif
# Define include paths for required headers # Define include paths for required headers
@@ -167,7 +197,14 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
# Define library paths containing required libs # Define library paths containing required libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),FREEBSD)
INCLUDE_PATHS += -I/usr/local/include
LDFLAGS += -L. -Lsrc -L/usr/local/lib
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L/opt/vc/lib LDFLAGS += -L/opt/vc/lib
@@ -177,54 +214,50 @@ endif
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compiling # Libraries for Windows desktop compilation
# NOTE: GLFW3 and OpenAL Soft libraries should be installed LDLIBS = -lraylib -lopengl32 -lgdi32
LDLIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# Define required flags and libs for OpenAL Soft STATIC/SHARED usage
# NOTE: ALLIBS flag only required for raylib Win32 SHARED library building
ifeq ($(OPENAL_LIBTYPE),STATIC)
LDLIBS += -lopenal32 -lwinmm
CFLAGS += -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition
else
LDLIBS += -lopenal32dll
endif
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling # Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libegl1-mesa-dev
LDLIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
# On XWindow requires also below libraries # On X11 requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LDLIBS += -lX11
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
# On Wayland windowing system, additional libraries requires
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
endif
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling # Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# Libraries for FreeBSD desktop compiling
# NOTE: Required packages: mesa-libs
LDLIBS = -lraylib -lGL -lpthread -lm
# On XWindow requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
# NOTE: It could require additional packages installed: libglfw3-dev
LDLIBS += -lglfw
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# Libraries for Raspberry Pi compiling # Libraries for Raspberry Pi compiling
# NOTE: Required packages: libopenal1 # NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Libraries for web (HTML5) compiling # Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE)/libraylib.bc LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc
endif
# Define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains raylib icon for windows .exe
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
# Define output extension to generate a .html file using provided shell
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# Define all source files required # Define all source files required

View File

@@ -53,26 +53,21 @@ APP_COMPANY_NAME ?= raylib
APP_PRODUCT_NAME ?= rgame APP_PRODUCT_NAME ?= rgame
APP_VERSION_CODE ?= 1 APP_VERSION_CODE ?= 1
APP_VERSION_NAME ?= 1.0 APP_VERSION_NAME ?= 1.0
APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\logo36x36.png APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\raylib_36x36.png
APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\logo48x48.png APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\raylib_48x48.png
APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\logo72x72.png APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\raylib_72x72.png
APP_SCREEN_ORIENTATION ?= landscape APP_SCREEN_ORIENTATION ?= landscape
APP_KEYSTORE_PASS ?= raylib APP_KEYSTORE_PASS ?= raylib
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_LIBTYPE ?= STATIC
OPENAL_LIBTYPE ?= STATIC
RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
OPENAL_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
# Shared libs must be added to APK if required # Shared libs must be added to APK if required
# NOTE: Generated NativeLoader.java automatically load those libraries # NOTE: Generated NativeLoader.java automatically load those libraries
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so
endif endif
ifeq ($(OPENAL_LIBTYPE),SHARED)
PROJECT_SHARED_LIBS += lib/armeabi-v7a/libopenal.so
endif
# Compiler and archiver # Compiler and archiver
# NOTE: GCC is being deprectated in Android NDK r16 # NOTE: GCC is being deprectated in Android NDK r16
@@ -101,7 +96,7 @@ LDFLAGS += -L. -L$(PROJECT_BUILD_PATH)/obj -L$(PROJECT_BUILD_PATH)/lib/armeabi-v
# Define any libraries to link into executable # Define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
LDLIBS = -lraylib -lnative_app_glue -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm -ldl LDLIBS = -lraylib -lnative_app_glue -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm -ldl
# Generate target objects list from PROJECT_SOURCE_FILES # Generate target objects list from PROJECT_SOURCE_FILES
OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES)) OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES))
@@ -154,15 +149,9 @@ copy_project_required_libs:
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so
endif endif
ifeq ($(OPENAL_LIBTYPE),SHARED)
copy /Y $(OPENAL_LIB_PATH)\libopenal.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.so
endif
ifeq ($(RAYLIB_LIBTYPE),STATIC) ifeq ($(RAYLIB_LIBTYPE),STATIC)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a
endif endif
ifeq ($(OPENAL_LIBTYPE),STATIC)
copy /Y $(OPENAL_LIB_PATH)\libopenal.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.a
endif
# Copy project required resources: strings.xml, icon.png, assets # Copy project required resources: strings.xml, icon.png, assets
# NOTE: Required strings.xml is generated and game resources are copied to assets folder # NOTE: Required strings.xml is generated and game resources are copied to assets folder
@@ -182,9 +171,6 @@ generate_loader_script:
@echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
ifeq ($(OPENAL_LIBTYPE),SHARED)
@echo System.loadLibrary("openal"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
endif
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
@echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
endif endif

View File

@@ -15,10 +15,6 @@
#include "raylib.h" #include "raylib.h"
#include "screens/screens.h" // NOTE: Defines currentScreen #include "screens/screens.h" // NOTE: Defines currentScreen
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -47,12 +43,7 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Main entry point // Main entry point
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID) int main(void) {
void android_main(struct android_app *app)
#else
int main(void)
#endif
{
// Initialization // Initialization
//--------------------------------------------------------- //---------------------------------------------------------
const int screenWidth = 1280; const int screenWidth = 1280;
@@ -62,11 +53,8 @@ int main(void)
//ShowLogo(); //ShowLogo();
//SetConfigFlags(FLAG_FULLSCREEN_MODE); //SetConfigFlags(FLAG_FULLSCREEN_MODE);
#if defined(PLATFORM_ANDROID) // Note that windowTitle is ignored on Android
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, windowTitle); InitWindow(screenWidth, screenHeight, windowTitle);
#endif
// Load global data here (assets that must be available in all screens, i.e. fonts) // Load global data here (assets that must be available in all screens, i.e. fonts)
font = LoadSpriteFont("resources/graphics/mainfont.png"); font = LoadSpriteFont("resources/graphics/mainfont.png");
@@ -145,9 +133,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
void TransitionToScreen(int screen) void TransitionToScreen(int screen)
@@ -282,4 +269,4 @@ void UpdateDrawFrame(void)
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 899 KiB

After

Width:  |  Height:  |  Size: 994 KiB

View File

@@ -6,7 +6,7 @@ attribute vec2 vertexTexCoord;
attribute vec4 vertexColor; attribute vec4 vertexColor;
// Input uniform values // Input uniform values
uniform mat4 mvpMatrix; uniform mat4 mvp;
// Output vertex attributes (to fragment shader) // Output vertex attributes (to fragment shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
@@ -21,5 +21,5 @@ void main()
fragColor = vertexColor; fragColor = vertexColor;
// Calculate final vertex position // Calculate final vertex position
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); gl_Position = mvp*vec4(vertexPosition, 1.0);
} }

View File

@@ -858,8 +858,8 @@ void DrawTitleScreen(void)
DrawTexturePro(atlas02, gameplay_background, (Rectangle){0, 0, gameplay_background.width*2, gameplay_background.height*2}, (Vector2){0, 0}, 0, color02); DrawTexturePro(atlas02, gameplay_background, (Rectangle){0, 0, gameplay_background.width*2, gameplay_background.height*2}, (Vector2){0, 0}, 0, color02);
// Draw parallax // Draw parallax
//DrawParallaxBack(); DrawParallaxBack();
//DrawParallaxMiddle(); DrawParallaxMiddle();
for (int i = 0; i < MAX_particle; i++) for (int i = 0; i < MAX_particle; i++)
{ {
@@ -984,8 +984,6 @@ void DrawTitleScreen(void)
if (musicActive)DrawTexturePro(atlas01, title_speaker_on, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_on.width, title_speaker_on.height}, (Vector2){0,0}, 0, WHITE); if (musicActive)DrawTexturePro(atlas01, title_speaker_on, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_on.width, title_speaker_on.height}, (Vector2){0,0}, 0, WHITE);
else DrawTexturePro(atlas01, title_speaker_off, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_off.width, title_speaker_off.height}, (Vector2){0,0}, 0, WHITE); else DrawTexturePro(atlas01, title_speaker_off, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_off.width, title_speaker_off.height}, (Vector2){0,0}, 0, WHITE);
*/ */
DrawParallaxFront();
} }
// Title Screen Unload logic // Title Screen Unload logic
@@ -1003,10 +1001,7 @@ int FinishTitleScreen(void)
static void DrawParallaxFront(void) static void DrawParallaxFront(void)
{ {
Rectangle ground01 = gameplay_back_ground01; Rectangle ground01 = gameplay_back_ground01;
DrawTexturePro(atlas02, gameplay_back_tree01_layer01, (Rectangle){0, 0, gameplay_back_tree01_layer01.width*2, gameplay_back_tree01_layer01.height*2}, (Vector2){0,0}, 0, WHITE);
/*
//DrawTexturePro(atlas02, gameplay_back_tree01_layer03, (Rectangle){0, 21, gameplay_back_tree01_layer03.width*2, gameplay_back_tree01_layer03.height*2}, (Vector2){0,0}, 0, color02); //DrawTexturePro(atlas02, gameplay_back_tree01_layer03, (Rectangle){0, 21, gameplay_back_tree01_layer03.width*2, gameplay_back_tree01_layer03.height*2}, (Vector2){0,0}, 0, color02);
DrawTexturePro(atlas02, gameplay_back_tree01_layer01, (Rectangle){(int)parallaxFrontOffset, 60, gameplay_back_tree01_layer01.width*2, gameplay_back_tree01_layer01.height*2}, (Vector2){0,0}, 0, color02); DrawTexturePro(atlas02, gameplay_back_tree01_layer01, (Rectangle){(int)parallaxFrontOffset, 60, gameplay_back_tree01_layer01.width*2, gameplay_back_tree01_layer01.height*2}, (Vector2){0,0}, 0, color02);
DrawTexturePro(atlas02, gameplay_back_tree02_layer01, (Rectangle){(int)parallaxFrontOffset + 140, 60, gameplay_back_tree02_layer01.width*2, gameplay_back_tree02_layer01.height*2}, (Vector2){0,0}, 0, color02); DrawTexturePro(atlas02, gameplay_back_tree02_layer01, (Rectangle){(int)parallaxFrontOffset + 140, 60, gameplay_back_tree02_layer01.width*2, gameplay_back_tree02_layer01.height*2}, (Vector2){0,0}, 0, color02);
@@ -1018,7 +1013,6 @@ static void DrawParallaxFront(void)
DrawTexturePro(atlas02, gameplay_back_tree08_layer01, (Rectangle){(int)parallaxFrontOffset + 140*7, 60, gameplay_back_tree08_layer01.width*2, gameplay_back_tree08_layer01.height*2}, (Vector2){0,0}, 0, color02); DrawTexturePro(atlas02, gameplay_back_tree08_layer01, (Rectangle){(int)parallaxFrontOffset + 140*7, 60, gameplay_back_tree08_layer01.width*2, gameplay_back_tree08_layer01.height*2}, (Vector2){0,0}, 0, color02);
DrawTexturePro(atlas02, gameplay_back_ground01, (Rectangle){0, 559, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01); DrawTexturePro(atlas02, gameplay_back_ground01, (Rectangle){0, 559, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
DrawTexturePro(atlas02, (Rectangle){ground01.x, ground01.y + ground01.height, ground01.width, -ground01.height}, (Rectangle){0, -33, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01); DrawTexturePro(atlas02, (Rectangle){ground01.x, ground01.y + ground01.height, ground01.width, -ground01.height}, (Rectangle){0, -33, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
*/
} }
static void DrawParallaxMiddle(void) static void DrawParallaxMiddle(void)

View File

@@ -2,7 +2,7 @@
# #
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# #
# Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2018 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software. # will the authors be held liable for any damages arising from the use of this software.
@@ -29,72 +29,87 @@ PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH ?= ..\.. RAYLIB_PATH ?= ..\..
PROJECT_NAME ?= light_my_ritual PROJECT_NAME ?= light_my_ritual
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Default path for raylib on Raspberry Pi, if installed in different path, update it!
# NOTE: Libraries should be provided in the selected form ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_PATH ?= /home/pi/raylib
OPENAL_LIBTYPE ?= STATIC
# On PLATFORM_WEB force OpenAL Soft shared library
ifeq ($(PLATFORM),PLATFORM_WEB)
OPENAL_LIBTYPE = SHARED
endif endif
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC
# Use external GLFW library instead of rglfw module
USE_EXTERNAL_GLFW ?= FALSE
# Use Wayland display server protocol on Linux desktop
# by default it uses X11 windowing system
USE_WAYLAND_DISPLAY ?= FALSE
# NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile)
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
LIBPATH=win32
else else
UNAMEOS=$(shell uname) UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX PLATFORM_OS=LINUX
LIBPATH=linux endif
else ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS=FREEBSD
endif
ifeq ($(UNAMEOS),Darwin) ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX PLATFORM_OS=OSX
LIBPATH=osx
endif
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI cross-compiler UNAMEOS=$(shell uname)
RPI_CROSS_COMPILE ?= NO ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH = C:/emsdk EMSDK_PATH = C:/emsdk
EMSCRIPTEN_VERSION = 1.37.21 EMSCRIPTEN_VERSION = 1.37.28
CLANG_VERSION=e1.37.21_64bit CLANG_VERSION=e1.37.28_64bit
PYTHON_VERSION=2.7.5.3_64bit PYTHON_VERSION=2.7.5.3_64bit
NODE_VERSION=4.1.1_64bit NODE_VERSION=4.1.1_64bit
export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
endif endif
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs
# Define raylib release directory for compiled library # Define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/win32/mingw32 RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/linux RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/osx RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
endif
ifeq ($(PLATFORM_OS),FREEBSD)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/rpi RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5
endif endif
# Define default C compiler: gcc # Define default C compiler: gcc
# NOTE: define g++ compiler if using C++
CC = gcc CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@@ -102,11 +117,16 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# OSX default compiler # OSX default compiler
CC = clang CC = clang
endif endif
ifeq ($(PLATFORM_OS),FREEBSD)
# FreeBSD default compiler
CC = clang
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES) ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# RPI cross-compiler # Define RPI cross-compiler
CC = armv6j-hardfloat-linux-gnueabi-gcc #CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
@@ -125,19 +145,23 @@ endif
# Define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
# -Og enable debugging # -g enable debugging
# -s strip unnecessary data from build # -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
# Additional flags for compiler (if desired) # Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
CFLAGS += -no-pie -D_DEFAULT_SOURCE CFLAGS += -no-pie -D_DEFAULT_SOURCE
endif endif
@@ -151,7 +175,13 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s USE_PTHREADS=1 # multithreading support # -s USE_PTHREADS=1 # multithreading support
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling -s TOTAL_MEMORY=16777216 --preload-file resources # -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly)
# --preload-file resources # specify a resources folder for data compilation
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 --profiling --preload-file resources
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
EXT = .html
endif endif
# Define include paths for required headers # Define include paths for required headers
@@ -167,7 +197,14 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
# Define library paths containing required libs # Define library paths containing required libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),FREEBSD)
INCLUDE_PATHS += -I/usr/local/include
LDFLAGS += -L. -Lsrc -L/usr/local/lib
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L/opt/vc/lib LDFLAGS += -L/opt/vc/lib
@@ -177,54 +214,50 @@ endif
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compiling # Libraries for Windows desktop compilation
# NOTE: GLFW3 and OpenAL Soft libraries should be installed LDLIBS = -lraylib -lopengl32 -lgdi32
LDLIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# Define required flags and libs for OpenAL Soft STATIC/SHARED usage
# NOTE: ALLIBS flag only required for raylib Win32 SHARED library building
ifeq ($(OPENAL_LIBTYPE),STATIC)
LDLIBS += -lopenal32 -lwinmm
CFLAGS += -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition
else
LDLIBS += -lopenal32dll
endif
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling # Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libegl1-mesa-dev
LDLIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
# On XWindow requires also below libraries # On X11 requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LDLIBS += -lX11
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
# On Wayland windowing system, additional libraries requires
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
endif
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling # Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# Libraries for FreeBSD desktop compiling
# NOTE: Required packages: mesa-libs
LDLIBS = -lraylib -lGL -lpthread -lm
# On XWindow requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
# NOTE: It could require additional packages installed: libglfw3-dev
LDLIBS += -lglfw
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# Libraries for Raspberry Pi compiling # Libraries for Raspberry Pi compiling
# NOTE: Required packages: libopenal1 # NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Libraries for web (HTML5) compiling # Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE)/libraylib.bc LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc
endif
# Define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains raylib icon for windows .exe
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
# Define output extension to generate a .html file using provided shell
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# Define all source files required # Define all source files required

View File

@@ -53,26 +53,21 @@ APP_COMPANY_NAME ?= raylib
APP_PRODUCT_NAME ?= rgame APP_PRODUCT_NAME ?= rgame
APP_VERSION_CODE ?= 1 APP_VERSION_CODE ?= 1
APP_VERSION_NAME ?= 1.0 APP_VERSION_NAME ?= 1.0
APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\logo36x36.png APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\raylib_36x36.png
APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\logo48x48.png APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\raylib_48x48.png
APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\logo72x72.png APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\raylib_72x72.png
APP_SCREEN_ORIENTATION ?= landscape APP_SCREEN_ORIENTATION ?= landscape
APP_KEYSTORE_PASS ?= raylib APP_KEYSTORE_PASS ?= raylib
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_LIBTYPE ?= STATIC
OPENAL_LIBTYPE ?= STATIC
RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
OPENAL_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
# Shared libs must be added to APK if required # Shared libs must be added to APK if required
# NOTE: Generated NativeLoader.java automatically load those libraries # NOTE: Generated NativeLoader.java automatically load those libraries
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so
endif endif
ifeq ($(OPENAL_LIBTYPE),SHARED)
PROJECT_SHARED_LIBS += lib/armeabi-v7a/libopenal.so
endif
# Compiler and archiver # Compiler and archiver
# NOTE: GCC is being deprectated in Android NDK r16 # NOTE: GCC is being deprectated in Android NDK r16
@@ -101,7 +96,7 @@ LDFLAGS += -L. -L$(PROJECT_BUILD_PATH)/obj -L$(PROJECT_BUILD_PATH)/lib/armeabi-v
# Define any libraries to link into executable # Define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
LDLIBS = -lraylib -lnative_app_glue -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm -ldl LDLIBS = -lraylib -lnative_app_glue -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm -ldl
# Generate target objects list from PROJECT_SOURCE_FILES # Generate target objects list from PROJECT_SOURCE_FILES
OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES)) OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES))
@@ -154,15 +149,9 @@ copy_project_required_libs:
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so
endif endif
ifeq ($(OPENAL_LIBTYPE),SHARED)
copy /Y $(OPENAL_LIB_PATH)\libopenal.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.so
endif
ifeq ($(RAYLIB_LIBTYPE),STATIC) ifeq ($(RAYLIB_LIBTYPE),STATIC)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a
endif endif
ifeq ($(OPENAL_LIBTYPE),STATIC)
copy /Y $(OPENAL_LIB_PATH)\libopenal.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.a
endif
# Copy project required resources: strings.xml, icon.png, assets # Copy project required resources: strings.xml, icon.png, assets
# NOTE: Required strings.xml is generated and game resources are copied to assets folder # NOTE: Required strings.xml is generated and game resources are copied to assets folder
@@ -182,9 +171,6 @@ generate_loader_script:
@echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
ifeq ($(OPENAL_LIBTYPE),SHARED)
@echo System.loadLibrary("openal"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
endif
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
@echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
endif endif

View File

@@ -19,10 +19,6 @@
#include <stdlib.h> #include <stdlib.h>
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -55,19 +51,11 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Main entry point // Main entry point
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "GGJ16 - LIGHT MY RITUAL!"); InitWindow(screenWidth, screenHeight, "GGJ16 - LIGHT MY RITUAL!");
#endif
// Global data loading (assets that must be available in all screens, i.e. fonts) // Global data loading (assets that must be available in all screens, i.e. fonts)
InitAudioDevice(); InitAudioDevice();
@@ -129,9 +117,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
void TransitionToScreen(int screen) void TransitionToScreen(int screen)

View File

@@ -18,10 +18,6 @@
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -119,19 +115,11 @@ static void UpdateIncomingFire();
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: missile commander"); InitWindow(screenWidth, screenHeight, "sample game: missile commander");
#endif
InitGame(); InitGame();
@@ -158,9 +146,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -544,4 +531,4 @@ static void UpdateIncomingFire()
missileIndex++; missileIndex++;
if (missileIndex == MAX_MISSILES) missileIndex = 0; if (missileIndex == MAX_MISSILES) missileIndex = 0;
} }
} }

View File

@@ -15,10 +15,6 @@
#include <math.h> #include <math.h>
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -110,19 +106,11 @@ static void UpdateDrawFrame(void); // Update and Draw (one frame)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: pang"); InitWindow(screenWidth, screenHeight, "sample game: pang");
#endif
InitGame(); InitGame();
@@ -149,9 +137,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -637,4 +624,4 @@ void UpdateDrawFrame(void)
{ {
UpdateGame(); UpdateGame();
DrawGame(); DrawGame();
} }

View File

@@ -2,7 +2,7 @@
# #
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# #
# Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2018 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software. # will the authors be held liable for any damages arising from the use of this software.
@@ -29,72 +29,87 @@ PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH ?= ..\.. RAYLIB_PATH ?= ..\..
PROJECT_NAME ?= skully_escape PROJECT_NAME ?= skully_escape
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Default path for raylib on Raspberry Pi, if installed in different path, update it!
# NOTE: Libraries should be provided in the selected form ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_PATH ?= /home/pi/raylib
OPENAL_LIBTYPE ?= STATIC
# On PLATFORM_WEB force OpenAL Soft shared library
ifeq ($(PLATFORM),PLATFORM_WEB)
OPENAL_LIBTYPE = SHARED
endif endif
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC
# Use external GLFW library instead of rglfw module
USE_EXTERNAL_GLFW ?= FALSE
# Use Wayland display server protocol on Linux desktop
# by default it uses X11 windowing system
USE_WAYLAND_DISPLAY ?= FALSE
# NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile)
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
LIBPATH=win32
else else
UNAMEOS=$(shell uname) UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX PLATFORM_OS=LINUX
LIBPATH=linux endif
else ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS=FREEBSD
endif
ifeq ($(UNAMEOS),Darwin) ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX PLATFORM_OS=OSX
LIBPATH=osx
endif
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI cross-compiler UNAMEOS=$(shell uname)
RPI_CROSS_COMPILE ?= NO ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH = C:/emsdk EMSDK_PATH = C:/emsdk
EMSCRIPTEN_VERSION = 1.37.21 EMSCRIPTEN_VERSION = 1.37.28
CLANG_VERSION=e1.37.21_64bit CLANG_VERSION=e1.37.28_64bit
PYTHON_VERSION=2.7.5.3_64bit PYTHON_VERSION=2.7.5.3_64bit
NODE_VERSION=4.1.1_64bit NODE_VERSION=4.1.1_64bit
export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
endif endif
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs
# Define raylib release directory for compiled library # Define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/win32/mingw32 RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/linux RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/osx RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
endif
ifeq ($(PLATFORM_OS),FREEBSD)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/rpi RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5
endif endif
# Define default C compiler: gcc # Define default C compiler: gcc
# NOTE: define g++ compiler if using C++
CC = gcc CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@@ -102,11 +117,16 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# OSX default compiler # OSX default compiler
CC = clang CC = clang
endif endif
ifeq ($(PLATFORM_OS),FREEBSD)
# FreeBSD default compiler
CC = clang
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES) ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# RPI cross-compiler # Define RPI cross-compiler
CC = armv6j-hardfloat-linux-gnueabi-gcc #CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
@@ -125,19 +145,23 @@ endif
# Define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
# -Og enable debugging # -g enable debugging
# -s strip unnecessary data from build # -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
# Additional flags for compiler (if desired) # Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
CFLAGS += -no-pie -D_DEFAULT_SOURCE CFLAGS += -no-pie -D_DEFAULT_SOURCE
endif endif
@@ -151,7 +175,13 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s USE_PTHREADS=1 # multithreading support # -s USE_PTHREADS=1 # multithreading support
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling -s TOTAL_MEMORY=16777216 --preload-file resources # -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly)
# --preload-file resources # specify a resources folder for data compilation
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 --profiling --preload-file resources
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
EXT = .html
endif endif
# Define include paths for required headers # Define include paths for required headers
@@ -167,7 +197,14 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
# Define library paths containing required libs # Define library paths containing required libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),FREEBSD)
INCLUDE_PATHS += -I/usr/local/include
LDFLAGS += -L. -Lsrc -L/usr/local/lib
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L/opt/vc/lib LDFLAGS += -L/opt/vc/lib
@@ -177,54 +214,50 @@ endif
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compiling # Libraries for Windows desktop compilation
# NOTE: GLFW3 and OpenAL Soft libraries should be installed LDLIBS = -lraylib -lopengl32 -lgdi32
LDLIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# Define required flags and libs for OpenAL Soft STATIC/SHARED usage
# NOTE: ALLIBS flag only required for raylib Win32 SHARED library building
ifeq ($(OPENAL_LIBTYPE),STATIC)
LDLIBS += -lopenal32 -lwinmm
CFLAGS += -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition
else
LDLIBS += -lopenal32dll
endif
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling # Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libegl1-mesa-dev
LDLIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
# On XWindow requires also below libraries # On X11 requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LDLIBS += -lX11
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
# On Wayland windowing system, additional libraries requires
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
endif
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling # Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev # NOTE: Required packages: libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# Libraries for FreeBSD desktop compiling
# NOTE: Required packages: mesa-libs
LDLIBS = -lraylib -lGL -lpthread -lm
# On XWindow requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
# NOTE: It could require additional packages installed: libglfw3-dev
LDLIBS += -lglfw
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# Libraries for Raspberry Pi compiling # Libraries for Raspberry Pi compiling
# NOTE: Required packages: libopenal1 # NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Libraries for web (HTML5) compiling # Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE)/libraylib.bc LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc
endif
# Define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains raylib icon for windows .exe
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
# Define output extension to generate a .html file using provided shell
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# Define all source files required # Define all source files required

View File

@@ -53,26 +53,21 @@ APP_COMPANY_NAME ?= raylib
APP_PRODUCT_NAME ?= rgame APP_PRODUCT_NAME ?= rgame
APP_VERSION_CODE ?= 1 APP_VERSION_CODE ?= 1
APP_VERSION_NAME ?= 1.0 APP_VERSION_NAME ?= 1.0
APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\logo36x36.png APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\raylib_36x36.png
APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\logo48x48.png APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\raylib_48x48.png
APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\logo72x72.png APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\raylib_72x72.png
APP_SCREEN_ORIENTATION ?= landscape APP_SCREEN_ORIENTATION ?= landscape
APP_KEYSTORE_PASS ?= raylib APP_KEYSTORE_PASS ?= raylib
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_LIBTYPE ?= STATIC
OPENAL_LIBTYPE ?= STATIC
RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
OPENAL_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
# Shared libs must be added to APK if required # Shared libs must be added to APK if required
# NOTE: Generated NativeLoader.java automatically load those libraries # NOTE: Generated NativeLoader.java automatically load those libraries
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so
endif endif
ifeq ($(OPENAL_LIBTYPE),SHARED)
PROJECT_SHARED_LIBS += lib/armeabi-v7a/libopenal.so
endif
# Compiler and archiver # Compiler and archiver
# NOTE: GCC is being deprectated in Android NDK r16 # NOTE: GCC is being deprectated in Android NDK r16
@@ -101,7 +96,7 @@ LDFLAGS += -L. -L$(PROJECT_BUILD_PATH)/obj -L$(PROJECT_BUILD_PATH)/lib/armeabi-v
# Define any libraries to link into executable # Define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
LDLIBS = -lraylib -lnative_app_glue -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm -ldl LDLIBS = -lraylib -lnative_app_glue -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm -ldl
# Generate target objects list from PROJECT_SOURCE_FILES # Generate target objects list from PROJECT_SOURCE_FILES
OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES)) OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES))
@@ -154,15 +149,9 @@ copy_project_required_libs:
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so
endif endif
ifeq ($(OPENAL_LIBTYPE),SHARED)
copy /Y $(OPENAL_LIB_PATH)\libopenal.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.so
endif
ifeq ($(RAYLIB_LIBTYPE),STATIC) ifeq ($(RAYLIB_LIBTYPE),STATIC)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a
endif endif
ifeq ($(OPENAL_LIBTYPE),STATIC)
copy /Y $(OPENAL_LIB_PATH)\libopenal.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.a
endif
# Copy project required resources: strings.xml, icon.png, assets # Copy project required resources: strings.xml, icon.png, assets
# NOTE: Required strings.xml is generated and game resources are copied to assets folder # NOTE: Required strings.xml is generated and game resources are copied to assets folder
@@ -182,9 +171,6 @@ generate_loader_script:
@echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
ifeq ($(OPENAL_LIBTYPE),SHARED)
@echo System.loadLibrary("openal"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
endif
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
@echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java @echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
endif endif

View File

@@ -14,10 +14,6 @@
#include "player.h" #include "player.h"
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -52,19 +48,11 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Main entry point // Main entry point
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "SKULLY ESCAPE [KING GAMEJAM]"); InitWindow(screenWidth, screenHeight, "SKULLY ESCAPE [KING GAMEJAM]");
#endif
// Global data loading (assets that must be available in all screens, i.e. fonts) // Global data loading (assets that must be available in all screens, i.e. fonts)
InitAudioDevice(); InitAudioDevice();
@@ -112,9 +100,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
void TransitionToScreen(int screen) void TransitionToScreen(int screen)

View File

@@ -13,10 +13,6 @@
#include "raylib.h" #include "raylib.h"
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -73,19 +69,11 @@ static void UpdateDrawFrame(void); // Update and Draw (one frame)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: snake"); InitWindow(screenWidth, screenHeight, "sample game: snake");
#endif
InitGame(); InitGame();
@@ -112,9 +100,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -298,4 +285,4 @@ void UpdateDrawFrame(void)
{ {
UpdateGame(); UpdateGame();
DrawGame(); DrawGame();
} }

View File

@@ -13,10 +13,6 @@
#include "raylib.h" #include "raylib.h"
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -90,19 +86,11 @@ static void UpdateDrawFrame(void); // Update and Draw (one frame)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: space invaders"); InitWindow(screenWidth, screenHeight, "sample game: space invaders");
#endif
InitGame(); InitGame();
@@ -129,9 +117,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -410,4 +397,4 @@ void UpdateDrawFrame(void)
{ {
UpdateGame(); UpdateGame();
DrawGame(); DrawGame();
} }

View File

@@ -18,10 +18,6 @@
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
#if defined(PLATFORM_ANDROID)
#include "android_native_app_glue.h"
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
@@ -109,19 +105,11 @@ static void DeleteCompleteLines();
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#if defined(PLATFORM_ANDROID)
void android_main(struct android_app *app)
#else
int main(void) int main(void)
#endif
{ {
// Initialization // Initialization (Note windowTitle is unused on Android)
//--------------------------------------------------------- //---------------------------------------------------------
#if defined(PLATFORM_ANDROID)
InitWindow(screenWidth, screenHeight, app);
#else
InitWindow(screenWidth, screenHeight, "sample game: tetris"); InitWindow(screenWidth, screenHeight, "sample game: tetris");
#endif
InitGame(); InitGame();
@@ -148,9 +136,8 @@ int main(void)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0; return 0;
#endif
} }
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -841,4 +828,4 @@ static void DeleteCompleteLines()
} }
} }
} }
} }

319
games/transmission/Makefile Normal file
View File

@@ -0,0 +1,319 @@
#**************************************************************************************************
#
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
#
# Copyright (c) 2013-2018 Ramon Santamaria (@raysan5)
#
# This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose, including commercial
# applications, and to alter it and redistribute it freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not claim that you
# wrote the original software. If you use this software in a product, an acknowledgment
# in the product documentation would be appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented
# as being the original software.
#
# 3. This notice may not be removed or altered from any source distribution.
#
#**************************************************************************************************
.PHONY: all clean
# Define required raylib variables
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH ?= ..\..
PROJECT_NAME ?= transmission
# Default path for raylib on Raspberry Pi, if installed in different path, update it!
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_PATH ?= /home/pi/raylib
endif
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC
# Use external GLFW library instead of rglfw module
USE_EXTERNAL_GLFW ?= FALSE
# Use Wayland display server protocol on Linux desktop
# by default it uses X11 windowing system
USE_WAYLAND_DISPLAY ?= FALSE
# NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile)
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS
else
UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS=FREEBSD
endif
ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX
endif
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH = C:/emsdk
EMSCRIPTEN_VERSION = 1.37.28
CLANG_VERSION=e1.37.28_64bit
PYTHON_VERSION=2.7.5.3_64bit
NODE_VERSION=4.1.1_64bit
export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
endif
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs
# Define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
endif
ifeq ($(PLATFORM_OS),FREEBSD)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5
endif
# Define default C compiler: gcc
# NOTE: define g++ compiler if using C++
CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# OSX default compiler
CC = clang
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# FreeBSD default compiler
CC = clang
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# Define RPI cross-compiler
#CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# HTML5 emscripten compiler
CC = emcc
endif
# Define default make program: Mingw32-make
MAKE = mingw32-make
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX)
MAKE = make
endif
endif
# Define compiler flags:
# -O1 defines optimization level
# -g enable debugging
# -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
# Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM_OS),LINUX)
CFLAGS += -no-pie -D_DEFAULT_SOURCE
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS += -std=gnu99
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# -O2 # if used, also set --memory-init-file 0
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s USE_PTHREADS=1 # multithreading support
# -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly)
# --preload-file resources # specify a resources folder for data compilation
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 --profiling --preload-file resources -s TOTAL_MEMORY=67108864
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
EXT = .html
endif
# Define include paths for required headers
# NOTE: Several external required libraries (stb and others)
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
# Define additional directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI requried libraries
INCLUDE_PATHS += -I/opt/vc/include
INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux
INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
endif
# Define library paths containing required libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),FREEBSD)
INCLUDE_PATHS += -I/usr/local/include
LDFLAGS += -L. -Lsrc -L/usr/local/lib
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L/opt/vc/lib
endif
# Define any libraries required on linking
# if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compilation
LDLIBS = -lraylib -lopengl32 -lgdi32
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libegl1-mesa-dev
LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
# On X11 requires also below libraries
LDLIBS += -lX11
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
# On Wayland windowing system, additional libraries requires
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
endif
endif
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# Libraries for FreeBSD desktop compiling
# NOTE: Required packages: mesa-libs
LDLIBS = -lraylib -lGL -lpthread -lm
# On XWindow requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
# NOTE: It could require additional packages installed: libglfw3-dev
LDLIBS += -lglfw
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# Libraries for Raspberry Pi compiling
# NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc
endif
# Define all source files required
PROJECT_SOURCE_FILES ?= transmission.c \
screens/screen_logo.c \
screens/screen_title.c \
screens/screen_mission.c \
screens/screen_gameplay.c \
screens/screen_ending.c
# Define all object files from source files
OBJS = $(patsubst %.c, %.o, $(PROJECT_SOURCE_FILES))
# For Android platform we call a custom Makefile.Android
ifeq ($(PLATFORM),PLATFORM_ANDROID)
MAKEFILE_PARAMS = -f Makefile.Android
export PROJECT_NAME
export PROJECT_SOURCE_FILES
else
MAKEFILE_PARAMS = $(PROJECT_NAME)
endif
# Default target entry
# NOTE: We call this Makefile target or Makefile.Android target
all:
$(MAKE) $(MAKEFILE_PARAMS)
# Project target defined by PROJECT_NAME
$(PROJECT_NAME): $(OBJS)
$(CC) -o $(PROJECT_NAME)$(EXT) $(OBJS) $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# Compile source files
# NOTE: This pattern will compile every module defined on $(OBJS)
%.o: %.c
$(CC) -c $< -o $@ $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
# Clean everything
clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
del *.o *.exe /s
endif
ifeq ($(PLATFORM_OS),LINUX)
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
endif
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete
rm -f *.o
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
find . -type f -executable -delete
rm -f *.o
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
del *.o *.html *.js
endif
@echo Cleaning done

View File

@@ -0,0 +1,275 @@
#**************************************************************************************************
#
# raylib makefile for Android project (APK building)
#
# Copyright (c) 2017 Ramon Santamaria (@raysan5)
#
# This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose, including commercial
# applications, and to alter it and redistribute it freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not claim that you
# wrote the original software. If you use this software in a product, an acknowledgment
# in the product documentation would be appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented
# as being the original software.
#
# 3. This notice may not be removed or altered from any source distribution.
#
#**************************************************************************************************
# Define required raylib variables
PLATFORM ?= PLATFORM_ANDROID
RAYLIB_PATH ?= ..\..
# Required path variables
# NOTE: JAVA_HOME must be set to JDK
ANDROID_HOME = C:/android-sdk
ANDROID_NDK = C:/android-ndk
ANDROID_TOOLCHAIN = C:/android_toolchain_arm_api16
ANDROID_BUILD_TOOLS = $(ANDROID_HOME)/build-tools/26.0.2
ANDROID_PLATFORM_TOOLS = $(ANDROID_HOME)/platform-tools
JAVA_HOME = C:/PROGRA~1/Java/jdk1.8.0_144
# Android project configuration variables
PROJECT_NAME ?= raylib_game
PROJECT_LIBRARY_NAME ?= main
PROJECT_BUILD_PATH ?= android.$(PROJECT_NAME)
PROJECT_RESOURCES_PATH ?= resources
PROJECT_SOURCE_FILES ?= raylib_game.c
# Some source files are placed in directories, when compiling to some
# output directory other than source, that directory must pre-exist.
# Here we get a list of required folders that need to be created on
# code output folder $(PROJECT_BUILD_PATH)\obj to avoid GCC errors.
PROJECT_SOURCE_DIRS = $(sort $(dir $(PROJECT_SOURCE_FILES)))
# Android app configuration variables
APP_LABEL_NAME ?= rGame
APP_COMPANY_NAME ?= raylib
APP_PRODUCT_NAME ?= rgame
APP_VERSION_CODE ?= 1
APP_VERSION_NAME ?= 1.0
APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\raylib_36x36.png
APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\raylib_48x48.png
APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\raylib_72x72.png
APP_SCREEN_ORIENTATION ?= landscape
APP_KEYSTORE_PASS ?= raylib
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC
RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
# Shared libs must be added to APK if required
# NOTE: Generated NativeLoader.java automatically load those libraries
ifeq ($(RAYLIB_LIBTYPE),SHARED)
PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so
endif
# Compiler and archiver
# NOTE: GCC is being deprectated in Android NDK r16
CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-gcc
AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar
# Compiler flags for arquitecture
CFLAGS = -std=c99 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
# Compilation functions attributes options
CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC
# Compiler options for the linker
CFLAGS += -Wall -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical-prefixes
# Preprocessor macro definitions
CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=16
# Paths containing required header files
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src/external/android/native_app_glue
# Linker options
LDFLAGS = -Wl,-soname,lib$(PROJECT_LIBRARY_NAME).so -Wl,--exclude-libs,libatomic.a
LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings
# Force linking of library module to define symbol
LDFLAGS += -u ANativeActivity_onCreate
# Library paths containing required libs
LDFLAGS += -L. -L$(PROJECT_BUILD_PATH)/obj -L$(PROJECT_BUILD_PATH)/lib/armeabi-v7a
# Define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname
LDLIBS = -lraylib -lnative_app_glue -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm -ldl
# Generate target objects list from PROJECT_SOURCE_FILES
OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES))
# Android APK building process... some steps required...
# NOTE: typing 'make' will invoke the default target entry called 'all',
all: create_temp_project_dirs \
copy_project_required_libs \
copy_project_resources \
generate_loader_script \
generate_android_manifest \
generate_apk_keystore \
config_project_package \
compile_native_app_glue \
compile_project_code \
compile_project_class \
compile_project_class_dex \
create_project_apk_package \
sign_project_apk_package \
zipalign_project_apk_package
# Create required temp directories for APK building
create_temp_project_dirs:
if not exist $(PROJECT_BUILD_PATH) mkdir $(PROJECT_BUILD_PATH)
if not exist $(PROJECT_BUILD_PATH)\obj mkdir $(PROJECT_BUILD_PATH)\obj
if not exist $(PROJECT_BUILD_PATH)\src mkdir $(PROJECT_BUILD_PATH)\src
if not exist $(PROJECT_BUILD_PATH)\src\com mkdir $(PROJECT_BUILD_PATH)\src\com
if not exist $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME) mkdir $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME)
if not exist $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME)\$(APP_PRODUCT_NAME) mkdir $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME)\$(APP_PRODUCT_NAME)
if not exist $(PROJECT_BUILD_PATH)\lib mkdir $(PROJECT_BUILD_PATH)\lib
if not exist $(PROJECT_BUILD_PATH)\lib\armeabi-v7a mkdir $(PROJECT_BUILD_PATH)\lib\armeabi-v7a
if not exist $(PROJECT_BUILD_PATH)\bin mkdir $(PROJECT_BUILD_PATH)\bin
if not exist $(PROJECT_BUILD_PATH)\res mkdir $(PROJECT_BUILD_PATH)\res
if not exist $(PROJECT_BUILD_PATH)\res\drawable-ldpi mkdir $(PROJECT_BUILD_PATH)\res\drawable-ldpi
if not exist $(PROJECT_BUILD_PATH)\res\drawable-mdpi mkdir $(PROJECT_BUILD_PATH)\res\drawable-mdpi
if not exist $(PROJECT_BUILD_PATH)\res\drawable-hdpi mkdir $(PROJECT_BUILD_PATH)\res\drawable-hdpi
if not exist $(PROJECT_BUILD_PATH)\res\values mkdir $(PROJECT_BUILD_PATH)\res\values
if not exist $(PROJECT_BUILD_PATH)\assets mkdir $(PROJECT_BUILD_PATH)\assets
if not exist $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH) mkdir $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH)
if not exist $(PROJECT_BUILD_PATH)\obj\screens mkdir $(PROJECT_BUILD_PATH)\obj\screens
$(foreach dir, $(PROJECT_SOURCE_DIRS), $(call create_dir, $(dir)))
define create_dir
if not exist $(PROJECT_BUILD_PATH)\obj\$(1) mkdir $(PROJECT_BUILD_PATH)\obj\$(1)
endef
# Copy required shared libs for integration into APK
# NOTE: If using shared libs they are loaded by generated NativeLoader.java
copy_project_required_libs:
ifeq ($(RAYLIB_LIBTYPE),SHARED)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so
endif
ifeq ($(RAYLIB_LIBTYPE),STATIC)
copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a
endif
# Copy project required resources: strings.xml, icon.png, assets
# NOTE: Required strings.xml is generated and game resources are copied to assets folder
# TODO: Review xcopy usage, it can not be found in some systems!
copy_project_resources:
copy $(APP_ICON_LDPI) $(PROJECT_BUILD_PATH)\res\drawable-ldpi\icon.png /Y
copy $(APP_ICON_MDPI) $(PROJECT_BUILD_PATH)\res\drawable-mdpi\icon.png /Y
copy $(APP_ICON_HDPI) $(PROJECT_BUILD_PATH)\res\drawable-hdpi\icon.png /Y
@echo ^<?xml version="1.0" encoding="utf-8"^?^> > $(PROJECT_BUILD_PATH)/res/values/strings.xml
@echo ^<resources^>^<string name="app_name"^>$(APP_LABEL_NAME)^</string^>^</resources^> >> $(PROJECT_BUILD_PATH)/res/values/strings.xml
if exist $(PROJECT_RESOURCES_PATH) C:\Windows\System32\xcopy $(PROJECT_RESOURCES_PATH) $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH) /Y /E /F
# Generate NativeLoader.java to load required shared libraries
# NOTE: Probably not the bet way to generate this file... but it works.
generate_loader_script:
@echo package com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME); > $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
ifeq ($(RAYLIB_LIBTYPE),SHARED)
@echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
endif
@echo System.loadLibrary("$(PROJECT_LIBRARY_NAME)"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo } >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
@echo } >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
# Generate AndroidManifest.xml with all the required options
# NOTE: Probably not the bet way to generate this file... but it works.
generate_android_manifest:
@echo ^<?xml version="1.0" encoding="utf-8"^?^> > $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^<manifest xmlns:android="http://schemas.android.com/apk/res/android" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo package="com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME)" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo android:versionCode="$(APP_VERSION_CODE)" android:versionName="$(APP_VERSION_NAME)" ^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^<uses-sdk android:minSdkVersion="16" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^<uses-feature android:glEsVersion="0x00020000" android:required="true" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^<application android:allowBackup="false" android:label="@string/app_name" android:icon="@drawable/icon" ^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^<activity android:name="com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME).NativeLoader" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo android:configChanges="orientation|keyboardHidden|screenSize" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo android:screenOrientation="$(APP_SCREEN_ORIENTATION)" android:launchMode="singleTask" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo android:clearTaskOnLaunch="true"^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^<meta-data android:name="android.app.lib_name" android:value="$(PROJECT_LIBRARY_NAME)" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^<intent-filter^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^<action android:name="android.intent.action.MAIN" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^<category android:name="android.intent.category.LAUNCHER" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^</intent-filter^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^</activity^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^</application^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
@echo ^</manifest^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
# Generate storekey for APK signing: $(PROJECT_NAME).keystore
# NOTE: Configure here your Distinguished Names (-dname) if required!
generate_apk_keystore:
if not exist $(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore $(JAVA_HOME)/bin/keytool -genkeypair -validity 1000 -dname "CN=$(APP_COMPANY_NAME),O=Android,C=ES" -keystore $(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore -storepass $(APP_KEYSTORE_PASS) -keypass $(APP_KEYSTORE_PASS) -alias $(PROJECT_NAME)Key -keyalg RSA
# Config project package and resource using AndroidManifest.xml and res/values/strings.xml
# NOTE: Generates resources file: src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/R.java
config_project_package:
$(ANDROID_BUILD_TOOLS)/aapt package -f -m -S $(PROJECT_BUILD_PATH)/res -J $(PROJECT_BUILD_PATH)/src -M $(PROJECT_BUILD_PATH)/AndroidManifest.xml -I $(ANDROID_HOME)/platforms/android-16/android.jar
# Compile native_app_glue code as static library: obj/libnative_app_glue.a
compile_native_app_glue:
$(CC) -c $(RAYLIB_PATH)/src/external/android/native_app_glue/android_native_app_glue.c -o $(PROJECT_BUILD_PATH)/obj/native_app_glue.o $(CFLAGS)
$(AR) rcs $(PROJECT_BUILD_PATH)/obj/libnative_app_glue.a $(PROJECT_BUILD_PATH)/obj/native_app_glue.o
# Compile project code into a shared library: lib/lib$(PROJECT_LIBRARY_NAME).so
compile_project_code: $(OBJS)
$(CC) -o $(PROJECT_BUILD_PATH)/lib/armeabi-v7a/lib$(PROJECT_LIBRARY_NAME).so $(OBJS) -shared $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS)
# Compile all .c files required into object (.o) files
# NOTE: Those files will be linked into a shared library
$(PROJECT_BUILD_PATH)/obj/%.o:%.c
$(CC) -c $^ -o $@ $(INCLUDE_PATHS) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot
# Compile project .java code into .class (Java bytecode)
compile_project_class:
$(JAVA_HOME)/bin/javac -verbose -source 1.7 -target 1.7 -d $(PROJECT_BUILD_PATH)/obj -bootclasspath $(JAVA_HOME)/jre/lib/rt.jar -classpath $(ANDROID_HOME)/platforms/android-16/android.jar;$(PROJECT_BUILD_PATH)/obj -sourcepath $(PROJECT_BUILD_PATH)/src $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/R.java $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
# Compile .class files into Dalvik executable bytecode (.dex)
# NOTE: Since Android 5.0, Dalvik interpreter (JIT) has been replaced by ART (AOT)
compile_project_class_dex:
$(ANDROID_BUILD_TOOLS)/dx --verbose --dex --output=$(PROJECT_BUILD_PATH)/bin/classes.dex $(PROJECT_BUILD_PATH)/obj
# Create Android APK package: bin/$(PROJECT_NAME).unsigned.apk
# NOTE: Requires compiled classes.dex and lib$(PROJECT_LIBRARY_NAME).so
# NOTE: Use -A resources to define additional directory in which to find raw asset files
create_project_apk_package:
$(ANDROID_BUILD_TOOLS)/aapt package -f -M $(PROJECT_BUILD_PATH)/AndroidManifest.xml -S $(PROJECT_BUILD_PATH)/res -A $(PROJECT_BUILD_PATH)/assets -I $(ANDROID_HOME)/platforms/android-16/android.jar -F $(PROJECT_BUILD_PATH)/bin/$(PROJECT_NAME).unsigned.apk $(PROJECT_BUILD_PATH)/bin
cd $(PROJECT_BUILD_PATH) && $(ANDROID_BUILD_TOOLS)/aapt add bin/$(PROJECT_NAME).unsigned.apk lib/armeabi-v7a/lib$(PROJECT_LIBRARY_NAME).so $(PROJECT_SHARED_LIBS)
# Create signed APK package using generated Key: bin/$(PROJECT_NAME).signed.apk
sign_project_apk_package:
$(JAVA_HOME)/bin/jarsigner -keystore $(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore -storepass $(APP_KEYSTORE_PASS) -keypass $(APP_KEYSTORE_PASS) -signedjar $(PROJECT_BUILD_PATH)/bin/$(PROJECT_NAME).signed.apk $(PROJECT_BUILD_PATH)/bin/$(PROJECT_NAME).unsigned.apk $(PROJECT_NAME)Key
# Create zip-aligned APK package: $(PROJECT_NAME).apk
zipalign_project_apk_package:
$(ANDROID_BUILD_TOOLS)/zipalign -f 4 $(PROJECT_BUILD_PATH)/bin/$(PROJECT_NAME).signed.apk $(PROJECT_NAME).apk
# Install $(PROJECT_NAME).apk to default emulator/device
# NOTE: Use -e (emulator) or -d (device) parameters if required
install:
$(ANDROID_PLATFORM_TOOLS)/adb install -r $(PROJECT_NAME).apk
# Monitorize output log coming from device, only raylib tag
logcat:
$(ANDROID_PLATFORM_TOOLS)/adb logcat -c
$(ANDROID_PLATFORM_TOOLS)/adb logcat raylib:V *:S
# Install and monitorize $(PROJECT_NAME).apk to default emulator/device
deploy:
$(ANDROID_PLATFORM_TOOLS)/adb install -r $(PROJECT_NAME).apk
$(ANDROID_PLATFORM_TOOLS)/adb logcat -c
$(ANDROID_PLATFORM_TOOLS)/adb logcat raylib:V *:S
#$(ANDROID_PLATFORM_TOOLS)/adb logcat *:W
# Clean everything
clean:
del $(PROJECT_BUILD_PATH)\* /f /s /q
rmdir $(PROJECT_BUILD_PATH) /s /q
@echo Cleaning done

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,65 @@
# Total missions
# NOTE: Missions follow the order of this file
t 4
# -----------------------------------------------------------------
# Briefing of the mission
b Se ha visto al Presidente en actitud cariñosa con una persona que no es la Primera Dama. Una situación comprometida que definirá el curso de la historia... Especialmente en campaña electoral y siendo del partido conservador... ¡El pueblo debe saber!
#
# Mission keyword
k oviparo
#
# Message to be coded
# NOTE: Sensible words must be noted using @
m El @presidente es visto en un @hotel acompañado de su @amante.
#
# Solution to mission
# NOTE: Provide the correct solution nums, according to above words
# WARNING: Always provide 8 values, use -1 for not used ones
# Coding Words: POLLO = 0, CONEJO, HUEVO, NIDO, AIRE, ARMARIO, AGUJERO, PLATANO, PASTEL, MERCADO, RATON, MELON
s 0 3 2 -1 -1 -1 -1 -1
# -----------------------------------------------------------------
# Briefing of the mission
b Se ha visto un ovni sobrevolando la ciudad, al parecer se prevee un ataque alienígena inminente que definirá el curso de la historia... ¡El pueblo debe saber!
#
# Mission keyword
k roedor
#
# Message to be coded
# NOTE: Sensible words must be noted using @
m Un @ovni ha sido detectado en el @cielo del @pais . Preparaos para el ataque de un @alien.
#
# NOTE: Provide the correct solution nums, according to above words
# WARNING: Always provide 8 values, use -1 for not used ones
# Coding Words: POLLO = 0, CONEJO, HUEVO, NIDO, AIRE, ARMARIO, AGUJERO, PLATANO, PASTEL, MERCADO, RATON, MELON
s 1 6 5 10 -1 -1 -1 -1
# -----------------------------------------------------------------
# Briefing of the mission
b Se ha filtrado una inminente subida del precio de un producto básico para todo el mundo: el ajo. Le evolución de su precio de mercado definirá el curso de la historia... ¡El pueblo debe saber!
#
# Mission keyword
k comida
#
# Message to be coded
# NOTE: Sensible words must be noted using @
m Sube el @precio del @ajo. ¡Un @desastre inminente!
#
# NOTE: Provide the correct solution nums, according to above words
# WARNING: Always provide 8 values, use -1 for not used ones
# Coding Words: POLLO = 0, CONEJO, HUEVO, NIDO, AIRE, ARMARIO, AGUJERO, PLATANO, PASTEL, MERCADO, RATON, MELON
s 9 7 2 -1 -1 -1 -1 -1
# -----------------------------------------------------------------
# Briefing of the mission
b Se ha visto a un famoso presentador de TV deshaciéndose del cuerpo de un rival de otra cadena. Una pérdida que definirá el curso de la historia... Especialmente cuando su programa podría no continuar... ¡El pueblo debe saber!
#
# Mission keyword
k postre
#
# Message to be coded
# NOTE: Sensible words must be noted using @
m Un @presentador se deshace del @cuerpo de su rival. ¡Peligra el @programa del Prime Time!
#
# NOTE: Provide the correct solution nums, according to above words
# WARNING: Always provide 8 values, use -1 for not used ones
# Coding Words: POLLO = 0, CONEJO, HUEVO, NIDO, AIRE, ARMARIO, AGUJERO, PLATANO, PASTEL, MERCADO, RATON, MELON
s 7 11 8 -1 -1 -1 -1 -1
# -----------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Some files were not shown because too many files have changed in this diff Show More