106 Commits
1.0.6 ... 1.2.2

Author SHA1 Message Date
raysan5
4a7e522d4b Review build system for Android and RPI 2015-01-04 18:05:50 +01:00
raysan5
b2a5390adb Added some last hour features to v1.2.2 2015-01-02 21:06:30 +01:00
raysan5
0bfd283526 Added support for model color tint
Also, added support for normals on models
2015-01-02 20:59:54 +01:00
raysan5
7ea8326b52 makefiles reorganization
Edited to better accomodate to multiple platforms
2015-01-02 20:59:05 +01:00
raysan5
8847602061 Examples review... 2015-01-02 20:58:06 +01:00
Ray
e6bc655d6a Rename models_cubesmap.c to models_cubicmap.c 2015-01-02 20:51:14 +01:00
raysan5
061ee04cb5 Integrated ratalaika pull-request
Added first version of OS X compilation support
Some conflicts manually resolved...
2015-01-02 10:18:43 +01:00
Ray
3c4a91658e Merge pull request #12 from raysan5/develop
Integration from develop branch
2014-12-31 19:28:38 +01:00
raysan5
fad81f36e4 Updated docs 2014-12-31 19:25:50 +01:00
raysan5
b482e26925 Small tweaks 2014-12-31 19:25:39 +01:00
raysan5
7ec6ebb9fa New raylib release, including html5 binaries 2014-12-31 19:25:16 +01:00
raysan5
5a98d2da1f Added raylib game showing raylib features 2014-12-31 19:24:51 +01:00
raysan5
21d8394170 Added small floppy game 2014-12-31 19:18:16 +01:00
raysan5
5e913c31a4 Updated example 2014-12-31 19:17:50 +01:00
raysan5
d51d6a4650 Prepare examples makefile to support emscripten 2014-12-31 19:17:41 +01:00
raysan5
3c57c6afc5 Updated to version 2.00b 2014-12-31 18:03:48 +01:00
raysan5
905b6ec53d Added full support for HTML5 (emscripten)
Corrected some bugs on the way...
Automatically convert textures to POT on RPI and WEB
2014-12-31 18:03:32 +01:00
raysan5
08a4ee34eb [texture] image data initialization 2014-12-17 19:47:17 +01:00
raysan5
1bd592fe67 [texture] image loading small check 2014-12-17 19:33:53 +01:00
raysan5
db1ad74ef2 [models] file open error check 2014-12-17 19:32:54 +01:00
raysan5
2e5f58255a Working on rotation math...
[models] Added DrawQuad()
2014-12-16 11:15:56 +01:00
raysan5
cfa60ab7e6 Added support for emscripten and more
Added PLATFORM_WEB support (emscripten-webgl)
[audio] Added LoadSoundFromWave()
[textures] Added LoadTextureFromImage() to replace CreateTexture()
Some TraceLogs edited...
2014-12-15 01:08:30 +01:00
raysan5
d3cf316e40 Added features and corrected bugs...
[core] Added SetMousePosition()
[models] LoadHeightmap() - Corrected textures bug
[raymath] Functions renaming
[WEB] Prepare environment for emscripten!
2014-12-09 13:21:55 +01:00
Palaui
a2c8ddca13 Revert "Corrected some bugs..."
This reverts commit 29d8b48503.
2014-12-09 13:10:28 +01:00
Palaui
29d8b48503 Corrected some bugs...
[core] Added SetMousePosition()
[models] LoadHeightmap() - Corrected textures bug
[raymath] Functions renaming
[WEB] Prepare environment for emscripten!
2014-12-09 13:10:05 +01:00
Ray
0c60609268 Merge pull request #11 from raysan5/develop
Develop branch integration
2014-11-24 20:14:58 +01:00
Palaui
63ed471ed2 Corrected bug on billboards 2014-11-24 17:23:05 +01:00
Ray
d16519f5de Merge pull request #9 from raysan5/master
Populate master changes to develop branch
2014-11-24 16:05:41 +01:00
raysan5
fcff83e65c Corrected Android bug on Native Activity cycle 2014-11-23 21:58:45 +01:00
raysan5
7375d0460a Updated stb headers 2014-11-23 21:58:17 +01:00
ratalaika
2706fa86cd Cleaned GLFW library for OS X 2014-11-22 00:23:25 +01:00
ratalaika
6bea9d0232 Added first version of OS X compilation support 2014-11-22 00:13:59 +01:00
ratalaika
ab05ace3ce Added first version of OS X compilation support 2014-11-22 00:13:09 +01:00
Ray
05ccc4fd42 Merge pull request #5 from debiatan/support_linux_desktop
Small fixes to support the Debian/GNU Linux distro. Hopefully Ubuntu too.
2014-11-09 13:39:27 +01:00
Miguel Lechón
a471b6197a Renamed the PLATFORM_LINUX_DESKTOP into PLATFORM_DESKTOP_LINUX. 2014-11-09 13:18:32 +01:00
Miguel Lechón
db2ad9648d Small fixes to support a Debian/GNU Linux distro. Hopefully Ubuntu too. 2014-11-09 12:07:03 +01:00
Ray
45b214d83e Merge pull request #3 from debiatan/fix_audio_64
Fixed WAV loading under 64-bit systems.
2014-11-09 11:29:13 +01:00
Miguel Lechón
e6ef3f6e6a Fixed WAV loading under 64-bit systems. 2014-11-09 08:06:58 +01:00
raysan5
9d27bba23f Small Fixes Update (1.2.1)
View CHANGELOG for description on small fixes and add-ons
2014-10-17 21:11:58 +02:00
Ray
063e26c521 Corrected issue with transparent surface in Raspberry Pi 2014-09-30 18:22:21 +02:00
Ray
9b5e66f5ea Added required linker libs 2014-09-30 18:15:04 +02:00
Ray
d025230707 Added required linker libs 2014-09-30 18:14:36 +02:00
Ray
c790891e60 Added required linker libs 2014-09-30 18:14:08 +02:00
Ray
78a660d409 Added required linker libs 2014-09-30 18:13:40 +02:00
Ray
4040f9095d Added required linker libs 2014-09-30 18:13:16 +02:00
Ray
d95f743b6f Added required linker libs 2014-09-30 18:12:27 +02:00
raysan5
5eff7d2642 Updated example filename 2014-09-30 00:00:52 +02:00
raysan5
51688c004c Code cleaning, removed useless spaces 2014-09-29 23:41:05 +02:00
raysan5
e2ff32eb84 Updated example screenshot 2014-09-28 01:53:40 +02:00
Ray
c79a46889f Update makefile 2014-09-28 01:47:40 +02:00
Ray
735bf98945 Update and rename shapes_color_palette.c to shapes_colors_palette.c 2014-09-28 00:45:14 +02:00
Ray
86446c6102 Update CHANGELOG 2014-09-21 18:39:12 +02:00
raysan5
0287319c38 Image renaming 2014-09-21 18:25:19 +02:00
raysan5
5ecb6801fa Examples renaming and test examples merge
Examples have been renamed for coherence with raylib modules and test
examples have been merged into examples folder.
2014-09-21 14:26:42 +02:00
Ray
3a0d164a76 Rename ex07c_3d_models.c to models_obj_loading.c 2014-09-21 14:13:05 +02:00
Ray
c389f62837 Rename ex07b_3d_shapes.c to models_geometric_shapes.c 2014-09-21 14:11:42 +02:00
Ray
b648a9ddee Rename ex07a_3d_mode.c to core_3d_mode.c 2014-09-21 14:11:15 +02:00
Ray
597b143634 Rename ex06c_font_select.c to text_font_select.c 2014-09-21 14:10:53 +02:00
Ray
1b2225a622 Rename ex06b_logo_anim.c to shapes_logo_raylib_anim.c 2014-09-21 14:10:33 +02:00
Ray
0cdeb4e267 Rename ex08_audio.c to audio_sound_loading.c 2014-09-21 14:10:03 +02:00
Ray
d09b9fbbde Rename ex06a_color_select.c to core_color_select.c 2014-09-21 14:09:36 +02:00
Ray
c40b3a287c Rename ex05b_rbmf_fonts.c to text_rbmf_fonts.c 2014-09-21 14:09:11 +02:00
Ray
1195025c4c Rename ex05a_sprite_fonts.c to text_sprite_fonts.c 2014-09-21 14:08:58 +02:00
Ray
a99ce2f306 Rename ex04b_texture_rectangle.c to textures_rectangle.c 2014-09-21 14:08:41 +02:00
Ray
9d47934a02 Rename ex04a_textures.c to textures_logo_raylib.c 2014-09-21 14:08:16 +02:00
Ray
3b6e5119f3 Rename ex03c_input_gamepad.c to core_input_gamepad.c 2014-09-21 14:07:48 +02:00
Ray
42b1cb1aaa Rename ex03b_input_mouse.c to core_input_mouse.c 2014-09-21 14:07:20 +02:00
Ray
1989b9fcd9 Rename ex03a_input_keys.c to core_input_keys.c 2014-09-21 14:07:04 +02:00
Ray
34d0851f79 Rename ex02c_color_palette.c to shapes_color_palette.c 2014-09-21 14:06:47 +02:00
Ray
b6d0e3adb2 Rename ex02b_basic_shapes.c to shapes_basic_shapes.c 2014-09-21 14:06:19 +02:00
Ray
07129b26c3 Rename ex02a_logo_raylib.c to shapes_logo_raylib.c 2014-09-21 14:06:00 +02:00
Ray
d25b56f6d4 Rename ex01_basic_window.c to core_basic_window.c 2014-09-21 14:05:04 +02:00
raysan5
42b7b11710 Android: Added support for Tap gesture 2014-09-19 12:34:25 +02:00
raysan5
e915812730 Updated with latest addition 2014-09-18 19:22:06 +02:00
raysan5
ace185954c Android project template for basic game
A basic Android template is provided to start a game
2014-09-18 19:02:12 +02:00
raysan5
1ef1f3d7ea Multiple templates to start a game
Some basic to advance templates are provided to be use as base code for
new games
2014-09-18 19:00:30 +02:00
raysan5
815f90974c Updated to ignore *.exe 2014-09-18 18:56:22 +02:00
raysan5
a08e0929bc Updated ignorable files 2014-09-18 18:52:28 +02:00
Ray
d86c5e3950 Update README.md 2014-09-16 23:25:31 +02:00
raysan5
278f82e536 Style formatting 2014-09-16 23:12:56 +02:00
raysan5
983cc8d291 Android project to compile raylib src 2014-09-16 23:10:27 +02:00
raysan5
8e2680f41f raylib 1.2 release files
Default libraylib.a uses OpenGL 1.1 to maximize compatibility
2014-09-16 22:54:42 +02:00
raysan5
fc6081fe70 raylib 1.2
This is a huge update. Check CHANGELOG for details
2014-09-16 22:51:31 +02:00
raysan5
01651af08a Update examples and remove .exe 2014-09-16 11:30:25 +02:00
raysan5
c56ef738ed Explicit define of functions prototypes
No-parameters functions use the prototype style FunctionName(void);
2014-09-03 17:06:10 +02:00
raysan5
d2b98fbb5c Removed useless spaces 2014-09-03 16:51:28 +02:00
Ray
222995c32e Upload new game: Dr. Turtle & Mr. Gamera 2014-07-25 10:50:51 +02:00
raysan5
56a7979750 Corrected bugs...
Set default raylib to use OpenGL 1.1 (compatibility issues on ATI cards)
2014-07-23 19:50:06 +02:00
raysan5
ecb3c47704 Corrected bug with drawing order
We have three vertex buffers: lines, triangles and quads for textures.
Drawing in a desired order could become a nighmare... noww it seems it
works prety well...
2014-07-23 01:25:33 +02:00
raysan5
0b03431c95 Update to version 1.1.1
Check CHANGELOG for a detailed list of changes
2014-07-23 00:06:24 +02:00
raysan5
5e2e9aa23e Corrected bug with DrawModel() 2014-07-08 10:33:04 +02:00
raysan5
aff8d151a4 Corrected DrawSphereWires() function 2014-06-15 00:50:09 +02:00
raysan5
8e186e840c Updated some comments 2014-06-09 16:33:53 +02:00
raysan5
a42f8328b2 Renamed raylib icon file 2014-05-10 11:39:51 +02:00
raysan5
370479f7c5 Updated GLFW3 to 3.0.4
Added additional files in case somebody wants to use the DLL library
version
2014-05-10 11:37:40 +02:00
raysan5
7a6c22bc25 Renamed GLEW dinamic linkage lib 2014-05-02 20:04:09 +02:00
Ray
8ead7ad4cf Update README.md 2014-04-22 21:09:56 +02:00
raysan5
f76a00adc1 Code used to test some features (and resources) 2014-04-19 16:54:48 +02:00
raysan5
1c8874e6d5 Added raylib 1.1 library binaries
OpenGL 3.3+ compiled binaries
2014-04-19 16:53:52 +02:00
raysan5
f06a15ac8b raylib 1.1
View CHANGELOG for a detailed list of changes
2014-04-19 16:36:49 +02:00
Ray
650a8f7f15 Merge pull request #2 from raysan5/testing
Integrate raylib 1.1 changes into master
2014-04-19 14:21:22 +02:00
raysan5
e6b82cb111 Lots of changes, most of them under testing-review
Added a Tracing/Log system
Added OGG stream music support (DOESN'T WORK)
Added Compressed textures support
* This update is probably very buggy...
2014-04-09 20:25:26 +02:00
raysan5
c04f37d0f5 Adapt multiple functions to rlgl
Nearly a complete rework of Models module
Some teaks on multiple functions
2014-04-04 20:11:57 +02:00
raysan5
79cf87d91d Adding GLEW lib 2014-04-04 20:06:55 +02:00
raysan5
96f520ff6d Road to raylib 1.1 - Testing rlgl 2014-03-25 12:40:35 +01:00
raysan5
1c8dce429e Updated 2014-03-16 21:05:04 +01:00
270 changed files with 54792 additions and 8324 deletions

19
.gitignore vendored
View File

@@ -2,16 +2,17 @@
# ... # ...
# Ignore compiled binaries # Ignore compiled binaries
src/core.o src/*.o
src/shapes.o
src/textures.o
src/text.o
src/models.o
src/audio.o
src/vector3.o
src/stb_image.o
src/*.exe src/*.exe
examples/*.o examples/*.o
examples/*.exe
templates/*.exe
# Ignore Android generated files and folders
src_android/obj/
templates/android_project/bin/
templates/android_project/obj/
templates/android_project/libs/
# Ignore thumbnails created by windows # Ignore thumbnails created by windows
Thumbs.db Thumbs.db
@@ -47,6 +48,8 @@ _ReSharper*/
[Tt]est[Rr]esult* [Tt]est[Rr]esult*
ipch/ ipch/
*.opensdf *.opensdf
*.exe
!tools/rrem.exe
# Ignore files build by xcode # Ignore files build by xcode
*.mode*v* *.mode*v*

112
CHANGELOG
View File

@@ -1,11 +1,119 @@
changelog changelog
--------- ---------
Current Release: raylib 1.0.6 (March 2014) Current Release: raylib 1.2.2 (31 December 2014)
NOTE: Only versions marked as 'Release' are available on release folder, updates are only available as source. NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source.
NOTE: Current Release includes all previous updates. NOTE: Current Release includes all previous updates.
-----------------------------------------------
Release: raylib 1.2.2 (31 December 2014)
-----------------------------------------------
[*] Added support for HTML5 compiling (emscripten, asm.js)
[core] Corrected bug on input handling (keyboard and mouse)
[textures] Renamed function CreateTexture() to LoadTextureFromImage()
[textures] Added function ConvertToPOT()
[rlgl] Added support for color tint on models on GL 3.3+ and ES2
[rlgl] Added support for normals on models
[models] Corrected bug on DrawBillboard()
[models] Corrected bug on DrawHeightmap()
[models] Renamed LoadCubesmap() to LoadCubicmap()
[audio] Added function LoadSoundFromWave()
[makefile] Added support for Linux and OSX compiling
[stb] Updated to latest headers versions
[*] Lots of tweaks around
---------------------------------------------------------------
Update: raylib 1.2.1 (17 October 2014) (Small Fixes Update)
---------------------------------------------------------------
[core] Added function SetupFlags() to preconfigure raylib Window
[core] Corrected bug on fullscreen mode
[rlgl] rlglDrawmodel() - Added rotation on Y axis
[text] MeasureTextEx() - Corrected bug on measures for default font
-----------------------------------------------
Release: raylib 1.2 (16 September 2014)
-----------------------------------------------
NOTE:
This version supposed a complete redesign of the [core] module to support Android and Raspberry Pi.
Multiples modules have also been tweaked to accomodate to the new platforms, specially [rlgl]
[core] Added multiple platforms support: Android and Raspberry Pi
[core] InitWindow() - Complete rewrite and split for Android
[core] InitDisplay() - Internal function added to calculate proper display size
[core] InitGraphics() - Internal function where OpenGL graphics are initialized
[core] Complete refactoring of input functions to accomodate to new platforms
[core] Mouse and Keyboard raw data reading functions added for Raspberry Pi
[core] GetTouchX(), GetTouchY() - Added for Android
[core] Added Android callbacks to process inputs and Android activity commands
[rlgl] Adjusted buffers depending on platform
[rlgl] Added security check in case deployed vertex excess buffer size
[rlgl] Adjusted indices type depending on GL version (int or short)
[rlgl] Fallback to VBOs only usage if VAOs not supported on ES2
[rlgl] rlglLoadModel() stores vbo ids on new Model struct
[textures] Added support for PKM files (ETC1, ETC2 compression support)
[shapes] DrawRectangleV() - Modified, depending on OGL version uses TRIANGLES or QUADS
[text] LoadSpriteFont() - Modified to use LoadImage()
[models] Minor changes on models loading to accomodate to new Model struct
[audio] PauseMusicStream(), ResumeMusicStream() - Added
[audio] Reduced music buffer size to avoid stalls on Raspberry Pi
[src] Added makefile for Windows and RPI
[src] Added resources file (raylib icon and executable info)
[examples] Added makefile for Windows and RPI
[examples] Renamed and merged with test examples for coherence with module names
[templates] Added multiple templates to be use as a base-code for games
-----------------------------------------------
Release: raylib 1.1.1 (22 July 2014)
-----------------------------------------------
[core] ShowLogo() - To enable raylib logo animation at startup
[core] Corrected bug with window resizing
[rlgl] Redefined colors arrays to use byte instead of float
[rlgl] Removed double buffer system (no performance improvement)
[rlgl] rlglDraw() - Reorganized buffers drawing order
[rlgl] Corrected bug on screen resizing
[shapes] DrawRectangle() - Use QUADS instead of TRIANGLES
[models] DrawSphereWires() - Corrected some issues
[models] LoadOBJ() - Redesigned to support multiple meshes
[models] LoadCubesMap() - Loading a map as cubes (by pixel color)
[textures] Added security check if file doesn't exist
[text] Corrected bug on SpriteFont loading
[examples] Corrected some 3d examples
[test] Added cubesmap loading test
-----------------------------------------------
Release: raylib 1.1.0 (19 April 2014)
-----------------------------------------------
NOTE:
This version supposed a complete internal redesign of the library to support OpenGL 3.3+ and OpenGL ES 2.0.
New module [rlgl] has been added to 'translate' immediate mode style functions (i.e. rlVertex3f()) to GL 1.1, 3.3+ or ES2.
Another new module [raymath] has also been added with lot of useful 3D math vector-matrix-quaternion functions.
[rlgl] New module, abstracts OpenGL rendering (multiple versions support)
[raymath] New module, useful 3D math vector-matrix-quaternion functions
[core] Adapt all OpenGL code (initialization, drawing) to use [rlgl]
[shapes] Rewrite all shapes drawing functions to use [rlgl]
[textures] Adapt texture GPU loading to use [rlgl]
[textures] Added support for DDS images (compressed and uncompressed)
[textures] CreateTexture() - Redesigned to add mipmap automatic generation
[textures] DrawTexturePro() - Redesigned and corrected bugs
[models] Rewrite all 3d-shapes drawing functions to use [rlgl]
[models] Adapt model loading and drawing to use [rlgl]
[models] Model struct updated to include texture id
[models] SetModelTexture() - Added, link a texture to a model
[models] DrawModelEx() - Redesigned with extended parameters
[audio] Added music streaming support (OGG files)
[audio] Added support for OGG files as Sound
[audio] PlayMusicStream() - Added, open a new music stream and play it
[audio] StopMusicStream() - Added, stop music stream playing and close stream
[audio] PauseMusicStream() - Added, pause music stream playing
[audio] MusicIsPlaying() - Added, to check if music is playing
[audio] SetMusicVolume() - Added, set volume for music
[audio] GetMusicTimeLength() - Added, get current music time length (in seconds)
[audio] GetMusicTimePlayed() - Added, get current music time played (in seconds)
[utils] Added log tracing functionality - TraceLog(), TraceLogOpen(), TraceLogClose()
[*] Log tracing messages all around the code
----------------------------------------------- -----------------------------------------------
Release: raylib 1.0.6 (16 March 2014) Release: raylib 1.0.6 (16 March 2014)
----------------------------------------------- -----------------------------------------------

View File

@@ -10,7 +10,7 @@ The following help is highly appreciated:
- Translators / Localizators - Can you translate raylib to another language? - Translators / Localizators - Can you translate raylib to another language?
- Documentation / Tutorials / Example writters - Can you write some tutorial / example? - Documentation / Tutorials / Example writters - Can you write some tutorial / example?
- Web Development - Can you help with the web? Can you setup a forum? - Web Development - Can you help with the web? Can you setup a forum?
- Porting to Linux and OSX - Can you compile and test raylib on another OS? - Porting to Linux, OSX... - Can you compile and test raylib on another OS?
- Testers of current features and multiple systems - Can you find some bug on raylib? - Testers of current features and multiple systems - Can you find some bug on raylib?
If you can not help on any of the above points but you still want to contribute in some way... please, consider helping If you can not help on any of the above points but you still want to contribute in some way... please, consider helping

213
README.md
View File

@@ -5,11 +5,14 @@ about
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.
raylib is highly inspired by Borland BGI graphics lib (more specifically WinBGI) and by XNA framework. raylib is highly inspired by Borland BGI graphics lib and by XNA framework.
Allegro and SDL have also been analyzed for reference. Allegro and SDL have also been analyzed for reference.
Want to see how easy is making games with raylib? Jump to [code examples!] (http://www.raylib.com/examples.htm) Want to see how easy is making games with raylib? Jump to [code examples!] (http://www.raylib.com/examples.htm)
Since version 1.2.2 raylib can compile directly for web (html5) using emscripten and asm.js,
to see a demo of raylib features working on web, [check here!] (http://www.raylib.com/raylib_demo.html)
history history
------- -------
@@ -28,31 +31,77 @@ like no transparencies support or no hardware acceleration.
So, I decided to create my own lib, hardware accelerated, clear function names, quite organized, well structured, So, I decided to create my own lib, hardware accelerated, clear function names, quite organized, well structured,
plain C coding and, the most important, primarily intended to LEARN videogames programming. plain C coding and, the most important, primarily intended to LEARN videogames programming.
I've coded quite a lot in C# and XNA and I really love it (in fact, my students learn C# with XNA after C), I've coded quite a lot in C# and XNA and I really love it (in fact, my students learn C# after C),
so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from
raylib to XNA (or MonoGame) extremely easily. raylib to XNA, MonoGame or similar libs extremely easily.
raylib started as a weekend project and after three months of hard work, here it is the first version. raylib started as a weekend project and after three months of hard work, first version was published.
Enjoy it. Enjoy it.
notes on raylib 1.1
-------------------
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a
complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
A new module named [rlgl] (https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translate raylib-OpenGL-style
immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
[rlgl] (https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath] (https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes
a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
support of DDS texture files (compressed and uncompressed) along with mipmaps support.
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.1.
notes on raylib 1.2
-------------------
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a
complete internal redesign of [core] (https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android] (http://www.android.com/) and [Raspberry Pi] (http://www.raspberrypi.org/).
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input
system has been written from scratch.
A new display initialization system has been created to support multiple resolutions, adding black bars if required;
user only defines desired screen size and it gets properly displayed.
Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
features features
-------- --------
* Written in plain C code (C99) * Written in plain C code (C99)
* Uses C# PascalCase/camelCase notation * Uses C# PascalCase/camelCase notation
* Hardware accelerated using OpenGL 1.1 * Hardware accelerated with OpenGL (1.1, 3.3+ or ES2)
* Transparencies support (RGBA Colors) * Unique OpenGL abstraction layer [rlgl]
* Custom color palette for better use on white background * Powerful fonts module with SpriteFonts support
* Basic 3D Support (camera, basic models, OBJ models, etc) * Multiple textures support, including DDS, PKM and mipmaps generation
* Powerful Text module with SpriteFonts support * Basic 3d support for Shapes, Models, Heightmaps and Billboards
* Powerful math module for Vector and Matrix operations [raymath]
* Audio loading and playing with streaming support (WAV and OGG)
* Custom color palette for fancy visuals on raywhite background
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5**
raylib uses on its core module the outstanding [GLFW3] (http://www.glfw.org/) library. The best option by far I found for raylib uses on its core module the outstanding [GLFW3] (http://www.glfw.org/) library. The best option by far I found for
window/context and input management (clean, focused, great license, well documented, modern, ...). multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
raylib is licensed under a zlib/libpng license like GLFW3. View [LICENSE] (https://github.com/raysan5/raylib/blob/master/LICENSE.md). 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,
to accomodate to Android and Raspberry Pi.
tool requirements On Android, raylib uses native_app_glue module (provided on Android NDK) and native Android libraries to manage window/context,
inputs and activity cycle.
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
raylib is licensed under a zlib/libpng license. View [LICENSE] (https://github.com/raysan5/raylib/blob/master/LICENSE.md).
tools requirements
------------------ ------------------
raylib has been developed using exclusively two tools: raylib has been developed using exclusively two tools:
@@ -66,28 +115,121 @@ I believe those are the best tools to train spartan-programmers.
Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language
to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way. to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way.
building Since raylib v1.1, you can download a windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/)
--------
raylib could be build with the following command lines (Using GCC compiler): building source (generate libraylib.a)
--------------------------------------
cd raylib/src **Building raylib sources on desktop platforms:**
gcc -c core.c -std=c99 -Wall
gcc -c shapes.c -std=c99 -Wall
gcc -c textures.c -std=c99 -Wall
gcc -c stb_image.c -std=c99 -Wall
gcc -c text.c -std=c99 -Wall
gcc -c models.c -std=c99 -Wall
gcc -c vector3.c -std=c99 -Wall
gcc -c audio.c -std=c99 -Wall
gcc -c utils.c -std=c99 -Wall
ar rcs raylib.a core.o shapes.o textures.o stb_image.o text.o models.o vector3.o utils.o audio.o
To compile examples, make sure raylib.h is placed in include path and libraries raylib (libraylib.a) and glfw3 (libglfw3.a) _Step 1:_ Using MinGW make tool, just navigate from command line to raylib/src/ folder and type:
are placed in the libraries path. It's also recommended to link with file icon.o for fancy raylib icon usage.
cd raylib/examples mingw32-make PLATFORM=PLATFORM_DESKTOP
gcc -o test_code.exe test_code.c icon.o -lraylib -lglfw3 -lopengl32 -lgdi32 -std=c99 -Wl,--subsystem,windows
NOTE: By default raylib compiles using OpenGL 1.1 to maximize compatibility; to use OpenGL 3.3 just type:
mingw32-make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_33
**Building raylib sources on Raspberry Pi:**
_Step 1._ Make sure you have installed in your Raspberry Pi OpenAL Soft library for audio:
sudo apt-get install openal1
_Step 2._ Navigate from command line to raylib/src/ folder and type:
make
**Building raylib sources for Android:**
_Step 1._ Make sure you have installed Android SDK, Android NDK and Apache Ant tools:
> Download and decompress on C: [Android SDK r23](http://dl.google.com/android/android-sdk_r23.0.2-windows.zip)
> Download and decompress on C: [Android NDK r10b](http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86.zip)
> Download and decompress on C: [Apache Ant 1.9.4](http://ftp.cixug.es/apache//ant/binaries/apache-ant-1.9.4-bin.zip)
_Step 2._ Create the following environment variables with the correct paths:
ANDROID_SDK_TOOLS = C:\android-sdk\platform-tools
ANDROID_NDK_ROOT = C:\android-ndk-r10b
ANT_HOME = C:\apache-ant-1.9.4
_Step 3._ Navigate from command line to folder raylib/template_android/ and type:
%ANDROID_NDK_ROOT%\ndk-build
NOTE: libraylib.a will be generated in folder raylib/src_android/obj/local/armeabi/, it must be copied
to Android project; if using raylib/template_android project, copy it to raylib/template_android/jni/libs/.
**Building raylib sources for Web (HTML5)**
_Step 1._ Make sure you have installed emscripten SDK:
> Download latest version from [here].(http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) I recommend following the portable version installation instructions.
_Step 2._ TODO
building examples
-----------------
**Building raylib examples on desktop platforms:**
_Step 1:_ Using MinGW make tool, just navigate from command line to raylib/examples/ folder and type:
mingw32-make PLATFORM=PLATFORM_DESKTOP
NOTE: Make sure the following libs (and their headers) are placed on their respectibe MinGW folders:
libglfw3.a - GLFW3 (static version)
libglew32.a - GLEW, OpenGL extension loading, only required if using OpenGL 3.3+ or ES2
libopenal32.a - OpenAL Soft, audio device management
**Building raylib examples on Raspberry Pi:**
_Step 1._ Make sure you have installed in your Raspberry Pi OpenAL Soft library for audio:
sudo apt-get install openal1
_Step 2._ Navigate from command line to raylib/examples/ folder and type:
make
**Building raylib project for Android (using template):**
_Step 1._ Make sure you have installed Android SDK, Android NDK and Apache Ant tools:
> Download and decompress on C: [Android SDK r23] (http://dl.google.com/android/android-sdk_r23.0.2-windows.zip)
> Download and decompress on C: [Android NDK r10b] (http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86.zip)
> Download and decompress on C: [Apache Ant 1.9.4] (http://ftp.cixug.es/apache//ant/binaries/apache-ant-1.9.4-bin.zip)
_Step 2._ Create the following environment variables with the correct paths:
ANDROID_SDK_TOOLS = C:\android-sdk\platform-tools
ANDROID_NDK_ROOT = C:\android-ndk-r10b
ANT_HOME = C:\apache-ant-1.9.4
_Step 3._ To compile project, navigate from command line to folder raylib/template_android/ and type:
%ANDROID_NDK_ROOT%\ndk-build
_Step 4._ To generate APK, navigate to folder raylib/template_android/ and type:
%ANT_HOME%\bin\ant debug
_Step 5:_ To install APK into connected device (previously intalled drivers and activated USB debug mode on device):
%ANT_HOME%\bin\ant installd
_Step 6:_ To view log output from device:
%ANDROID_SDK_TOOLS%\adb logcat -c
%ANDROID_SDK_TOOLS%\adb -d logcat raylib:V *:S
**If you have any doubt, [just let me know][raysan5].**
contact contact
------- -------
@@ -105,8 +247,9 @@ acknowledgments
The following people have contributed in some way to make raylib project a reality. Big thanks to them! The following people have contributed in some way to make raylib project a reality. Big thanks to them!
- [Zopokx](https://github.com/Zopokx) - [Zopokx](https://github.com/Zopokx) for testing and hosting the web.
- [Elendow](http://www.elendow.com) - [Elendow](http://www.elendow.com) for testing and helping on web development.
- Victor Dual for implementation and testing of 3D shapes functions.
- Marc Palau for implementation and testing of 3D shapes functions.
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San" [raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San"

View File

@@ -1,21 +1,23 @@
roadmap roadmap
------- -------
First version of raylib is quite complete and functional but there is still a lot of things I would like to improve. Current version of raylib is quite complete and functional but there is still a lot of things I would like to improve.
Here it is a list of features I would like to add and functions to improve. Here it is a list of features I would like to add and functions to improve.
Around the source code there are some TODO points with pending revisions/bugs and here it is a list of features I would like to add. Around the source code there are some TODO points with pending revisions/bugs and here it is a list of features I would like to add.
This roadmap is quite outdated... a full list of all the features we are working on should be listed here at some point...
raylib v1.x raylib v1.x
- Review Billboard Drawing functions - [DONE] Review Billboard Drawing functions
- Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model - [DONE] Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model
- Lighting support (only 3d mode) - CreateLight() - Lighting support (only 3d mode)
- [DONE] Simple Collision Detection functions - [DONE] Simple Collision Detection functions
- Default scene Camera controls (zoom, pan, rotate) - [IN PROGRESS] Default scene Camera controls (zoom, pan, rotate)
- Basic Procedural Texture / Image generation (Gradient, Checked, Spot, Noise, Cellular) - Basic Procedural Image Generation (Gradient, Checked, Spot, Noise, Cellular)
- Software mipmapping generation and POT conversion (custom implementation) - [DONE] Software mipmapping generation and POT conversion (custom implementation)
- Comments / Functions translation (?) - [IN PROGRESS] TTF fonts support
Any feature missing? Do you have a request? [Let me know!][raysan5] Any feature missing? Do you have a request? [Let me know!][raysan5]

View File

@@ -0,0 +1,87 @@
/*******************************************************************************************
*
* raylib [audio] example - Music playing (streaming)
*
* NOTE: This example requires OpenAL Soft library installed
*
* This example has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)");
InitAudioDevice(); // Initialize audio device
PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
int framesCounter = 0;
float timePlayed = 0;
//float volume = 1.0;
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
//----------------------------------------------------------------------------------
framesCounter++;
// Testing music fading from one file to another
/*
if (framesCounter > 600) // Wait for 10 seconds (600 frames)
{
volume -= 0.01; // Decrement music volume level
// When music volume level equal or lower than 0,
// restore volume level and init another music file
if (volume <= 0)
{
volume = 1.0;
framesCounter = 0;
PlayMusicStream("resources/audio/another_file.ogg");
}
SetMusicVolume(volume);
}
*/
timePlayed = GetMusicTimePlayed() / GetMusicTimeLength() * 100 * 4; // We scale by 4 to fit 400 pixels
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("MUSIC SHOULD BE PLAYING!", 255, 200, 20, LIGHTGRAY);
DrawRectangle(200, 250, 400, 12, LIGHTGRAY);
DrawRectangle(200, 250, (int)timePlayed, 12, MAROON);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,13 +1,13 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 08 - Audio loading and playing * raylib [audio] example - Sound loading and playing
* *
* NOTE: This example requires OpenAL32 dll installed (or in the same folder) * NOTE: This example requires OpenAL Soft library installed
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -20,11 +20,12 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib example 08 - audio loading and playing"); InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing");
InitAudioDevice(); // Initialize audio device InitAudioDevice(); // Initialize audio device
Sound fx = 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
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -32,7 +33,9 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE)) PlaySound(fx); // Play the sound! if (IsKeyPressed(KEY_SPACE)) PlaySound(fxWav); // Play WAV sound
if (IsKeyPressed(KEY_ENTER)) PlaySound(fxOgg); // Play OGG sound
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -41,7 +44,9 @@ int main()
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText("Press SPACE to PLAY the SOUND!", 240, 200, 20, LIGHTGRAY); DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, LIGHTGRAY);
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, LIGHTGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@@ -49,7 +54,8 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadSound(fx); // Unload sound data UnloadSound(fxWav); // Unload sound data
UnloadSound(fxOgg); // Unload sound data
CloseAudioDevice(); // Close audio device CloseAudioDevice(); // Close audio device

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 07a - Initialize 3d mode * raylib [core] example - Initialize 3d mode
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,11 +18,14 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector3 position = { 0.0, 0.0, 0.0 }; InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
// Define the camera to look into our 3d world
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
InitWindow(screenWidth, screenHeight, "raylib example 07a - 3d mode"); Vector3 cubePosition = { 0.0, 0.0, 0.0 };
//SetTargetFPS(60); // Set our game to run at 60 frames-per-second, but not now...
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -41,7 +44,8 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
DrawCube(position, 2, 2, 2, RED); DrawCube(cubePosition, 2, 2, 2, RED);
DrawCubeWires(cubePosition, 2, 2, 2, MAROON);
DrawGrid(10.0, 1.0); DrawGrid(10.0, 1.0);

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -1,11 +1,21 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 01 - Basic Window * raylib [core] example - Basic window
*
* Welcome to raylib!
*
* To test examples, just press F6 and execute raylib_compile_execute script
* Note that compiled executable is placed in the same folder as .c file
*
* You can find all basic examples on C:\raylib\raylib\examples folder or
* raylib official webpage: www.raylib.com
*
* Enjoy using raylib. :)
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,7 +28,7 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib example 01a - basic window"); InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 06a - Color selection by mouse (collision detection) * raylib [core] example - Color selection by mouse (collision detection)
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,28 +18,28 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 400; int screenHeight = 400;
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN, Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW, GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
GREEN, SKYBLUE, PURPLE, BEIGE }; GREEN, SKYBLUE, PURPLE, BEIGE };
Rectangle recs[21]; // Rectangles array Rectangle colorsRecs[21]; // Rectangles array
// Fills recs data (for every rectangle) // Fills colorsRecs data (for every rectangle)
for (int i = 0; i < 21; i++) for (int i = 0; i < 21; i++)
{ {
recs[i].x = 20 + 100*(i%7) + 10*(i%7); colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7);
recs[i].y = 40 + 100*(i/7) + 10*(i/7); colorsRecs[i].y = 40 + 100*(i/7) + 10*(i/7);
recs[i].width = 100; colorsRecs[i].width = 100;
recs[i].height = 100; colorsRecs[i].height = 100;
} }
bool selected[21] = { false }; // Selected rectangles indicator bool selected[21] = { false }; // Selected rectangles indicator
Vector2 mousePoint; Vector2 mousePoint;
InitWindowEx(screenWidth, screenHeight, "raylib example 06a - color selection", false, "resources/mouse.png"); SetTargetFPS(60); // Set our game to run at 60 frames-per-second
SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -51,7 +51,7 @@ int main()
for (int i = 0; i < 21; i++) // Iterate along all the rectangles for (int i = 0; i < 21; i++) // Iterate along all the rectangles
{ {
if (CheckCollisionPointRec(mousePoint, recs[i])) if (CheckCollisionPointRec(mousePoint, colorsRecs[i]))
{ {
colors[i].a = 120; colors[i].a = 120;
@@ -69,15 +69,15 @@ int main()
for (int i = 0; i < 21; i++) // Draw all rectangles for (int i = 0; i < 21; i++) // Draw all rectangles
{ {
DrawRectangleRec(recs[i], colors[i]); DrawRectangleRec(colorsRecs[i], colors[i]);
// Draw four rectangles around selected rectangle // Draw four rectangles around selected rectangle
if (selected[i]) if (selected[i])
{ {
DrawRectangle(recs[i].x, recs[i].y, 100, 10, RAYWHITE); // Square top rectangle DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 100, 10, RAYWHITE); // Square top rectangle
DrawRectangle(recs[i].x, recs[i].y, 10, 100, RAYWHITE); // Square left rectangle DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 10, 100, RAYWHITE); // Square left rectangle
DrawRectangle(recs[i].x + 90, recs[i].y, 10, 100, RAYWHITE); // Square right rectangle DrawRectangle(colorsRecs[i].x + 90, colorsRecs[i].y, 10, 100, RAYWHITE); // Square right rectangle
DrawRectangle(recs[i].x, recs[i].y + 90, 100, 10, RAYWHITE); // Square bottom rectangle DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RAYWHITE); // Square bottom rectangle
} }
} }

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,11 +1,14 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 03c - Gamepad input * raylib [core] example - Gamepad input
*
* NOTE: This example requires a Gamepad connected to the system
* raylib is configured to work with Xbox 360 gamepad, check raylib.h for buttons configuration
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,12 +21,12 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
Vector2 gamepadMove = { 0, 0 }; Vector2 gamepadMovement = { 0, 0 };
InitWindow(screenWidth, screenHeight, "raylib example 01 - gamepad input"); SetTargetFPS(60); // Set target frames-per-second
SetTargetFPS(60); // Set target frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -33,10 +36,10 @@ int main()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsGamepadAvailable(GAMEPAD_PLAYER1)) if (IsGamepadAvailable(GAMEPAD_PLAYER1))
{ {
gamepadMove = GetGamepadMovement(GAMEPAD_PLAYER1); gamepadMovement = GetGamepadMovement(GAMEPAD_PLAYER1);
ballPosition.x += gamepadMove.x; ballPosition.x += gamepadMovement.x;
ballPosition.y -= gamepadMove.y; ballPosition.y -= gamepadMovement.y;
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A)) if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
{ {

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 03a - Keyboard input * raylib [core] example - Keyboard input
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,9 +18,9 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
InitWindow(screenWidth, screenHeight, "raylib example 05 - keyboard input"); Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
SetTargetFPS(60); // Set target frames-per-second SetTargetFPS(60); // Set target frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -30,10 +30,10 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_RIGHT)) ballPosition.x += 0.8; if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8;
if (IsKeyPressed(KEY_LEFT)) ballPosition.x -= 0.8; if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8;
if (IsKeyPressed(KEY_UP)) ballPosition.y -= 0.8; if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8;
if (IsKeyPressed(KEY_DOWN)) ballPosition.y += 0.8; if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 03b - Mouse input * raylib [core] example - Mouse input
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,11 +18,10 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector2 ballPosition = { -100.0, -100.0 }; InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
int counter = 0;
int mouseX, mouseY;
InitWindow(screenWidth, screenHeight, "raylib example 06 - mouse input"); int mouseX, mouseY;
Vector2 ballPosition = { -100.0, -100.0 };
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Main game loop // Main game loop

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - Testing GetMouseWheelMove() * raylib [core] examples - Mouse wheel
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This test has been created using raylib 1.1 (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)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,10 +18,10 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib test - Mouse wheel"); InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel");
int positionY = 0; int boxPositionY = screenHeight/2 - 40;
int scrollSpeed = 4; // Scrolling speed in pixels int scrollSpeed = 4; // Scrolling speed in pixels
SetTargetFPS(60); SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -31,7 +31,7 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
positionY -= (GetMouseWheelMove()*scrollSpeed); boxPositionY -= (GetMouseWheelMove()*scrollSpeed);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -40,9 +40,10 @@ int main()
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawRectangle(200, positionY, 80, 80, MAROON); DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON);
DrawText(FormatText("%i", positionY), 10, 10, 20, GRAY); DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY);
DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,65 @@
/*******************************************************************************************
*
* raylib [core] example - Generate random values
*
* This example has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
int framesCounter = 0; // Variable used to count frames
int randValue = GetRandomValue(-8,5); // Get a random integer number between -8 and 5 (both included)
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
//----------------------------------------------------------------------------------
framesCounter++;
// Every two seconds (120 frames) a new random value is generated
if (((framesCounter/120)%2) == 1)
{
randValue = GetRandomValue(-8,5);
framesCounter = 0;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

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.

Before

Width:  |  Height:  |  Size: 85 KiB

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.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

316
examples/makefile Normal file
View File

@@ -0,0 +1,316 @@
#**************************************************************************************************
#
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
#
# 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 raylib platform to compile for
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
# WARNING: To compile examples to HTML5, they must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP
# determine SUBPLATFORM 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)
SUBPLATFORM=WINDOWS
else
UNAMEOS:=$(shell uname)
ifeq ($(UNAMEOS),Linux)
SUBPLATFORM=LINUX
else
ifeq ($(UNAMEOS),Darwin)
SUBPLATFORM=OSX
endif
endif
endif
endif
# define compiler: gcc for C program, define as g++ for C++
ifeq ($(PLATFORM),PLATFORM_WEB)
# define emscripten compiler
CC = emcc
else
# define default gcc compiler
CC = gcc
endif
# define compiler flags:
# -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings
# -std=c99 use standard C from 1999 revision
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline
else
CFLAGS = -O2 -Wall -std=c99
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define any directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
else
INCLUDES = -I. -I../src
endif
# define library paths containing required libs
ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../src -L/opt/vc/lib
else
LFLAGS = -L. -L../src -L../external/glfw3/lib/ -I../external/openal_soft/lib/
endif
# define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(SUBPLATFORM),LINUX)
# libraries for Debian GNU/Linux desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -lGLEW -lGL -lopenal
endif
ifeq ($(SUBPLATFORM),OSX)
# libraries for OS X 10.9 desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa
else
# libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# libraries for Raspberry Pi compiling
# NOTE: OpenAL Soft library should be installed (libopenal1 package)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
LIBS = ../src/libraylib.bc
endif
# define additional parameters and flags for windows
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
WINFLAGS = ../src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
endif
# define all object files required
EXAMPLES = \
core_basic_window \
core_input_keys \
core_input_mouse \
core_mouse_wheel \
core_random_values \
core_color_select \
core_3d_mode \
shapes_logo_raylib \
shapes_basic_shapes \
shapes_colors_palette \
shapes_logo_raylib_anim \
textures_logo_raylib \
textures_image_loading \
textures_rectangle \
textures_compressed_dds \
textures_mipmaps \
textures_srcrec_dstrec \
text_sprite_fonts \
text_rbmf_fonts \
text_format_text \
text_font_select \
models_geometric_shapes \
models_planes \
models_billboard \
models_obj_loading \
models_heightmap \
models_cubicmap \
audio_sound_loading \
audio_music_stream \
#core_input_gamepad \
# typing 'make' will invoke the first target entry in the file,
# in this case, the 'default' target entry is raylib
default: examples
# compile all examples
examples: $(EXAMPLES)
# compile [core] example - basic window
core_basic_window: core_basic_window.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - keyboard input
core_input_keys: core_input_keys.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - mouse input
core_input_mouse: core_input_mouse.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# compile [core] example - gamepad input
core_input_gamepad: core_input_gamepad.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
endif
# compile [core] example - mouse wheel
core_mouse_wheel: core_mouse_wheel.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - generate random values
core_random_values: core_random_values.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - color selection (collision detection)
core_color_select: core_color_select.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - 3d mode
core_3d_mode: core_3d_mode.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib logo (with basic shapes)
shapes_logo_raylib: shapes_logo_raylib.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - basic shapes usage (rectangle, circle, ...)
shapes_basic_shapes: shapes_basic_shapes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib color palette
shapes_colors_palette: shapes_colors_palette.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib logo animation
shapes_logo_raylib_anim: shapes_logo_raylib_anim.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - raylib logo texture loading
textures_logo_raylib: textures_logo_raylib.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - image loading and conversion to texture
textures_image_loading: textures_image_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture rectangle drawing
textures_rectangle: textures_rectangle.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - compressed texture loading (DDS)
textures_compressed_dds: textures_compressed_dds.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture mipmaps generation
textures_mipmaps: textures_mipmaps.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture source and destination rectangles
textures_srcrec_dstrec: textures_srcrec_dstrec.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - sprite fonts loading
text_sprite_fonts: text_sprite_fonts.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - raylib bitmap fonts (rBMF)
text_rbmf_fonts: text_rbmf_fonts.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - text formatting
text_format_text: text_format_text.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - font selection program
text_font_select: text_font_select.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - basic geometric 3d shapes
models_geometric_shapes: models_geometric_shapes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - basic window
models_planes: models_planes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - billboard usage
models_billboard: models_billboard.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - OBJ model loading
models_obj_loading: models_obj_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - heightmap loading
models_heightmap: models_heightmap.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - cubesmap loading
models_cubicmap: models_cubicmap.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [audio] example - sound loading and playing (WAV and OGG)
audio_sound_loading: audio_sound_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [audio] example - music stream playing (OGG)
audio_music_stream: audio_music_stream.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# clean everything
clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(SUBPLATFORM),OSX)
rm -f *.o
else
ifeq ($(SUBPLATFORM),LINUX)
find . -type f -executable -delete
rm -f *.o
else
del *.o *.exe
endif
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
# 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

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - Testing DrawBillboard() and DrawBillboardRec() * raylib [models] example - Drawing billboards
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.2 (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)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,19 +18,16 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector3 position = { 0.0, 0.0, 0.0 }; InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
InitWindow(screenWidth, screenHeight, "raylib test - Billboards"); Texture2D lena = LoadTexture("resources/lena.png"); // Our texture for billboard
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
Vector3 billPosition = { 0.0, 0.0, 0.0 }; // Position where draw billboard
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
Texture2D texture = LoadTexture("resources/raylib_logo.png");
Texture2D lena = LoadTexture("resources/lena.png");
Rectangle eyesRec = { 225, 240, 155, 50 };
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -52,8 +49,8 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
//DrawBillboard(camera, texture, position, 2.0, WHITE); //DrawBillboard(camera, lena, billPosition, 1.0, WHITE);
DrawBillboardRec(camera, lena, eyesRec, position, 4.0, WHITE); DrawBillboardRec(camera, lena, eyesRec, billPosition, 4.0, WHITE);
DrawGrid(10.0, 1.0); // Draw a grid DrawGrid(10.0, 1.0); // Draw a grid
@@ -67,7 +64,6 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
UnloadTexture(lena); // Unload texture UnloadTexture(lena); // Unload texture
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context

View File

@@ -0,0 +1,80 @@
/*******************************************************************************************
*
* raylib [models] example - Cubicmap loading and drawing
*
* This example has been created using raylib 1.2 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing");
// Define the camera to look into our 3d world
Camera camera = {{ 7.0, 7.0, 7.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
Image img = LoadImage("resources/cubicmap.png"); // Load cubesmap image (RAM)
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
Model map = LoadCubicmap(img); // Load cubicmap model
SetModelTexture(&map, texture); // Bind texture to model
Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position
UnloadImage(img); // Unload cubesmap image from RAM, already uploaded to VRAM
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
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_UP)) camera.position.y += 0.2f;
else if (IsKeyDown(KEY_DOWN)) camera.position.y -= 0.2f;
if (IsKeyDown(KEY_RIGHT)) camera.position.z += 0.2f;
else if (IsKeyDown(KEY_LEFT)) camera.position.z -= 0.2f;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawModel(map, mapPosition, 1.0f, MAROON);
DrawGrid(10.0, 1.0);
DrawGizmo(mapPosition);
End3dMode();
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
UnloadModel(map); // Unload model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 07b - Draw some basic 3d shapes (cube, sphere, cylinder...) * raylib [models] example - Draw some basic geometric shapes (cube, sphere, cylinder...)
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,11 +18,11 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
InitWindow(screenWidth, screenHeight, "raylib example 07b - 3d shapes");
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -47,7 +47,7 @@ int main()
DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON); DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON);
DrawSphere((Vector3){-1, 0, -2}, 1, GREEN); DrawSphere((Vector3){-1, 0, -2}, 1, GREEN);
DrawSphereWires((Vector3){1, 0, 2}, 2, LIME); DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME);
DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE); DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE);
DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE); DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE);

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - Testing Heightmap Loading and Drawing * raylib [models] example - Heightmap loading and drawing
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.1 (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)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,19 +18,20 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector3 position = { 0.0, 0.0, 0.0 }; InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 12.0, 10.0, 12.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 10.0, 12.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
InitWindow(screenWidth, screenHeight, "raylib test - Heightmap loading and drawing"); Image img = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
Model map = LoadHeightmap(img, 4); // Load heightmap model
SetModelTexture(&map, texture); // Bind texture to model
Vector3 mapPosition = { -4, 0.0, -4 }; // Set model position
Image img = LoadImage("heightmap.png"); UnloadImage(img); // Unload heightmap image from RAM, already uploaded to VRAM
Model map = LoadHeightmap(img, 4);
Texture2D tex = CreateTexture(img);
UnloadImage(img);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -49,12 +50,11 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
//DrawModel(map, position, 0.5f, MAROON); DrawModel(map, mapPosition, 0.5f, MAROON);
DrawModelEx(map, tex, position, 0.5f, WHITE); // Draw 3d model with texture
DrawGrid(10.0, 1.0); // Draw a grid DrawGrid(10.0, 1.0);
DrawGizmo(position, false); DrawGizmo(mapPosition);
End3dMode(); End3dMode();
@@ -66,10 +66,10 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadTexture(tex); // Unload texture UnloadTexture(texture); // Unload texture
UnloadModel(map); // Unload model UnloadModel(map); // Unload model
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 07c - Load and draw a 3d model (OBJ) * raylib [models] example - Load and draw a 3d model (OBJ)
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,17 +18,17 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector3 position = { 0.0, 0.0, 0.0 }; InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
InitWindow(screenWidth, screenHeight, "raylib example 07c - 3d models"); Texture2D texture = LoadTexture("resources/catsham.png"); // Load model texture
Model cat = LoadModel("resources/cat.obj"); // Load OBJ model
SetModelTexture(&cat, texture); // Bind texture to model
Vector3 catPosition = { 0.0, 0.0, 0.0 }; // Set model position
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
Texture2D texture = LoadTexture("resources/catwhite.png");
Model cat = LoadModel("resources/cat.obj");
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -36,10 +36,10 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_LEFT)) position.x -= 0.2; if (IsKeyDown(KEY_LEFT)) catPosition.x -= 0.2;
if (IsKeyPressed(KEY_RIGHT)) position.x += 0.2; if (IsKeyDown(KEY_RIGHT)) catPosition.x += 0.2;
if (IsKeyPressed(KEY_UP)) position.z -= 0.2; if (IsKeyDown(KEY_UP)) catPosition.z -= 0.2;
if (IsKeyPressed(KEY_DOWN)) position.z += 0.2; if (IsKeyDown(KEY_DOWN)) catPosition.z += 0.2;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -50,11 +50,11 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
DrawModelEx(cat, texture, position, 0.1f, WHITE); // Draw 3d model with texture DrawModel(cat, catPosition, 0.1f, WHITE); // Draw 3d model with texture
DrawGrid(10.0, 1.0); // Draw a grid DrawGrid(10.0, 1.0); // Draw a grid
DrawGizmo(position, false); DrawGizmo(catPosition); // Draw gizmo
End3dMode(); End3dMode();

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

64
examples/models_planes.c Normal file
View File

@@ -0,0 +1,64 @@
/*******************************************************************************************
*
* raylib [models] example - Draw 3d planes
*
* This example has been created using raylib 1.2 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - 3d planes");
// Define the camera to look into our 3d world
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
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
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 4, 4 }, (Vector3){ 0, 45, 0 }, RED);
//DrawPlaneEx((Vector3){ 0, 8, 0 }, (Vector2){ 2, 1 }, (Vector3){ 0, 0, 0 }, 4, 4, SKYBLUE);
DrawGrid(10.0, 1.0);
End3dMode();
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

BIN
examples/openal32.dll Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 02b - Draw basic shapes 2d (rectangle, circle, line...) * raylib [shapes] example - Draw basic shapes 2d (rectangle, circle, line...)
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,7 +18,7 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib example 02b - basic shapes drawing"); InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing");
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 02c - Draw raylib custom color palette * raylib [shapes] example - Draw raylib custom color palette
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,7 +18,7 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib example 02c - raylib color palette"); InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib color palette");
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 02a - Draw raylib logo * raylib [shapes] example - Draw raylib logo using basic shapes
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,7 +18,7 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib example 02a - raylib logo"); InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo using shapes");
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -37,7 +37,7 @@ int main()
DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK); DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK);
DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, RAYWHITE); DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, RAYWHITE);
DrawText("raylib", 356, 273, 50, BLACK); DrawText("raylib", screenWidth/2 - 44, screenHeight/2 + 48, 50, BLACK);
DrawText("this is NOT a texture!", 350, 370, 10, GRAY); DrawText("this is NOT a texture!", 350, 370, 10, GRAY);

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 06b - raylib Logo Animation * raylib [shapes] example - raylib logo animation
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.1 (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)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,6 +18,8 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo animation");
int logoPositionX = screenWidth/2 - 128; int logoPositionX = screenWidth/2 - 128;
int logoPositionY = screenHeight/2 - 128; int logoPositionY = screenHeight/2 - 128;
@@ -30,13 +32,12 @@ int main()
int bottomSideRecWidth = 16; int bottomSideRecWidth = 16;
int rightSideRecHeight = 16; int rightSideRecHeight = 16;
char raylib[8] = " "; // raylib text array, max 8 letters char raylib[8] = " \0"; // raylib text array, max 8 letters
int state = 0; // Tracking animation states (State Machine) int state = 0; // Tracking animation states (State Machine)
float alpha = 1.0; // Useful for fading float alpha = 1.0; // Useful for fading
InitWindow(screenWidth, screenHeight, "raylib example 06b - raylib logo animation");
SetTargetFPS(60); SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -115,10 +116,13 @@ int main()
bottomSideRecWidth = 16; bottomSideRecWidth = 16;
rightSideRecHeight = 16; rightSideRecHeight = 16;
for (int i = 0; i < 8; i++) raylib[i] = ' '; for (int i = 0; i < 7; i++) raylib[i] = ' ';
raylib[7] = '\0'; // Last character is end-of-line
alpha = 1.0; alpha = 1.0;
state = 0; // Return to State 0 state = 0; // Return to State 0
} }
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@@ -148,10 +152,15 @@ int main()
} }
else if (state == 3) else if (state == 3)
{ {
DrawRectangle(logoPositionX, logoPositionY, 256, 256, Fade(BLACK, alpha)); DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha));
DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha));
DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha));
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha));
DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, Fade(RAYWHITE, alpha)); DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, Fade(RAYWHITE, alpha));
DrawText(raylib, 356, 273, 50, Fade(BLACK, alpha)); DrawText(raylib, screenWidth/2 - 44, screenHeight/2 + 48, 50, Fade(BLACK, alpha));
} }
else if (state == 4) else if (state == 4)
{ {

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 06c - Font selection... * raylib [text] example - Font selector
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,7 +18,7 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 150; int screenHeight = 150;
InitWindow(screenWidth, screenHeight, "raylib example 06c - font selection"); InitWindow(screenWidth, screenHeight, "raylib [text] example - font selector");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont fonts[8]; // SpriteFont array SpriteFont fonts[8]; // SpriteFont array
@@ -52,7 +52,7 @@ int main()
int framesCounter = 0; // Useful to count frames button is 'active' = clicked int framesCounter = 0; // Useful to count frames button is 'active' = clicked
SetTargetFPS(60); SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -84,7 +84,7 @@ int main()
btnNextInColor = PURPLE; btnNextInColor = PURPLE;
} }
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
{ {
framesCounter = 20; // Frames button is 'active' framesCounter = 20; // Frames button is 'active'
btnNextOutColor = MAROON; btnNextOutColor = MAROON;
@@ -98,7 +98,7 @@ int main()
btnNextInColor = SKYBLUE; btnNextInColor = SKYBLUE;
} }
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON) && (framesCounter > 0)) framesCounter--; if (framesCounter > 0) framesCounter--;
if (framesCounter == 1) // We change font on frame 1 if (framesCounter == 1) // We change font on frame 1
{ {

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - Testing FormatText() function * raylib [text] example - Text formatting
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.1 (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)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,12 +18,12 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [text] example - text formatting");
int score = 100020; int score = 100020;
int hiscore = 200450; int hiscore = 200450;
int lives = 5; int lives = 5;
InitWindow(screenWidth, screenHeight, "raylib test - FormatText()");
SetTargetFPS(60); SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -41,13 +41,13 @@ int main()
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText(FormatText("Score: %08i", score), 80, 80, 20, RED); DrawText(FormatText("Score: %08i", score), 200, 80, 20, RED);
DrawText(FormatText("HiScore: %08i", hiscore), 80, 120, 20, GREEN); DrawText(FormatText("HiScore: %08i", hiscore), 200, 120, 20, GREEN);
DrawText(FormatText("Lives: %02i", lives), 80, 160, 40, BLUE); DrawText(FormatText("Lives: %02i", lives), 200, 160, 40, BLUE);
DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 80, 220, 20, BLACK); DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,11 +1,14 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 05b - raylib bitmap font (rbmf) loading and using * raylib [text] example - raylib bitmap font (rbmf) loading and usage
*
* NOTE: raylib is distributed with some free to use fonts (even for commercial pourposes!)
* To view details and credits for those fonts, check raylib license file
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,17 +21,17 @@ int main()
int screenWidth = 560; int screenWidth = 560;
int screenHeight = 800; int screenHeight = 800;
InitWindow(screenWidth, screenHeight, "raylib example 05b - rBMF fonts"); InitWindow(screenWidth, screenHeight, "raylib [text] example - rBMF fonts");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont font1 = LoadSpriteFont("resources/fonts/alagard.rbmf"); // SpriteFont loading SpriteFont font1 = LoadSpriteFont("resources/fonts/alagard.rbmf"); // rBMF font loading
SpriteFont font2 = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // SpriteFont loading SpriteFont font2 = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // rBMF font loading
SpriteFont font3 = LoadSpriteFont("resources/fonts/mecha.rbmf"); // SpriteFont loading SpriteFont font3 = LoadSpriteFont("resources/fonts/mecha.rbmf"); // rBMF font loading
SpriteFont font4 = LoadSpriteFont("resources/fonts/setback.rbmf"); // SpriteFont loading SpriteFont font4 = LoadSpriteFont("resources/fonts/setback.rbmf"); // rBMF font loading
SpriteFont font5 = LoadSpriteFont("resources/fonts/romulus.rbmf"); // SpriteFont loading SpriteFont font5 = LoadSpriteFont("resources/fonts/romulus.rbmf"); // rBMF font loading
SpriteFont font6 = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // SpriteFont loading SpriteFont font6 = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // rBMF font loading
SpriteFont font7 = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // SpriteFont loading SpriteFont font7 = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // rBMF font loading
SpriteFont font8 = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // SpriteFont loading SpriteFont font8 = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // rBMF font loading
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 05a - SpriteFont loading and drawing some text with it * raylib [text] example - SpriteFont loading and usage
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,12 +18,12 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [text] example - sprite fonts usage");
const char msg1[50] = "THIS IS A custom SPRITE FONT..."; const char msg1[50] = "THIS IS A custom SPRITE FONT...";
const char msg2[50] = "...and this is ANOTHER CUSTOM font..."; const char msg2[50] = "...and this is ANOTHER CUSTOM font...";
const char msg3[50] = "...and a THIRD one! GREAT! :D"; const char msg3[50] = "...and a THIRD one! GREAT! :D";
InitWindow(screenWidth, screenHeight, "raylib example 05a - sprite fonts");
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont font1 = LoadSpriteFont("resources/fonts/custom_mecha.png"); // SpriteFont loading SpriteFont font1 = LoadSpriteFont("resources/fonts/custom_mecha.png"); // SpriteFont loading
SpriteFont font2 = LoadSpriteFont("resources/fonts/custom_alagard.png"); // SpriteFont loading SpriteFont font2 = LoadSpriteFont("resources/fonts/custom_alagard.png"); // SpriteFont loading

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,64 @@
/*******************************************************************************************
*
* raylib [textures] example - DDS Texture loading and drawing (compressed and uncompressed)
*
* NOTE: This example requires raylib OpenGL 3.3+ or ES2 versions for compressed texture,
* OpenGL 1.1 does not support compressed textures, only uncompressed version.
*
* This example has been created using raylib 1.2 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] example - DDS texture loading and drawing");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
//Texture2D texture = LoadTexture("resources/raylib_logo.dds"); // Texture loading (compressed)
Texture2D texture = LoadTexture("resources/raylib_logo_uncompressed.dds"); // Texture loading (uncompressed)
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
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
DrawText("this may be a compressed texture!", 320, 370, 10, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,11 +1,13 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - Testing LoadImage() and CreateTexture() * raylib [textures] example - Image loading and texture creation
* *
* This example has been created using raylib 1.0 (www.raylib.com) * NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM)
*
* This example has been created using raylib 1.1 (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)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,13 +20,14 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib test - Image loading"); InitWindow(screenWidth, screenHeight, "raylib [textures] example - image loading");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Image img = LoadImage("resources/raylib_logo.png"); Image img = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
Texture2D texture = CreateTexture(img); Texture2D texture = LoadTextureFromImage(img, false); // Image converted to texture, GPU memory (VRAM)
UnloadImage(img);
UnloadImage(img); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -43,7 +46,7 @@ int main()
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE); DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
DrawText("this IS a texture!", 360, 370, 10, GRAY); DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 04a - Texture loading and drawing * raylib [textures] example - Texture loading and drawing
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,7 +18,7 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib example 04a - texture loading and drawing"); InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture loading and drawing");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,66 @@
/*******************************************************************************************
*
* raylib [textures] example - Texture loading with mipmaps, mipmaps generation
*
* NOTE: On OpenGL 1.1, mipmaps are calculated 'manually', original image must be power-of-two
* On OpenGL 3.3 and ES2, mipmaps are generated automatically
*
* This example has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture mipmaps generation");
// NOTE: To generate mipmaps for an image, image must be loaded first and converted to texture
// with mipmaps option set to true on CreateTexture()
Image image = LoadImage("resources/raylib_logo.png"); // Load image to CPU memory (RAM)
Texture2D texture = LoadTextureFromImage(image, true); // Create texture and generate mipmaps
UnloadImage(image); // Once texture has been created, we can unload image data from RAM
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawTexture(texture, screenWidth/2 - texture.width/2,
screenHeight/2 - texture.height/2 - 30, WHITE);
DrawText("this IS a texture with mipmaps! really!", 210, 360, 20, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 04b - Texture loading and drawing a part defined by a rectangle * raylib [textures] example - Texture loading and drawing a part defined by a rectangle
* *
* This example has been created using raylib 1.0 (www.raylib.com) * 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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,20 +18,16 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
const char textLine1[] = "Lena image is a standard test image which has been in use since 1973."; InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle");
const char textLine2[] = "It comprises 512x512 pixels, and was originally cropped from the centerfold";
const char textLine3[] = "of November 1972 issue of Playboy magazine. The image is probably the most";
const char textLine4[] = "widely used test image for all sorts of image processing algorithms.";
InitWindow(screenWidth, screenHeight, "raylib example 04b - texture rectangle"); const char textLine1[] = "Lena image is a standard test image which has been in use since 1973.";
const char textLine2[] = "It comprises 512x512 pixels, and it is probably the most widely used";
const char textLine3[] = "test image for all sorts of image processing algorithms.";
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/lena.png"); // Texture loading Texture2D texture = LoadTexture("resources/lena.png"); // Texture loading
Color halfTrans = WHITE; Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
halfTrans.a = 30;
Rectangle eyesRec = { 225, 240, 155, 50 };
Vector2 position = { 369, 241 }; Vector2 position = { 369, 241 };
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -51,14 +47,13 @@ int main()
DrawText("LENA", 220, 100, 20, PINK); DrawText("LENA", 220, 100, 20, PINK);
DrawTexture(texture, screenWidth/2 - 256, 0, halfTrans); // Draw background image DrawTexture(texture, screenWidth/2 - 256, 0, Fade(WHITE, 0.1f)); // Draw background image
DrawTextureRec(texture, eyesRec, position, WHITE); // Draw eyes part of image DrawTextureRec(texture, eyesRec, position, WHITE); // Draw eyes part of image
DrawText(textLine1, 220, 140, 10, DARKGRAY); DrawText(textLine1, 220, 140, 10, DARKGRAY);
DrawText(textLine2, 220, 160, 10, DARKGRAY); DrawText(textLine2, 220, 160, 10, DARKGRAY);
DrawText(textLine3, 220, 180, 10, DARKGRAY); DrawText(textLine3, 220, 180, 10, DARKGRAY);
DrawText(textLine4, 220, 200, 10, DARKGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View File

@@ -0,0 +1,68 @@
/*******************************************************************************************
*
* raylib [textures] example - Texture source and destination rectangles
*
* This example has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] examples - texture source and destination rectangles");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
// NOTE: Source rectangle (part of the texture to use for drawing)
Rectangle sourceRec = { 128, 128, 128, 128 };
// NOTE: Destination rectangle (screen rectangle where drawing part of texture)
Rectangle destRec = { screenWidth/2, screenHeight/2, 256, 256 };
// NOTE: Origin of the texture in case of rotation, it's relative to destination rectangle size
Vector2 origin = { 128, 128 };
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
// NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw
DrawTexturePro(texture, sourceRec, destRec, origin, 45, LIGHTGRAY);
DrawLine(destRec.x, 0, destRec.x, screenHeight, RED);
DrawLine(0, destRec.y, screenWidth, destRec.y, RED);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

73
external/glew/LICENSE.txt vendored Normal file
View File

@@ -0,0 +1,73 @@
The OpenGL Extension Wrangler Library
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
Copyright (C) 2002, Lev Povalahev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name of the author may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Mesa 3-D graphics library
Version: 7.0
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2007 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

BIN
external/glew/glew32.dll vendored Normal file

Binary file not shown.

18062
external/glew/include/GL/glew.h vendored Normal file

File diff suppressed because it is too large Load Diff

1669
external/glew/include/GL/glxew.h vendored Normal file

File diff suppressed because it is too large Load Diff

1421
external/glew/include/GL/wglew.h vendored Normal file

File diff suppressed because it is too large Load Diff

BIN
external/glew/lib/libglew32.a vendored Normal file

Binary file not shown.

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