Compare commits
106 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4a7e522d4b | ||
![]() |
b2a5390adb | ||
![]() |
0bfd283526 | ||
![]() |
7ea8326b52 | ||
![]() |
8847602061 | ||
![]() |
e6bc655d6a | ||
![]() |
061ee04cb5 | ||
![]() |
3c4a91658e | ||
![]() |
fad81f36e4 | ||
![]() |
b482e26925 | ||
![]() |
7ec6ebb9fa | ||
![]() |
5a98d2da1f | ||
![]() |
21d8394170 | ||
![]() |
5e913c31a4 | ||
![]() |
d51d6a4650 | ||
![]() |
3c57c6afc5 | ||
![]() |
905b6ec53d | ||
![]() |
08a4ee34eb | ||
![]() |
1bd592fe67 | ||
![]() |
db1ad74ef2 | ||
![]() |
2e5f58255a | ||
![]() |
cfa60ab7e6 | ||
![]() |
d3cf316e40 | ||
![]() |
a2c8ddca13 | ||
![]() |
29d8b48503 | ||
![]() |
0c60609268 | ||
![]() |
63ed471ed2 | ||
![]() |
d16519f5de | ||
![]() |
fcff83e65c | ||
![]() |
7375d0460a | ||
![]() |
2706fa86cd | ||
![]() |
6bea9d0232 | ||
![]() |
ab05ace3ce | ||
![]() |
05ccc4fd42 | ||
![]() |
a471b6197a | ||
![]() |
db2ad9648d | ||
![]() |
45b214d83e | ||
![]() |
e6ef3f6e6a | ||
![]() |
9d27bba23f | ||
![]() |
063e26c521 | ||
![]() |
9b5e66f5ea | ||
![]() |
d025230707 | ||
![]() |
c790891e60 | ||
![]() |
78a660d409 | ||
![]() |
4040f9095d | ||
![]() |
d95f743b6f | ||
![]() |
5eff7d2642 | ||
![]() |
51688c004c | ||
![]() |
e2ff32eb84 | ||
![]() |
c79a46889f | ||
![]() |
735bf98945 | ||
![]() |
86446c6102 | ||
![]() |
0287319c38 | ||
![]() |
5ecb6801fa | ||
![]() |
3a0d164a76 | ||
![]() |
c389f62837 | ||
![]() |
b648a9ddee | ||
![]() |
597b143634 | ||
![]() |
1b2225a622 | ||
![]() |
0cdeb4e267 | ||
![]() |
d09b9fbbde | ||
![]() |
c40b3a287c | ||
![]() |
1195025c4c | ||
![]() |
a99ce2f306 | ||
![]() |
9d47934a02 | ||
![]() |
3b6e5119f3 | ||
![]() |
42b1cb1aaa | ||
![]() |
1989b9fcd9 | ||
![]() |
34d0851f79 | ||
![]() |
b6d0e3adb2 | ||
![]() |
07129b26c3 | ||
![]() |
d25b56f6d4 | ||
![]() |
42b7b11710 | ||
![]() |
e915812730 | ||
![]() |
ace185954c | ||
![]() |
1ef1f3d7ea | ||
![]() |
815f90974c | ||
![]() |
a08e0929bc | ||
![]() |
d86c5e3950 | ||
![]() |
278f82e536 | ||
![]() |
983cc8d291 | ||
![]() |
8e2680f41f | ||
![]() |
fc6081fe70 | ||
![]() |
01651af08a | ||
![]() |
c56ef738ed | ||
![]() |
d2b98fbb5c | ||
![]() |
222995c32e | ||
![]() |
56a7979750 | ||
![]() |
ecb3c47704 | ||
![]() |
0b03431c95 | ||
![]() |
5e2e9aa23e | ||
![]() |
aff8d151a4 | ||
![]() |
8e186e840c | ||
![]() |
a42f8328b2 | ||
![]() |
370479f7c5 | ||
![]() |
7a6c22bc25 | ||
![]() |
8ead7ad4cf | ||
![]() |
f76a00adc1 | ||
![]() |
1c8874e6d5 | ||
![]() |
f06a15ac8b | ||
![]() |
650a8f7f15 | ||
![]() |
e6b82cb111 | ||
![]() |
c04f37d0f5 | ||
![]() |
79cf87d91d | ||
![]() |
96f520ff6d | ||
![]() |
1c8dce429e |
19
.gitignore
vendored
@@ -2,16 +2,17 @@
|
||||
# ...
|
||||
|
||||
# Ignore compiled binaries
|
||||
src/core.o
|
||||
src/shapes.o
|
||||
src/textures.o
|
||||
src/text.o
|
||||
src/models.o
|
||||
src/audio.o
|
||||
src/vector3.o
|
||||
src/stb_image.o
|
||||
src/*.o
|
||||
src/*.exe
|
||||
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
|
||||
Thumbs.db
|
||||
@@ -47,6 +48,8 @@ _ReSharper*/
|
||||
[Tt]est[Rr]esult*
|
||||
ipch/
|
||||
*.opensdf
|
||||
*.exe
|
||||
!tools/rrem.exe
|
||||
|
||||
# Ignore files build by xcode
|
||||
*.mode*v*
|
||||
|
112
CHANGELOG
@@ -1,11 +1,119 @@
|
||||
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.
|
||||
|
||||
-----------------------------------------------
|
||||
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)
|
||||
-----------------------------------------------
|
||||
|
@@ -10,7 +10,7 @@ The following help is highly appreciated:
|
||||
- Translators / Localizators - Can you translate raylib to another language?
|
||||
- Documentation / Tutorials / Example writters - Can you write some tutorial / example?
|
||||
- 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?
|
||||
|
||||
If you can not help on any of the above points but you still want to contribute in some way... please, consider helping
|
||||
|
217
README.md
@@ -5,11 +5,14 @@ about
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
-------
|
||||
|
||||
@@ -23,36 +26,82 @@ a simple PONG and some of them even a BREAKOUT!
|
||||
|
||||
But WinBGI was not the clearer and most organized lib. There were a lot of things I found useless and
|
||||
confusing and some function names were not clear enough for most of the students; not to mention points
|
||||
like no transparencies support or no hardware acceleration.
|
||||
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,
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
--------
|
||||
|
||||
* Written in plain C code (C99)
|
||||
* Uses C# PascalCase/camelCase notation
|
||||
* Hardware accelerated using OpenGL 1.1
|
||||
* Transparencies support (RGBA Colors)
|
||||
* Custom color palette for better use on white background
|
||||
* Basic 3D Support (camera, basic models, OBJ models, etc)
|
||||
* Powerful Text module with SpriteFonts support
|
||||
|
||||
* Written in plain C code (C99)
|
||||
* Uses C# PascalCase/camelCase notation
|
||||
* Hardware accelerated with OpenGL (1.1, 3.3+ or ES2)
|
||||
* Unique OpenGL abstraction layer [rlgl]
|
||||
* Powerful fonts module with SpriteFonts support
|
||||
* Multiple textures support, including DDS, PKM and mipmaps generation
|
||||
* 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
|
||||
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:
|
||||
@@ -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
|
||||
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
|
||||
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
|
||||
**Building raylib sources on desktop platforms:**
|
||||
|
||||
To compile examples, make sure raylib.h is placed in include path and libraries raylib (libraylib.a) and glfw3 (libglfw3.a)
|
||||
are placed in the libraries path. It's also recommended to link with file icon.o for fancy raylib icon usage.
|
||||
_Step 1:_ Using MinGW make tool, just navigate from command line to raylib/src/ folder and type:
|
||||
|
||||
cd raylib/examples
|
||||
gcc -o test_code.exe test_code.c icon.o -lraylib -lglfw3 -lopengl32 -lgdi32 -std=c99 -Wl,--subsystem,windows
|
||||
mingw32-make PLATFORM=PLATFORM_DESKTOP
|
||||
|
||||
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
|
||||
-------
|
||||
@@ -105,8 +247,9 @@ acknowledgments
|
||||
|
||||
The following people have contributed in some way to make raylib project a reality. Big thanks to them!
|
||||
|
||||
- [Zopokx](https://github.com/Zopokx)
|
||||
- [Elendow](http://www.elendow.com)
|
||||
|
||||
- [Zopokx](https://github.com/Zopokx) for testing and hosting the web.
|
||||
- [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"
|
||||
|
18
ROADMAP.md
@@ -1,21 +1,23 @@
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
- Review Billboard Drawing functions
|
||||
- Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model
|
||||
- Lighting support (only 3d mode) - CreateLight()
|
||||
- [DONE] Review Billboard Drawing functions
|
||||
- [DONE] Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model
|
||||
- Lighting support (only 3d mode)
|
||||
- [DONE] Simple Collision Detection functions
|
||||
- Default scene Camera controls (zoom, pan, rotate)
|
||||
- Basic Procedural Texture / Image generation (Gradient, Checked, Spot, Noise, Cellular)
|
||||
- Software mipmapping generation and POT conversion (custom implementation)
|
||||
- Comments / Functions translation (?)
|
||||
- [IN PROGRESS] Default scene Camera controls (zoom, pan, rotate)
|
||||
- Basic Procedural Image Generation (Gradient, Checked, Spot, Noise, Cellular)
|
||||
- [DONE] Software mipmapping generation and POT conversion (custom implementation)
|
||||
- [IN PROGRESS] TTF fonts support
|
||||
|
||||
Any feature missing? Do you have a request? [Let me know!][raysan5]
|
||||
|
||||
|
87
examples/audio_music_stream.c
Normal 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;
|
||||
}
|
BIN
examples/audio_music_stream.png
Normal file
After Width: | Height: | Size: 15 KiB |
@@ -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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -19,42 +19,48 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
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
|
||||
|
||||
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
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// 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
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
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();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadSound(fx); // Unload sound data
|
||||
|
||||
UnloadSound(fxWav); // Unload sound data
|
||||
UnloadSound(fxOgg); // Unload sound data
|
||||
|
||||
CloseAudioDevice(); // Close audio device
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/audio_sound_loading.png
Normal file
After Width: | Height: | Size: 15 KiB |
@@ -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)
|
||||
* 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 +18,16 @@ int main()
|
||||
int screenWidth = 800;
|
||||
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 }};
|
||||
|
||||
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
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -32,25 +35,26 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(WHITE);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
End3dMode();
|
||||
|
||||
|
||||
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -59,6 +63,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
@@ -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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,10 +27,10 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 01a - basic window");
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -28,15 +38,15 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -45,6 +55,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,78 +17,78 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 400;
|
||||
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
|
||||
|
||||
Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
|
||||
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
|
||||
GREEN, SKYBLUE, PURPLE, BEIGE };
|
||||
|
||||
Rectangle recs[21]; // Rectangles array
|
||||
|
||||
// Fills recs data (for every rectangle)
|
||||
|
||||
Rectangle colorsRecs[21]; // Rectangles array
|
||||
|
||||
// Fills colorsRecs data (for every rectangle)
|
||||
for (int i = 0; i < 21; i++)
|
||||
{
|
||||
recs[i].x = 20 + 100*(i%7) + 10*(i%7);
|
||||
recs[i].y = 40 + 100*(i/7) + 10*(i/7);
|
||||
recs[i].width = 100;
|
||||
recs[i].height = 100;
|
||||
colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7);
|
||||
colorsRecs[i].y = 40 + 100*(i/7) + 10*(i/7);
|
||||
colorsRecs[i].width = 100;
|
||||
colorsRecs[i].height = 100;
|
||||
}
|
||||
|
||||
bool selected[21] = { false }; // Selected rectangles indicator
|
||||
|
||||
|
||||
bool selected[21] = { false }; // Selected rectangles indicator
|
||||
|
||||
Vector2 mousePoint;
|
||||
|
||||
InitWindowEx(screenWidth, screenHeight, "raylib example 06a - color selection", false, "resources/mouse.png");
|
||||
|
||||
SetTargetFPS(60);
|
||||
|
||||
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
|
||||
//----------------------------------------------------------------------------------
|
||||
mousePoint = GetMousePosition();
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selected[i] = !selected[i];
|
||||
}
|
||||
else colors[i].a = 255;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
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
|
||||
if (selected[i])
|
||||
{
|
||||
DrawRectangle(recs[i].x, recs[i].y, 100, 10, RAYWHITE); // Square top rectangle
|
||||
DrawRectangle(recs[i].x, recs[i].y, 10, 100, RAYWHITE); // Square left rectangle
|
||||
DrawRectangle(recs[i].x + 90, recs[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, 100, 10, RAYWHITE); // Square top rectangle
|
||||
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 10, 100, RAYWHITE); // Square left rectangle
|
||||
DrawRectangle(colorsRecs[i].x + 90, colorsRecs[i].y, 10, 100, RAYWHITE); // Square right rectangle
|
||||
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RAYWHITE); // Square bottom rectangle
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,15 +20,15 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
|
||||
|
||||
Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
|
||||
Vector2 gamepadMove = { 0, 0 };
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 01 - gamepad input");
|
||||
|
||||
SetTargetFPS(60); // Set target frames-per-second
|
||||
Vector2 gamepadMovement = { 0, 0 };
|
||||
|
||||
SetTargetFPS(60); // Set target frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -33,11 +36,11 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
|
||||
{
|
||||
gamepadMove = GetGamepadMovement(GAMEPAD_PLAYER1);
|
||||
|
||||
ballPosition.x += gamepadMove.x;
|
||||
ballPosition.y -= gamepadMove.y;
|
||||
|
||||
gamepadMovement = GetGamepadMovement(GAMEPAD_PLAYER1);
|
||||
|
||||
ballPosition.x += gamepadMovement.x;
|
||||
ballPosition.y -= gamepadMovement.y;
|
||||
|
||||
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
|
||||
{
|
||||
ballPosition.x = screenWidth/2;
|
||||
@@ -45,17 +48,17 @@ int main()
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY);
|
||||
|
||||
|
||||
DrawCircleV(ballPosition, 50, MAROON);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -64,6 +67,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -1,51 +1,51 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib example 03a - Keyboard input
|
||||
* raylib [core] example - Keyboard input
|
||||
*
|
||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
* 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 - keyboard input");
|
||||
|
||||
Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 05 - keyboard input");
|
||||
|
||||
|
||||
SetTargetFPS(60); // Set target frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KEY_RIGHT)) ballPosition.x += 0.8;
|
||||
if (IsKeyPressed(KEY_LEFT)) ballPosition.x -= 0.8;
|
||||
if (IsKeyPressed(KEY_UP)) ballPosition.y -= 0.8;
|
||||
if (IsKeyPressed(KEY_DOWN)) ballPosition.y += 0.8;
|
||||
if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8;
|
||||
if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8;
|
||||
if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8;
|
||||
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);
|
||||
|
||||
|
||||
DrawCircleV(ballPosition, 50, MAROON);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -54,6 +54,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,14 +17,13 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
Vector2 ballPosition = { -100.0, -100.0 };
|
||||
int counter = 0;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
|
||||
|
||||
int mouseX, mouseY;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 06 - mouse input");
|
||||
Vector2 ballPosition = { -100.0, -100.0 };
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -34,22 +33,22 @@ int main()
|
||||
{
|
||||
mouseX = GetMouseX();
|
||||
mouseY = GetMouseY();
|
||||
|
||||
|
||||
ballPosition.x = (float)mouseX;
|
||||
ballPosition.y = (float)mouseY;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawCircleV(ballPosition, 40, GOLD);
|
||||
|
||||
|
||||
DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -58,6 +57,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -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)
|
||||
*
|
||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,33 +17,34 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib test - Mouse wheel");
|
||||
|
||||
int positionY = 0;
|
||||
int scrollSpeed = 4; // Scrolling speed in pixels
|
||||
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel");
|
||||
|
||||
int boxPositionY = screenHeight/2 - 40;
|
||||
int scrollSpeed = 4; // Scrolling speed in pixels
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
positionY -= (GetMouseWheelMove()*scrollSpeed);
|
||||
boxPositionY -= (GetMouseWheelMove()*scrollSpeed);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawRectangle(200, positionY, 80, 80, MAROON);
|
||||
|
||||
DrawText(FormatText("%i", positionY), 10, 10, 20, GRAY);
|
||||
|
||||
|
||||
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON);
|
||||
|
||||
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();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -52,6 +53,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/core_mouse_wheel.png
Normal file
After Width: | Height: | Size: 15 KiB |
65
examples/core_random_values.c
Normal 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;
|
||||
}
|
BIN
examples/core_random_values.png
Normal file
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 3.5 KiB |
316
examples/makefile
Normal 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)
|
@@ -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)
|
||||
*
|
||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -18,21 +18,18 @@ int main()
|
||||
int screenWidth = 800;
|
||||
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
|
||||
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
|
||||
|
||||
Texture2D texture = LoadTexture("resources/raylib_logo.png");
|
||||
Texture2D lena = LoadTexture("resources/lena.png");
|
||||
|
||||
Rectangle eyesRec = { 225, 240, 155, 50 };
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -43,35 +40,34 @@ int main()
|
||||
if (IsKeyDown(KEY_UP)) camera.position.y -= 0.2;
|
||||
if (IsKeyDown(KEY_DOWN)) camera.position.y += 0.2;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
Begin3dMode(camera);
|
||||
|
||||
//DrawBillboard(camera, texture, position, 2.0, WHITE);
|
||||
DrawBillboardRec(camera, lena, eyesRec, position, 4.0, WHITE);
|
||||
|
||||
|
||||
//DrawBillboard(camera, lena, billPosition, 1.0, WHITE);
|
||||
DrawBillboardRec(camera, lena, eyesRec, billPosition, 4.0, WHITE);
|
||||
|
||||
DrawGrid(10.0, 1.0); // Draw a grid
|
||||
|
||||
|
||||
End3dMode();
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Unload texture
|
||||
UnloadTexture(lena); // Unload texture
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
80
examples/models_cubicmap.c
Normal 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;
|
||||
}
|
BIN
examples/models_cubicmap.png
Normal file
After Width: | Height: | Size: 27 KiB |
@@ -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)
|
||||
* 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,14 +18,14 @@ int main()
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = {{ 0.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
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -33,35 +33,35 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
Begin3dMode(camera);
|
||||
|
||||
|
||||
DrawCube((Vector3){-4, 0, 2}, 2, 5, 2, RED);
|
||||
DrawCubeWires((Vector3){-4, 0, 2}, 2, 5, 2, GOLD);
|
||||
DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON);
|
||||
|
||||
DrawSphere((Vector3){-1, 0, -2}, 1, GREEN);
|
||||
DrawSphereWires((Vector3){1, 0, 2}, 2, LIME);
|
||||
|
||||
|
||||
DrawSphere((Vector3){-1, 0, -2}, 1, GREEN);
|
||||
DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME);
|
||||
|
||||
DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE);
|
||||
DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE);
|
||||
DrawCylinderWires((Vector3){4.5, -1, 2}, 1, 1, 2, 6, BROWN);
|
||||
|
||||
|
||||
DrawCylinder((Vector3){1, 0, -4}, 0, 1.5, 3, 8, GOLD);
|
||||
DrawCylinderWires((Vector3){1, 0, -4}, 0, 1.5, 3, 8, PINK);
|
||||
|
||||
DrawGrid(10.0, 1.0); // Draw a grid
|
||||
|
||||
|
||||
End3dMode();
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -70,6 +70,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/models_geometric_shapes.png
Normal file
After Width: | Height: | Size: 33 KiB |
@@ -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)
|
||||
*
|
||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -18,21 +18,22 @@ int main()
|
||||
int screenWidth = 800;
|
||||
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
|
||||
Camera camera = {{ 12.0, 10.0, 12.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("heightmap.png");
|
||||
Model map = LoadHeightmap(img, 4);
|
||||
Texture2D tex = CreateTexture(img);
|
||||
UnloadImage(img);
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
Camera camera = {{ 10.0, 12.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||
|
||||
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
|
||||
|
||||
UnloadImage(img); // Unload heightmap 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
|
||||
{
|
||||
@@ -40,37 +41,36 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// ...
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
Begin3dMode(camera);
|
||||
|
||||
//DrawModel(map, position, 0.5f, MAROON);
|
||||
DrawModelEx(map, tex, position, 0.5f, WHITE); // Draw 3d model with texture
|
||||
|
||||
DrawGrid(10.0, 1.0); // Draw a grid
|
||||
|
||||
DrawGizmo(position, false);
|
||||
|
||||
|
||||
DrawModel(map, mapPosition, 0.5f, MAROON);
|
||||
|
||||
DrawGrid(10.0, 1.0);
|
||||
|
||||
DrawGizmo(mapPosition);
|
||||
|
||||
End3dMode();
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(tex); // Unload texture
|
||||
UnloadModel(map); // Unload model
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
UnloadTexture(texture); // Unload texture
|
||||
UnloadModel(map); // Unload model
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/models_heightmap.png
Normal file
After Width: | Height: | Size: 31 KiB |
@@ -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)
|
||||
* 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,48 +18,48 @@ int main()
|
||||
int screenWidth = 800;
|
||||
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
|
||||
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
|
||||
|
||||
Texture2D texture = LoadTexture("resources/catwhite.png");
|
||||
Model cat = LoadModel("resources/cat.obj");
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KEY_LEFT)) position.x -= 0.2;
|
||||
if (IsKeyPressed(KEY_RIGHT)) position.x += 0.2;
|
||||
if (IsKeyPressed(KEY_UP)) position.z -= 0.2;
|
||||
if (IsKeyPressed(KEY_DOWN)) position.z += 0.2;
|
||||
if (IsKeyDown(KEY_LEFT)) catPosition.x -= 0.2;
|
||||
if (IsKeyDown(KEY_RIGHT)) catPosition.x += 0.2;
|
||||
if (IsKeyDown(KEY_UP)) catPosition.z -= 0.2;
|
||||
if (IsKeyDown(KEY_DOWN)) catPosition.z += 0.2;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
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
|
||||
|
||||
DrawGizmo(position, false);
|
||||
|
||||
|
||||
DrawGizmo(catPosition); // Draw gizmo
|
||||
|
||||
End3dMode();
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -68,9 +68,9 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Unload texture
|
||||
UnloadModel(cat); // Unload model
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/models_obj_loading.png
Normal file
After Width: | Height: | Size: 60 KiB |
64
examples/models_planes.c
Normal 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
BIN
examples/resources/audio/guitar_noodling.ogg
Normal file
BIN
examples/resources/audio/tanatana.ogg
Normal file
BIN
examples/resources/cubicmap.png
Normal file
After Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.7 KiB |
BIN
examples/resources/raylib_logo.dds
Normal file
BIN
examples/resources/raylib_logo_uncompressed.dds
Normal 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)
|
||||
* 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 screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 02b - basic shapes drawing");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing");
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -28,13 +28,13 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawText("some basic shapes available on raylib", 20, 20, 20, DARKGRAY);
|
||||
|
||||
DrawLine(18, 42, screenWidth - 18, 42, BLACK);
|
||||
@@ -47,16 +47,16 @@ int main()
|
||||
DrawRectangleGradient(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
|
||||
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE);
|
||||
|
||||
DrawTriangle((Vector2){screenWidth/4*3, 80},
|
||||
(Vector2){screenWidth/4*3 - 60, 150},
|
||||
DrawTriangle((Vector2){screenWidth/4*3, 80},
|
||||
(Vector2){screenWidth/4*3 - 60, 150},
|
||||
(Vector2){screenWidth/4*3 + 60, 150}, VIOLET);
|
||||
|
||||
DrawTriangleLines((Vector2){screenWidth/4*3, 160},
|
||||
(Vector2){screenWidth/4*3 - 20, 230},
|
||||
|
||||
DrawTriangleLines((Vector2){screenWidth/4*3, 160},
|
||||
(Vector2){screenWidth/4*3 - 20, 230},
|
||||
(Vector2){screenWidth/4*3 + 20, 230}, DARKBLUE);
|
||||
|
||||
|
||||
DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -65,6 +65,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
@@ -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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,10 +17,10 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 02c - raylib color palette");
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib color palette");
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -28,15 +28,15 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawText("raylib color palette", 28, 42, 20, BLACK);
|
||||
|
||||
|
||||
DrawRectangle(26, 80, 100, 100, DARKGRAY);
|
||||
DrawRectangle(26, 188, 100, 100, GRAY);
|
||||
DrawRectangle(26, 296, 100, 100, LIGHTGRAY);
|
||||
@@ -59,7 +59,7 @@ int main()
|
||||
DrawRectangle(674, 188, 100, 100, BROWN);
|
||||
DrawRectangle(674, 296, 100, 100, BEIGE);
|
||||
|
||||
|
||||
|
||||
DrawText("DARKGRAY", 65, 166, 10, BLACK);
|
||||
DrawText("GRAY", 93, 274, 10, BLACK);
|
||||
DrawText("LIGHTGRAY", 61, 382, 10, BLACK);
|
||||
@@ -81,7 +81,7 @@ int main()
|
||||
DrawText("DARKBROWN", 705, 166, 10, BLACK);
|
||||
DrawText("BROWN", 733, 274, 10, BLACK);
|
||||
DrawText("BEIGE", 737, 382, 10, BLACK);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -90,6 +90,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
@@ -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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,10 +17,10 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 02a - raylib logo");
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo using shapes");
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -28,19 +28,19 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK);
|
||||
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);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -49,6 +49,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -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)
|
||||
*
|
||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,30 +17,31 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo animation");
|
||||
|
||||
int logoPositionX = screenWidth/2 - 128;
|
||||
int logoPositionY = screenHeight/2 - 128;
|
||||
|
||||
|
||||
int framesCounter = 0;
|
||||
int lettersCount = 0;
|
||||
|
||||
|
||||
int topSideRecWidth = 16;
|
||||
int leftSideRecHeight = 16;
|
||||
|
||||
|
||||
int bottomSideRecWidth = 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)
|
||||
|
||||
|
||||
float alpha = 1.0; // Useful for fading
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 06b - raylib logo animation");
|
||||
|
||||
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -49,9 +50,9 @@ int main()
|
||||
if (state == 0) // State 0: Small box blinking
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
|
||||
if (framesCounter == 120)
|
||||
{
|
||||
{
|
||||
state = 1;
|
||||
framesCounter = 0; // Reset counter... will be used later...
|
||||
}
|
||||
@@ -60,26 +61,26 @@ int main()
|
||||
{
|
||||
topSideRecWidth += 4;
|
||||
leftSideRecHeight += 4;
|
||||
|
||||
|
||||
if (topSideRecWidth == 256) state = 2;
|
||||
}
|
||||
else if (state == 2) // State 2: Bottom and right bars growing
|
||||
{
|
||||
bottomSideRecWidth += 4;
|
||||
rightSideRecHeight += 4;
|
||||
|
||||
|
||||
if (bottomSideRecWidth == 256) state = 3;
|
||||
}
|
||||
else if (state == 3) // State 3: Letters appearing (one by one)
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
|
||||
if (framesCounter/12) // Every 12 frames, one more letter!
|
||||
{
|
||||
{
|
||||
lettersCount++;
|
||||
framesCounter = 0;
|
||||
}
|
||||
|
||||
|
||||
switch (lettersCount)
|
||||
{
|
||||
case 1: raylib[0] = 'r'; break;
|
||||
@@ -90,11 +91,11 @@ int main()
|
||||
case 6: raylib[5] = 'b'; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
if (lettersCount >= 10) // When all letters have appeared, just fade out everything
|
||||
{
|
||||
alpha -= 0.02;
|
||||
|
||||
|
||||
if (alpha <= 0)
|
||||
{
|
||||
alpha = 0;
|
||||
@@ -108,27 +109,30 @@ int main()
|
||||
{
|
||||
framesCounter = 0;
|
||||
lettersCount = 0;
|
||||
|
||||
|
||||
topSideRecWidth = 16;
|
||||
leftSideRecHeight = 16;
|
||||
|
||||
|
||||
bottomSideRecWidth = 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;
|
||||
|
||||
state = 0; // Return to State 0
|
||||
state = 0; // Return to State 0
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
if (state == 0)
|
||||
{
|
||||
if ((framesCounter/15)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK);
|
||||
@@ -142,22 +146,27 @@ int main()
|
||||
{
|
||||
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
|
||||
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
|
||||
|
||||
|
||||
DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK);
|
||||
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK);
|
||||
}
|
||||
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));
|
||||
|
||||
DrawText(raylib, 356, 273, 50, Fade(BLACK, alpha));
|
||||
|
||||
DrawText(raylib, screenWidth/2 - 44, screenHeight/2 + 48, 50, Fade(BLACK, alpha));
|
||||
}
|
||||
else if (state == 4)
|
||||
{
|
||||
DrawText("[R] REPLAY", 340, 200, 20, GRAY);
|
||||
}
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -166,6 +175,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
@@ -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)
|
||||
* 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 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)
|
||||
SpriteFont fonts[8]; // SpriteFont array
|
||||
|
||||
|
||||
fonts[0] = LoadSpriteFont("resources/fonts/alagard.rbmf"); // SpriteFont loading
|
||||
fonts[1] = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // SpriteFont loading
|
||||
fonts[2] = LoadSpriteFont("resources/fonts/mecha.rbmf"); // SpriteFont loading
|
||||
@@ -31,50 +31,50 @@ int main()
|
||||
fonts[5] = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // SpriteFont loading
|
||||
fonts[6] = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // SpriteFont loading
|
||||
fonts[7] = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // SpriteFont loading
|
||||
|
||||
|
||||
int currentFont = 0; // Selected font
|
||||
|
||||
|
||||
Color colors[8] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, RED };
|
||||
|
||||
const char fontNames[8][20] = { "[0] Alagard", "[1] PixelPlay", "[2] MECHA", "[3] Setback",
|
||||
|
||||
const char fontNames[8][20] = { "[0] Alagard", "[1] PixelPlay", "[2] MECHA", "[3] Setback",
|
||||
"[4] Romulus", "[5] PixAntiqua", "[6] Alpha Beta", "[7] Jupiter Crash" };
|
||||
|
||||
|
||||
const char text[50] = "THIS is THE FONT you SELECTED!"; // Main text
|
||||
|
||||
|
||||
Vector2 textSize = MeasureTextEx(fonts[currentFont], text, GetFontBaseSize(fonts[currentFont])*3, 1);
|
||||
|
||||
|
||||
Vector2 mousePoint;
|
||||
|
||||
|
||||
Rectangle btnNextRec = { 673, 18, 109, 44 }; // Button rectangle (useful for collision)
|
||||
|
||||
|
||||
Color btnNextOutColor = DARKBLUE; // Button color (outside line)
|
||||
Color btnNextInColor = SKYBLUE; // Button color (inside)
|
||||
|
||||
|
||||
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
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Keyboard-based font selection (easy)
|
||||
if (IsKeyPressed(KEY_RIGHT))
|
||||
{
|
||||
if (currentFont < 7) currentFont++;
|
||||
}
|
||||
|
||||
|
||||
if (IsKeyPressed(KEY_LEFT))
|
||||
{
|
||||
if (currentFont > 0) currentFont--;
|
||||
}
|
||||
|
||||
|
||||
// Mouse-based font selection (NEXT button logic)
|
||||
mousePoint = GetMousePosition();
|
||||
|
||||
|
||||
if (CheckCollisionPointRec(mousePoint, btnNextRec))
|
||||
{
|
||||
// Mouse hover button logic
|
||||
@@ -83,8 +83,8 @@ int main()
|
||||
btnNextOutColor = DARKPURPLE;
|
||||
btnNextInColor = PURPLE;
|
||||
}
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
framesCounter = 20; // Frames button is 'active'
|
||||
btnNextOutColor = MAROON;
|
||||
@@ -98,37 +98,37 @@ int main()
|
||||
btnNextInColor = SKYBLUE;
|
||||
}
|
||||
|
||||
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON) && (framesCounter > 0)) framesCounter--;
|
||||
|
||||
if (framesCounter > 0) framesCounter--;
|
||||
|
||||
if (framesCounter == 1) // We change font on frame 1
|
||||
{
|
||||
{
|
||||
currentFont++;
|
||||
if (currentFont > 7) currentFont = 0;
|
||||
}
|
||||
|
||||
|
||||
// Text measurement for better positioning on screen
|
||||
textSize = MeasureTextEx(fonts[currentFont], text, GetFontBaseSize(fonts[currentFont])*3, 1);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawRectangle(18, 18, 644, 44, DARKGRAY);
|
||||
DrawRectangle(20, 20, 640, 40, LIGHTGRAY);
|
||||
DrawText(fontNames[currentFont], 30, 31, 20, BLACK);
|
||||
DrawText("< >", 610, 26, 30, BLACK);
|
||||
|
||||
|
||||
DrawRectangleRec(btnNextRec, btnNextOutColor);
|
||||
DrawRectangle(675, 20, 105, 40, btnNextInColor);
|
||||
DrawText("NEXT", 700, 31, 20, btnNextOutColor);
|
||||
|
||||
DrawTextEx(fonts[currentFont], text, (Vector2){ screenWidth/2 - textSize.x/2,
|
||||
75 + (70 - textSize.y)/2 }, GetFontBaseSize(fonts[currentFont])*3,
|
||||
1, colors[currentFont]);
|
||||
|
||||
|
||||
DrawTextEx(fonts[currentFont], text, (Vector2){ screenWidth/2 - textSize.x/2,
|
||||
75 + (70 - textSize.y)/2 }, GetFontBaseSize(fonts[currentFont])*3,
|
||||
1, colors[currentFont]);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -136,9 +136,9 @@ int main()
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
for (int i = 0; i < 8; i++) UnloadSpriteFont(fonts[i]); // SpriteFont(s) unloading
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
@@ -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)
|
||||
*
|
||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,16 +17,16 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - text formatting");
|
||||
|
||||
int score = 100020;
|
||||
int hiscore = 200450;
|
||||
int lives = 5;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib test - FormatText()");
|
||||
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -34,21 +34,21 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText(FormatText("Score: %08i", score), 80, 80, 20, RED);
|
||||
|
||||
DrawText(FormatText("HiScore: %08i", hiscore), 80, 120, 20, GREEN);
|
||||
|
||||
DrawText(FormatText("Lives: %02i", lives), 80, 160, 40, BLUE);
|
||||
|
||||
DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 80, 220, 20, BLACK);
|
||||
|
||||
|
||||
DrawText(FormatText("Score: %08i", score), 200, 80, 20, RED);
|
||||
|
||||
DrawText(FormatText("HiScore: %08i", hiscore), 200, 120, 20, GREEN);
|
||||
|
||||
DrawText(FormatText("Lives: %02i", lives), 200, 160, 40, BLUE);
|
||||
|
||||
DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -57,6 +57,6 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/text_format_text.png
Normal file
After Width: | Height: | Size: 15 KiB |
@@ -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)
|
||||
* 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 +21,19 @@ int main()
|
||||
int screenWidth = 560;
|
||||
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)
|
||||
SpriteFont font1 = LoadSpriteFont("resources/fonts/alagard.rbmf"); // SpriteFont loading
|
||||
SpriteFont font2 = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // SpriteFont loading
|
||||
SpriteFont font3 = LoadSpriteFont("resources/fonts/mecha.rbmf"); // SpriteFont loading
|
||||
SpriteFont font4 = LoadSpriteFont("resources/fonts/setback.rbmf"); // SpriteFont loading
|
||||
SpriteFont font5 = LoadSpriteFont("resources/fonts/romulus.rbmf"); // SpriteFont loading
|
||||
SpriteFont font6 = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // SpriteFont loading
|
||||
SpriteFont font7 = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // SpriteFont loading
|
||||
SpriteFont font8 = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // SpriteFont loading
|
||||
SpriteFont font1 = LoadSpriteFont("resources/fonts/alagard.rbmf"); // rBMF font loading
|
||||
SpriteFont font2 = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // rBMF font loading
|
||||
SpriteFont font3 = LoadSpriteFont("resources/fonts/mecha.rbmf"); // rBMF font loading
|
||||
SpriteFont font4 = LoadSpriteFont("resources/fonts/setback.rbmf"); // rBMF font loading
|
||||
SpriteFont font5 = LoadSpriteFont("resources/fonts/romulus.rbmf"); // rBMF font loading
|
||||
SpriteFont font6 = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // rBMF font loading
|
||||
SpriteFont font7 = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // rBMF font loading
|
||||
SpriteFont font8 = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // rBMF font loading
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -38,22 +41,22 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawTextEx(font1, "TESTING ALAGARD FONT", (Vector2){ 100, 100 }, GetFontBaseSize(font1)*2, 2, MAROON);
|
||||
DrawTextEx(font2, "TESTING PIXELPLAY FONT", (Vector2){ 100, 180 }, GetFontBaseSize(font2)*2, 4, ORANGE);
|
||||
DrawTextEx(font3, "TESTING MECHA FONT", (Vector2){ 100, 260 }, GetFontBaseSize(font3)*2, 8, DARKGREEN);
|
||||
DrawTextEx(font4, "TESTING SETBACK FONT", (Vector2){ 100, 350 }, GetFontBaseSize(font4)*2, 4, DARKBLUE);
|
||||
DrawTextEx(font2, "TESTING PIXELPLAY FONT", (Vector2){ 100, 180 }, GetFontBaseSize(font2)*2, 4, ORANGE);
|
||||
DrawTextEx(font3, "TESTING MECHA FONT", (Vector2){ 100, 260 }, GetFontBaseSize(font3)*2, 8, DARKGREEN);
|
||||
DrawTextEx(font4, "TESTING SETBACK FONT", (Vector2){ 100, 350 }, GetFontBaseSize(font4)*2, 4, DARKBLUE);
|
||||
DrawTextEx(font5, "TESTING ROMULUS FONT", (Vector2){ 100, 430 }, GetFontBaseSize(font5)*2, 3, DARKPURPLE);
|
||||
DrawTextEx(font6, "TESTING PIXANTIQUA FONT", (Vector2){ 100, 510 }, GetFontBaseSize(font6)*2, 4, LIME);
|
||||
DrawTextEx(font7, "TESTING ALPHA_BETA FONT", (Vector2){ 100, 590 }, GetFontBaseSize(font7)*2, 4, GOLD);
|
||||
DrawTextEx(font8, "TESTING JUPITER_CRASH FONT", (Vector2){ 100, 660 }, GetFontBaseSize(font8)*2, 1, RED);
|
||||
|
||||
DrawTextEx(font6, "TESTING PIXANTIQUA FONT", (Vector2){ 100, 510 }, GetFontBaseSize(font6)*2, 4, LIME);
|
||||
DrawTextEx(font7, "TESTING ALPHA_BETA FONT", (Vector2){ 100, 590 }, GetFontBaseSize(font7)*2, 4, GOLD);
|
||||
DrawTextEx(font8, "TESTING JUPITER_CRASH FONT", (Vector2){ 100, 660 }, GetFontBaseSize(font8)*2, 1, RED);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -68,9 +71,9 @@ int main()
|
||||
UnloadSpriteFont(font6); // SpriteFont unloading
|
||||
UnloadSpriteFont(font7); // SpriteFont unloading
|
||||
UnloadSpriteFont(font8); // SpriteFont unloading
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,31 +17,31 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - sprite fonts usage");
|
||||
|
||||
const char msg1[50] = "THIS IS A custom SPRITE FONT...";
|
||||
const char msg2[50] = "...and this is ANOTHER CUSTOM font...";
|
||||
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)
|
||||
SpriteFont font1 = LoadSpriteFont("resources/fonts/custom_mecha.png"); // SpriteFont loading
|
||||
SpriteFont font2 = LoadSpriteFont("resources/fonts/custom_alagard.png"); // SpriteFont loading
|
||||
SpriteFont font3 = LoadSpriteFont("resources/fonts/custom_jupiter_crash.png"); // SpriteFont loading
|
||||
|
||||
|
||||
Vector2 fontPosition1, fontPosition2, fontPosition3;
|
||||
|
||||
|
||||
fontPosition1.x = screenWidth/2 - MeasureTextEx(font1, msg1, GetFontBaseSize(font1), -3).x/2;
|
||||
fontPosition1.y = screenHeight/2 - GetFontBaseSize(font1)/2 - 80;
|
||||
|
||||
|
||||
fontPosition2.x = screenWidth/2 - MeasureTextEx(font2, msg2, GetFontBaseSize(font2), -2).x/2;
|
||||
fontPosition2.y = screenHeight/2 - GetFontBaseSize(font2)/2 - 10;
|
||||
|
||||
|
||||
fontPosition3.x = screenWidth/2 - MeasureTextEx(font3, msg3, GetFontBaseSize(font3), 2).x/2;
|
||||
fontPosition3.y = screenHeight/2 - GetFontBaseSize(font3)/2 + 50;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -49,17 +49,17 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update variables here...
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawTextEx(font1, msg1, fontPosition1, GetFontBaseSize(font1), -3, WHITE);
|
||||
DrawTextEx(font2, msg2, fontPosition2, GetFontBaseSize(font2), -2, WHITE);
|
||||
DrawTextEx(font3, msg3, fontPosition3, GetFontBaseSize(font3), 2, WHITE);
|
||||
|
||||
DrawTextEx(font2, msg2, fontPosition2, GetFontBaseSize(font2), -2, WHITE);
|
||||
DrawTextEx(font3, msg3, fontPosition3, GetFontBaseSize(font3), 2, WHITE);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -69,9 +69,9 @@ int main()
|
||||
UnloadSpriteFont(font1); // SpriteFont unloading
|
||||
UnloadSpriteFont(font2); // SpriteFont unloading
|
||||
UnloadSpriteFont(font3); // SpriteFont unloading
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
64
examples/textures_compressed_dds.c
Normal 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;
|
||||
}
|
BIN
examples/textures_compressed_dds.png
Normal file
After Width: | Height: | Size: 15 KiB |
@@ -1,32 +1,35 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
* 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 test - Image loading");
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [textures] example - image loading");
|
||||
|
||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||
|
||||
Image img = LoadImage("resources/raylib_logo.png");
|
||||
Texture2D texture = CreateTexture(img);
|
||||
UnloadImage(img);
|
||||
Image img = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
|
||||
Texture2D texture = LoadTextureFromImage(img, false); // Image converted to texture, GPU memory (VRAM)
|
||||
|
||||
UnloadImage(img); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -34,17 +37,17 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
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();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -52,9 +55,9 @@ int main()
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Texture unloading
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/textures_image_loading.png
Normal file
After Width: | Height: | Size: 17 KiB |
@@ -1,29 +1,29 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* 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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
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)
|
||||
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -31,18 +31,18 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawTexture(texture, screenWidth/2 - texture.width/2,
|
||||
|
||||
DrawTexture(texture, screenWidth/2 - texture.width/2,
|
||||
screenHeight/2 - texture.height/2, WHITE);
|
||||
|
||||
|
||||
DrawText("this IS a texture!", 360, 370, 10, GRAY);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -50,9 +50,9 @@ int main()
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Texture unloading
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
66
examples/textures_mipmaps.c
Normal 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;
|
||||
}
|
BIN
examples/textures_mipmaps.png
Normal file
After Width: | Height: | Size: 17 KiB |
@@ -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)
|
||||
* 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)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -17,24 +17,20 @@ int main()
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
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 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");
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [texture] example - 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)
|
||||
Texture2D texture = LoadTexture("resources/lena.png"); // Texture loading
|
||||
|
||||
Color halfTrans = WHITE;
|
||||
halfTrans.a = 30;
|
||||
|
||||
Rectangle eyesRec = { 225, 240, 155, 50 };
|
||||
|
||||
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
|
||||
Vector2 position = { 369, 241 };
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
@@ -42,24 +38,23 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
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
|
||||
|
||||
DrawText(textLine1, 220, 140, 10, DARKGRAY);
|
||||
DrawText(textLine2, 220, 160, 10, DARKGRAY);
|
||||
DrawText(textLine3, 220, 180, 10, DARKGRAY);
|
||||
DrawText(textLine4, 220, 200, 10, DARKGRAY);
|
||||
|
||||
DrawText(textLine2, 220, 160, 10, DARKGRAY);
|
||||
DrawText(textLine3, 220, 180, 10, DARKGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -67,9 +62,9 @@ int main()
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Texture unloading
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/textures_rectangle.png
Normal file
After Width: | Height: | Size: 75 KiB |
68
examples/textures_srcrec_dstrec.c
Normal 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;
|
||||
}
|
BIN
examples/textures_srcrec_dstrec.png
Normal file
After Width: | Height: | Size: 19 KiB |
73
external/glew/LICENSE.txt
vendored
Normal 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.
|