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