summaryrefslogtreecommitdiffhomepage
path: root/examples/web/core
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/web/core
parente4041e4eb8c55db0a37c8af575c7a98c17963a9a (diff)
downloadraylib.com-d918334a2e1ce32961c0797a4b13fdd5b4ce5630.tar.gz
raylib.com-d918334a2e1ce32961c0797a4b13fdd5b4ce5630.zip
Updated to support Android platform
Diffstat (limited to 'examples/web/core')
-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
17 files changed, 267 insertions, 46 deletions
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