summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorRay San <[email protected]>2017-11-03 20:01:48 +0100
committerRay San <[email protected]>2017-11-03 20:01:48 +0100
commitd918334a2e1ce32961c0797a4b13fdd5b4ce5630 (patch)
tree1f16feb32953200c2a47cf425352f1bba70ab99a /examples
parente4041e4eb8c55db0a37c8af575c7a98c17963a9a (diff)
downloadraylib.com-d918334a2e1ce32961c0797a4b13fdd5b4ce5630.tar.gz
raylib.com-d918334a2e1ce32961c0797a4b13fdd5b4ce5630.zip
Updated to support Android platform
Diffstat (limited to 'examples')
-rw-r--r--examples/web/audio/audio_module_playing.c17
-rw-r--r--examples/web/audio/audio_music_stream.c19
-rw-r--r--examples/web/audio/audio_raw_stream.c17
-rw-r--r--examples/web/audio/audio_sound_loading.c17
-rw-r--r--examples/web/core/core_2d_camera.c19
-rw-r--r--examples/web/core/core_3d_camera_first_person.c19
-rw-r--r--examples/web/core/core_3d_camera_free.c17
-rw-r--r--examples/web/core/core_3d_mode.c17
-rw-r--r--examples/web/core/core_3d_picking.c19
-rw-r--r--examples/web/core/core_basic_window.c19
-rw-r--r--examples/web/core/core_color_select.c17
-rw-r--r--examples/web/core/core_drop_files.c19
-rw-r--r--examples/web/core/core_gestures_detection.c17
-rw-r--r--examples/web/core/core_input_gamepad.c17
-rw-r--r--examples/web/core/core_input_keys.c19
-rw-r--r--examples/web/core/core_input_mouse.c19
-rw-r--r--examples/web/core/core_mouse_wheel.c19
-rw-r--r--examples/web/core/core_random_values.c19
-rw-r--r--examples/web/core/core_storage_values.c19
-rw-r--r--examples/web/core/core_vr_simulator.c19
-rw-r--r--examples/web/core/core_world_screen.c19
-rw-r--r--examples/web/shaders/shaders_custom_uniform.c14
-rw-r--r--examples/web/shaders/shaders_model_shader.c14
-rw-r--r--examples/web/shaders/shaders_postprocessing.c14
-rw-r--r--examples/web/shaders/shaders_shapes_textures.c16
-rw-r--r--examples/web/shapes/shapes_basic_shapes.c19
-rw-r--r--examples/web/shapes/shapes_colors_palette.c19
-rw-r--r--examples/web/shapes/shapes_lines_bezier.c19
-rw-r--r--examples/web/shapes/shapes_logo_raylib.c20
-rw-r--r--examples/web/shapes/shapes_logo_raylib_anim.c20
-rw-r--r--examples/web/text/text_bmfont_ttf.c19
-rw-r--r--examples/web/text/text_bmfont_unordered.c17
-rw-r--r--examples/web/text/text_format_text.c19
-rw-r--r--examples/web/text/text_input_box.c17
-rw-r--r--examples/web/text/text_raylib_fonts.c19
-rw-r--r--examples/web/text/text_sprite_fonts.c19
-rw-r--r--examples/web/text/text_ttf_loading.c17
-rw-r--r--examples/web/text/text_writing_anim.c19
-rw-r--r--examples/web/textures/textures_image_drawing.c19
-rw-r--r--examples/web/textures/textures_image_generation.c20
-rw-r--r--examples/web/textures/textures_image_loading.c19
-rw-r--r--examples/web/textures/textures_image_processing.c19
-rw-r--r--examples/web/textures/textures_logo_raylib.c19
-rw-r--r--examples/web/textures/textures_particles_blending.c21
-rw-r--r--examples/web/textures/textures_raw_data.c19
-rw-r--r--examples/web/textures/textures_rectangle.c19
-rw-r--r--examples/web/textures/textures_srcrec_dstrec.c19
-rw-r--r--examples/web/textures/textures_to_image.c19
48 files changed, 746 insertions, 131 deletions
diff --git a/examples/web/audio/audio_module_playing.c b/examples/web/audio/audio_module_playing.c
index 2f0f8c1..a5af00e 100644
--- a/examples/web/audio/audio_module_playing.c
+++ b/examples/web/audio/audio_module_playing.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define MAX_CIRCLES 32
//----------------------------------------------------------------------------------
@@ -55,11 +59,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)");
+#endif
InitAudioDevice(); // Initialize audio device
@@ -98,8 +110,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/audio/audio_music_stream.c b/examples/web/audio/audio_music_stream.c
index da5ac83..e56fc30 100644
--- a/examples/web/audio/audio_music_stream.c
+++ b/examples/web/audio/audio_music_stream.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -37,12 +41,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)");
-
+#endif
+
InitAudioDevice(); // Initialize audio device
music = LoadMusicStream("resources/guitar_noodling.ogg");
@@ -69,8 +81,9 @@ int main()
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/audio/audio_raw_stream.c b/examples/web/audio/audio_raw_stream.c
index e3b4ad6..76a065f 100644
--- a/examples/web/audio/audio_raw_stream.c
+++ b/examples/web/audio/audio_raw_stream.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#include <stdlib.h> // Required for: malloc(), free()
#include <math.h> // Required for: sinf()
@@ -45,11 +49,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [audio] example - raw audio streaming");
+#endif
InitAudioDevice(); // Initialize audio device
@@ -91,8 +103,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/audio/audio_sound_loading.c b/examples/web/audio/audio_sound_loading.c
index e422f09..64a730c 100644
--- a/examples/web/audio/audio_sound_loading.c
+++ b/examples/web/audio/audio_sound_loading.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -34,11 +38,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing");
+#endif
InitAudioDevice(); // Initialize audio device
@@ -66,8 +78,9 @@ int main()
CloseAudioDevice(); // Close audio device
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_2d_camera.c b/examples/web/core/core_2d_camera.c
index 1f08ee2..1884899 100644
--- a/examples/web/core/core_2d_camera.c
+++ b/examples/web/core/core_2d_camera.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define MAX_BUILDINGS 100
//----------------------------------------------------------------------------------
@@ -37,12 +41,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera");
-
+#endif
+
int spacing = 0;
for (int i = 0; i < MAX_BUILDINGS; i++)
@@ -79,8 +91,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_3d_camera_first_person.c b/examples/web/core/core_3d_camera_first_person.c
index 2b489bc..66425a7 100644
--- a/examples/web/core/core_3d_camera_first_person.c
+++ b/examples/web/core/core_3d_camera_first_person.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define MAX_COLUMNS 20
//----------------------------------------------------------------------------------
@@ -42,12 +46,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person");
-
+#endif
+
for (int i = 0; i < MAX_COLUMNS; i++)
{
heights[i] = (float)GetRandomValue(1, 12);
@@ -75,8 +87,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_3d_camera_free.c b/examples/web/core/core_3d_camera_free.c
index ad3ad99..c1d3258 100644
--- a/examples/web/core/core_3d_camera_free.c
+++ b/examples/web/core/core_3d_camera_free.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -33,11 +37,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
+#endif
// Define the camera to look into our 3d world
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
@@ -64,8 +76,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_3d_mode.c b/examples/web/core/core_3d_mode.c
index f2ca6a6..38e9272 100644
--- a/examples/web/core/core_3d_mode.c
+++ b/examples/web/core/core_3d_mode.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -33,11 +37,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
+#endif
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
@@ -61,8 +73,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_3d_picking.c b/examples/web/core/core_3d_picking.c
index 2934c3f..96cdab6 100644
--- a/examples/web/core/core_3d_picking.c
+++ b/examples/web/core/core_3d_picking.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -39,12 +43,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking");
-
+#endif
+
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
@@ -69,8 +81,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_basic_window.c b/examples/web/core/core_basic_window.c
index 4d4e33d..b9e2828 100644
--- a/examples/web/core/core_basic_window.c
+++ b/examples/web/core/core_basic_window.c
@@ -19,6 +19,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -33,12 +37,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
-
+#endif
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
@@ -56,8 +68,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_color_select.c b/examples/web/core/core_color_select.c
index 2e28308..87e3f61 100644
--- a/examples/web/core/core_color_select.c
+++ b/examples/web/core/core_color_select.c
@@ -14,6 +14,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -36,11 +40,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
+#endif
Color tempColors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
@@ -74,8 +86,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_drop_files.c b/examples/web/core/core_drop_files.c
index ea61bdc..8078b64 100644
--- a/examples/web/core/core_drop_files.c
+++ b/examples/web/core/core_drop_files.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -33,12 +37,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
-
+#endif
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
@@ -58,8 +70,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_gestures_detection.c b/examples/web/core/core_gestures_detection.c
index 76037a4..b74f8c3 100644
--- a/examples/web/core/core_gestures_detection.c
+++ b/examples/web/core/core_gestures_detection.c
@@ -16,6 +16,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define MAX_GESTURE_STRINGS 20
//----------------------------------------------------------------------------------
@@ -41,11 +45,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - Gestures Detection");
+#endif
touchPosition = (Vector2){ 0, 0 };
touchArea = (Rectangle){ 220, 10, screenWidth - 230, screenHeight - 20 };
@@ -69,8 +81,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_input_gamepad.c b/examples/web/core/core_input_gamepad.c
index 9ba3d7e..d3349fc 100644
--- a/examples/web/core/core_input_gamepad.c
+++ b/examples/web/core/core_input_gamepad.c
@@ -21,6 +21,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
// NOTE: Gamepad name ID depends on drivers and OS
#if defined(PLATFORM_RPI)
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
@@ -47,11 +51,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
+#endif
texPs3Pad = LoadTexture("resources/ps3.png");
texXboxPad = LoadTexture("resources/xbox.png");
@@ -76,8 +88,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_input_keys.c b/examples/web/core/core_input_keys.c
index 5b4b488..4b08f3b 100644
--- a/examples/web/core/core_input_keys.c
+++ b/examples/web/core/core_input_keys.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -32,12 +36,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
-
+#endif
+
ballPosition = (Vector2){ (float)screenWidth/2, (float)screenHeight/2 };
#if defined(PLATFORM_WEB)
@@ -57,8 +69,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_input_mouse.c b/examples/web/core/core_input_mouse.c
index a4fc9b0..ed3057f 100644
--- a/examples/web/core/core_input_mouse.c
+++ b/examples/web/core/core_input_mouse.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -32,12 +36,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
-
+#endif
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
@@ -55,8 +67,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_mouse_wheel.c b/examples/web/core/core_mouse_wheel.c
index cc1385a..93d72bc 100644
--- a/examples/web/core/core_mouse_wheel.c
+++ b/examples/web/core/core_mouse_wheel.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -32,12 +36,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel");
-
+#endif
+
boxPositionY = screenHeight/2 - 40;
#if defined(PLATFORM_WEB)
@@ -57,8 +69,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_random_values.c b/examples/web/core/core_random_values.c
index 8d6ae26..0fd805f 100644
--- a/examples/web/core/core_random_values.c
+++ b/examples/web/core/core_random_values.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -32,12 +36,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
-
+#endif
+
randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
#if defined(PLATFORM_WEB)
@@ -57,8 +69,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_storage_values.c b/examples/web/core/core_storage_values.c
index 4cf995c..25b856c 100644
--- a/examples/web/core/core_storage_values.c
+++ b/examples/web/core/core_storage_values.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -37,12 +41,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - storage save/load values");
-
+#endif
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
@@ -60,8 +72,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
void UpdateDrawFrame(void)
diff --git a/examples/web/core/core_vr_simulator.c b/examples/web/core/core_vr_simulator.c
index fcfd320..0a90d1d 100644
--- a/examples/web/core/core_vr_simulator.c
+++ b/examples/web/core/core_vr_simulator.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -35,12 +39,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift");
-
+#endif
+
// Init VR simulator (Oculus Rift CV1 parameters)
InitVrSimulator(GetVrDeviceInfo(HMD_OCULUS_RIFT_CV1));
@@ -71,8 +83,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/core/core_world_screen.c b/examples/web/core/core_world_screen.c
index d490dc9..22ce58c 100644
--- a/examples/web/core/core_world_screen.c
+++ b/examples/web/core/core_world_screen.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -36,12 +40,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
-
+#endif
+
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
#if defined(PLATFORM_WEB)
@@ -61,8 +73,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
// Module Functions Definition
diff --git a/examples/web/shaders/shaders_custom_uniform.c b/examples/web/shaders/shaders_custom_uniform.c
index cfe38af..d660668 100644
--- a/examples/web/shaders/shaders_custom_uniform.c
+++ b/examples/web/shaders/shaders_custom_uniform.c
@@ -22,6 +22,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -50,12 +54,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - custom uniform variable");
+#endif
dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
diff --git a/examples/web/shaders/shaders_model_shader.c b/examples/web/shaders/shaders_model_shader.c
index 6c224c5..44cceb1 100644
--- a/examples/web/shaders/shaders_model_shader.c
+++ b/examples/web/shaders/shaders_model_shader.c
@@ -22,6 +22,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -45,12 +49,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader");
+#endif
dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
diff --git a/examples/web/shaders/shaders_postprocessing.c b/examples/web/shaders/shaders_postprocessing.c
index a5e7beb..67207a0 100644
--- a/examples/web/shaders/shaders_postprocessing.c
+++ b/examples/web/shaders/shaders_postprocessing.c
@@ -22,6 +22,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#define DEFAULT_VERTEX_SHADER "resources/shaders/glsl330/base.vs"
@@ -91,12 +95,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - postprocessing shader");
+#endif
dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
diff --git a/examples/web/shaders/shaders_shapes_textures.c b/examples/web/shaders/shaders_shapes_textures.c
index 8295f30..fe51dae 100644
--- a/examples/web/shaders/shaders_shapes_textures.c
+++ b/examples/web/shaders/shaders_shapes_textures.c
@@ -22,6 +22,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -39,12 +43,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - shapes and texture shaders");
-
+#endif
+
fudesumi = LoadTexture("resources/fudesumi.png");
// NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
diff --git a/examples/web/shapes/shapes_basic_shapes.c b/examples/web/shapes/shapes_basic_shapes.c
index a5e907d..1574025 100644
--- a/examples/web/shapes/shapes_basic_shapes.c
+++ b/examples/web/shapes/shapes_basic_shapes.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -29,12 +33,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing");
-
+#endif
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
@@ -52,8 +64,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/shapes/shapes_colors_palette.c b/examples/web/shapes/shapes_colors_palette.c
index bfecc10..aad827a 100644
--- a/examples/web/shapes/shapes_colors_palette.c
+++ b/examples/web/shapes/shapes_colors_palette.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -30,12 +34,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib color palette");
-
+#endif
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
@@ -53,8 +65,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/shapes/shapes_lines_bezier.c b/examples/web/shapes/shapes_lines_bezier.c
index 6aab2ca..475e309 100644
--- a/examples/web/shapes/shapes_lines_bezier.c
+++ b/examples/web/shapes/shapes_lines_bezier.c
@@ -15,6 +15,11 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -32,13 +37,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
SetConfigFlags(FLAG_MSAA_4X_HINT);
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - cubic-bezier lines");
-
+#endif
end = (Vector2){ screenWidth, screenHeight };
#if defined(PLATFORM_WEB)
@@ -58,8 +70,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/shapes/shapes_logo_raylib.c b/examples/web/shapes/shapes_logo_raylib.c
index ea17025..5c07337 100644
--- a/examples/web/shapes/shapes_logo_raylib.c
+++ b/examples/web/shapes/shapes_logo_raylib.c
@@ -15,13 +15,16 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
@@ -30,12 +33,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo using shapes");
-
+#endif
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
@@ -53,8 +64,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/shapes/shapes_logo_raylib_anim.c b/examples/web/shapes/shapes_logo_raylib_anim.c
index 238cf84..9cb494c 100644
--- a/examples/web/shapes/shapes_logo_raylib_anim.c
+++ b/examples/web/shapes/shapes_logo_raylib_anim.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -36,7 +40,6 @@ int rightSideRecHeight = 16;
int state = 0; // Tracking animation states (State Machine)
float alpha = 1.0f; // Useful for fading
-
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
@@ -45,12 +48,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo animation");
-
+#endif
+
logoPositionX = screenWidth/2 - 128;
logoPositionY = screenHeight/2 - 128;
@@ -71,8 +82,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/text/text_bmfont_ttf.c b/examples/web/text/text_bmfont_ttf.c
index 41466e8..3c1cb6b 100644
--- a/examples/web/text/text_bmfont_ttf.c
+++ b/examples/web/text/text_bmfont_ttf.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -38,12 +42,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [text] example - bmfont and ttf sprite fonts loading");
-
+#endif
+
fontBm = LoadSpriteFont("resources/bmfont.fnt"); // BMFont (AngelCode)
fontTtf = LoadSpriteFont("resources/pixantiqua.ttf"); // TTF font
@@ -70,8 +82,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/text/text_bmfont_unordered.c b/examples/web/text/text_bmfont_unordered.c
index a42c39a..ffd2454 100644
--- a/examples/web/text/text_bmfont_unordered.c
+++ b/examples/web/text/text_bmfont_unordered.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -35,11 +39,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [text] example - bmfont unordered loading and drawing");
+#endif
// NOTE: Loaded font has an unordered list of characters (chars in the range 32..255)
font = LoadSpriteFont("resources/pixantiqua.fnt"); // BMFont (AngelCode)
@@ -63,8 +75,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/text/text_format_text.c b/examples/web/text/text_format_text.c
index c941935..13ecb9a 100644
--- a/examples/web/text/text_format_text.c
+++ b/examples/web/text/text_format_text.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -33,12 +37,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [text] example - text formatting");
-
+#endif
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
@@ -56,8 +68,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/text/text_input_box.c b/examples/web/text/text_input_box.c
index 5765df9..70ac08c 100644
--- a/examples/web/text/text_input_box.c
+++ b/examples/web/text/text_input_box.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -39,11 +43,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [text] example - input box");
+#endif
textBox = (Rectangle){ screenWidth/2 - 100, 180, 225, 50 };
@@ -64,8 +76,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/text/text_raylib_fonts.c b/examples/web/text/text_raylib_fonts.c
index 340b78f..45f0f51 100644
--- a/examples/web/text/text_raylib_fonts.c
+++ b/examples/web/text/text_raylib_fonts.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define MAX_FONTS 8
//----------------------------------------------------------------------------------
@@ -38,12 +42,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts");
-
+#endif
+
Color tempColors[MAX_FONTS] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, RED };
colors = tempColors;
@@ -100,8 +112,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/text/text_sprite_fonts.c b/examples/web/text/text_sprite_fonts.c
index 42d41d0..724d290 100644
--- a/examples/web/text/text_sprite_fonts.c
+++ b/examples/web/text/text_sprite_fonts.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -39,12 +43,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [text] example - sprite fonts usage");
-
+#endif
+
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
font1 = LoadSpriteFont("resources/custom_mecha.png"); // SpriteFont loading
font2 = LoadSpriteFont("resources/custom_alagard.png"); // SpriteFont loading
@@ -79,8 +91,9 @@ int main()
UnloadSpriteFont(font3); // SpriteFont unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/text/text_ttf_loading.c b/examples/web/text/text_ttf_loading.c
index 0209743..bb2fc2b 100644
--- a/examples/web/text/text_ttf_loading.c
+++ b/examples/web/text/text_ttf_loading.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -43,11 +47,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [text] example - ttf loading");
+#endif
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
@@ -85,8 +97,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/text/text_writing_anim.c b/examples/web/text/text_writing_anim.c
index 1522a06..c01c30c 100644
--- a/examples/web/text/text_writing_anim.c
+++ b/examples/web/text/text_writing_anim.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -33,12 +37,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [text] example - text writing anim");
-
+#endif
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
@@ -56,8 +68,9 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_image_drawing.c b/examples/web/textures/textures_image_drawing.c
index 3e0dd47..4e0508f 100644
--- a/examples/web/textures/textures_image_drawing.c
+++ b/examples/web/textures/textures_image_drawing.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -33,12 +37,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [textures] example - image drawing");
-
+#endif
+
Image cat = LoadImage("resources/cat.png"); // Load image in CPU memory (RAM)
ImageCrop(&cat, (Rectangle){ 100, 10, 280, 380 }); // Crop an image piece
ImageFlipHorizontal(&cat); // Flip cropped image horizontally
@@ -74,8 +86,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_image_generation.c b/examples/web/textures/textures_image_generation.c
index 9932ab6..e5dba4a 100644
--- a/examples/web/textures/textures_image_generation.c
+++ b/examples/web/textures/textures_image_generation.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define NUM_TEXTURES 7 // Currently we have 7 generation algorithms
//----------------------------------------------------------------------------------
@@ -35,14 +39,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
-
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [textures] example - procedural images generation");
+#endif
Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE);
Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE);
@@ -90,8 +99,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_image_loading.c b/examples/web/textures/textures_image_loading.c
index 6455221..17680a0 100644
--- a/examples/web/textures/textures_image_loading.c
+++ b/examples/web/textures/textures_image_loading.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -34,12 +38,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [textures] example - image loading");
-
+#endif
+
Image image = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (VRAM)
UnloadImage(image); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
@@ -64,8 +76,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_image_processing.c b/examples/web/textures/textures_image_processing.c
index 39b40fe..68b894e 100644
--- a/examples/web/textures/textures_image_processing.c
+++ b/examples/web/textures/textures_image_processing.c
@@ -19,6 +19,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define NUM_PROCESSES 8
//----------------------------------------------------------------------------------
@@ -65,12 +69,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [textures] example - image processing");
-
+#endif
+
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
image = LoadImage("resources/parrots.png"); // Loaded in CPU memory (RAM)
@@ -99,8 +111,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_logo_raylib.c b/examples/web/textures/textures_logo_raylib.c
index 836735a..a5f1154 100644
--- a/examples/web/textures/textures_logo_raylib.c
+++ b/examples/web/textures/textures_logo_raylib.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -32,12 +36,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture loading and drawing");
-
+#endif
+
texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
#if defined(PLATFORM_WEB)
@@ -59,8 +71,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_particles_blending.c b/examples/web/textures/textures_particles_blending.c
index 1ddacf8..c9f468a 100644
--- a/examples/web/textures/textures_particles_blending.c
+++ b/examples/web/textures/textures_particles_blending.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define MAX_PARTICLES 200
//----------------------------------------------------------------------------------
@@ -50,13 +54,21 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [textures] example - particles blending");
-
- // Initialize particles
+#endif
+
+ // Initialize particles
for (int i = 0; i < MAX_PARTICLES; i++)
{
mouseTail[i].position = (Vector2){ 0, 0 };
@@ -88,8 +100,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_raw_data.c b/examples/web/textures/textures_raw_data.c
index f06c798..f3fe93e 100644
--- a/examples/web/textures/textures_raw_data.c
+++ b/examples/web/textures/textures_raw_data.c
@@ -19,6 +19,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -36,12 +40,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture from raw data");
-
+#endif
+
// Load RAW image data (512x512, 32bit RGBA, no file header)
Image fudesumiRaw = LoadImageRaw("resources/fudesumi.raw", 384, 512, UNCOMPRESSED_R8G8B8A8, 0);
fudesumi = LoadTextureFromImage(fudesumiRaw); // Upload CPU (RAM) image to GPU (VRAM)
@@ -91,8 +103,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_rectangle.c b/examples/web/textures/textures_rectangle.c
index 0783f88..3efe9a0 100644
--- a/examples/web/textures/textures_rectangle.c
+++ b/examples/web/textures/textures_rectangle.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define MAX_FRAME_SPEED 15
#define MIN_FRAME_SPEED 1
@@ -43,12 +47,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle");
-
+#endif
+
scarfy = LoadTexture("resources/scarfy.png"); // Texture loading
position = (Vector2){ 350.0f, 280.0f };
@@ -74,8 +86,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_srcrec_dstrec.c b/examples/web/textures/textures_srcrec_dstrec.c
index 5a93818..3eadacb 100644
--- a/examples/web/textures/textures_srcrec_dstrec.c
+++ b/examples/web/textures/textures_srcrec_dstrec.c
@@ -15,6 +15,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -41,12 +45,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [textures] examples - texture source and destination rectangles");
-
+#endif
+
scarfy = LoadTexture("resources/scarfy.png"); // Texture loading
frameWidth = scarfy.width/6;
@@ -82,8 +94,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/textures/textures_to_image.c b/examples/web/textures/textures_to_image.c
index df7b458..eb494d5 100644
--- a/examples/web/textures/textures_to_image.c
+++ b/examples/web/textures/textures_to_image.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -37,12 +41,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture to image");
-
+#endif
+
image = LoadImage("resources/raylib_logo.png"); // Load image data into CPU memory (RAM)
texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (RAM -> VRAM)
UnloadImage(image); // Unload image data from CPU memory (RAM)
@@ -72,8 +84,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------