From d918334a2e1ce32961c0797a4b13fdd5b4ce5630 Mon Sep 17 00:00:00 2001 From: Ray San Date: Fri, 3 Nov 2017 20:01:48 +0100 Subject: Updated to support Android platform --- examples/web/shaders/shaders_custom_uniform.c | 14 +++++++++++++- examples/web/shaders/shaders_model_shader.c | 14 +++++++++++++- examples/web/shaders/shaders_postprocessing.c | 14 +++++++++++++- examples/web/shaders/shaders_shapes_textures.c | 16 ++++++++++++++-- 4 files changed, 53 insertions(+), 5 deletions(-) (limited to 'examples/web/shaders') 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 #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 #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 #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 #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 -- cgit v1.2.3