From 6e5ceaa30d577dd2e2e8b03c3d9eb16680d6834e Mon Sep 17 00:00:00 2001 From: victorfisac Date: Wed, 30 Dec 2015 03:12:52 +0100 Subject: Fixed Android compilation with 1.3 updates - Fixed Android MakeFile adding gestures module. - Fixed Android project template functions names. - Updated compiled library and header. --- templates/android_project/jni/basic_game.c | 6 +- templates/android_project/jni/include/raylib.h | 177 +++++++++++++++++++++++-- templates/android_project/jni/libs/libraylib.a | Bin 1449204 -> 1536620 bytes 3 files changed, 171 insertions(+), 12 deletions(-) (limited to 'templates') diff --git a/templates/android_project/jni/basic_game.c b/templates/android_project/jni/basic_game.c index 987599a8..bf2d5d02 100644 --- a/templates/android_project/jni/basic_game.c +++ b/templates/android_project/jni/basic_game.c @@ -70,7 +70,7 @@ void android_main(struct android_app *app) // TODO: Update TITLE screen variables here! // Press enter to change to GAMEPLAY screen - if (IsScreenTouched()) + if (IsGestureDetected()) { PlaySound(fx); currentScreen = GAMEPLAY; @@ -81,7 +81,7 @@ void android_main(struct android_app *app) // TODO: Update GAMEPLAY screen variables here! // Press enter to change to ENDING screen - if (IsScreenTouched()) + if (IsGestureDetected()) { PlaySound(fx); currentScreen = ENDING; @@ -92,7 +92,7 @@ void android_main(struct android_app *app) // TODO: Update ENDING screen variables here! // Press enter to return to TITLE screen - if (IsScreenTouched()) + if (IsGestureDetected()) { PlaySound(fx); currentScreen = TITLE; diff --git a/templates/android_project/jni/include/raylib.h b/templates/android_project/jni/include/raylib.h index b14ae082..4eefa3ea 100644 --- a/templates/android_project/jni/include/raylib.h +++ b/templates/android_project/jni/include/raylib.h @@ -117,10 +117,53 @@ #define KEY_RIGHT_CONTROL 345 #define KEY_RIGHT_ALT 346 +// Keyboard Alhpa Numeric Keys +#define KEY_ZERO 48 +#define KEY_ONE 49 +#define KEY_TWO 50 +#define KEY_THREE 51 +#define KEY_FOUR 52 +#define KEY_FIVE 53 +#define KEY_SIX 54 +#define KEY_SEVEN 55 +#define KEY_EIGHT 56 +#define KEY_NINE 57 +#define KEY_A 65 +#define KEY_B 66 +#define KEY_C 67 +#define KEY_D 68 +#define KEY_E 69 +#define KEY_F 70 +#define KEY_G 71 +#define KEY_H 72 +#define KEY_I 73 +#define KEY_J 74 +#define KEY_K 75 +#define KEY_L 76 +#define KEY_M 77 +#define KEY_N 78 +#define KEY_O 79 +#define KEY_P 80 +#define KEY_Q 81 +#define KEY_R 82 +#define KEY_S 83 +#define KEY_T 84 +#define KEY_U 85 +#define KEY_V 86 +#define KEY_W 87 +#define KEY_X 88 +#define KEY_Y 89 +#define KEY_Z 90 + // Mouse Buttons #define MOUSE_LEFT_BUTTON 0 -#define MOUSE_RIGHT_BUTTON 1 -#define MOUSE_MIDDLE_BUTTON 2 +#if defined(PLATFORM_WEB) + #define MOUSE_RIGHT_BUTTON 2 + #define MOUSE_MIDDLE_BUTTON 1 +#else + #define MOUSE_RIGHT_BUTTON 1 + #define MOUSE_MIDDLE_BUTTON 2 +#endif // Gamepad Number #define GAMEPAD_PLAYER1 0 @@ -286,7 +329,9 @@ typedef struct Shader { // Uniforms int projectionLoc; // Projection matrix uniform location point (vertex shader) - int modelviewLoc; // ModeView matrix uniform location point (vertex shader) + int modelviewLoc; // ModelView matrix uniform location point (vertex shader) + int modelLoc; // Model transformation matrix uniform location point (vertex shader) + int viewLoc; // View transformation matrix uniform location point (vertex shader) int tintColorLoc; // Color uniform location point (fragment shader) int mapDiffuseLoc; // Diffuse map texture uniform location point (fragment shader) @@ -323,6 +368,26 @@ typedef struct Wave { short channels; } Wave; +// Light type +typedef struct Light { + float position[3]; + float rotation[3]; + float intensity[1]; + float ambientColor[3]; + float diffuseColor[3]; + float specularColor[3]; + float specularIntensity[1]; +} Light; + +// Material type +typedef struct Material { + float ambientColor[3]; + float diffuseColor[3]; + float specularColor[3]; + float glossiness[1]; + float normalDepth[1]; +} Material; + // Texture formats // NOTE: Support depends on OpenGL version and platform typedef enum { @@ -368,6 +433,44 @@ typedef enum { // Camera system modes typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON } CameraMode; +// Collider types +typedef enum { RectangleCollider, CircleCollider } ColliderType; + +// Physics struct +typedef struct Physics { + bool enabled; + bool debug; // Should be used by programmer for testing purposes + Vector2 gravity; +} Physics; + +// Transform struct +typedef struct Transform { + Vector2 position; + float rotation; + Vector2 scale; +} Transform; + +// Rigidbody struct +typedef struct Rigidbody { + bool enabled; + float mass; + Vector2 acceleration; + Vector2 velocity; + bool isGrounded; + bool isContact; // Avoid freeze player when touching floor + bool applyGravity; + float friction; // 0.0f to 1.0f + float bounciness; // 0.0f to 1.0f +} Rigidbody; + +// Collider struct +typedef struct Collider { + bool enabled; + ColliderType type; + Rectangle bounds; // Just used for RectangleCollider type + int radius; // Just used for CircleCollider type +} Collider; + #ifdef __cplusplus extern "C" { // Prevents name mangling of functions #endif @@ -399,6 +502,7 @@ int GetScreenHeight(void); // Get current scree void ClearBackground(Color color); // Sets Background Color void BeginDrawing(void); // Setup drawing canvas to start drawing +void BeginDrawingEx(int blendMode, Shader shader, Matrix transform); // Setup drawing canvas with extended parameters void EndDrawing(void); // End canvas drawing and Swap Buffers (Double Buffering) void Begin3dMode(Camera cam); // Initializes 3D mode for drawing (Camera setup) @@ -458,13 +562,14 @@ bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad b #endif #if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB) -//------------------------------------------------------------------------------------ -// Gestures and Touch Handling Functions (Module: gestures) -//------------------------------------------------------------------------------------ int GetTouchX(void); // Returns touch position X (relative to screen size) int GetTouchY(void); // Returns touch position Y (relative to screen size) Vector2 GetTouchPosition(void); // Returns touch position XY (relative to screen size) +//------------------------------------------------------------------------------------ +// Gestures and Touch Handling Functions (Module: gestures) +//------------------------------------------------------------------------------------ +Vector2 GetRawTouchPosition(void); // Get touch position (raw) #if defined(PLATFORM_WEB) void InitGesturesSystem(void); // Init gestures system (web) #elif defined(PLATFORM_ANDROID) @@ -540,16 +645,30 @@ Image LoadImageEx(Color *pixels, int width, int height); Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image data from RAW file Image LoadImageFromRES(const char *rresName, int resId); // Load an image from rRES file (raylib Resource) Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory -Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat, int mipmapCount); // Load a texture from raw data into GPU memory +Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat); // Load a texture from raw data into GPU memory Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource) Texture2D LoadTextureFromImage(Image image); // Load a texture from image data void UnloadImage(Image image); // Unload image from CPU memory (RAM) void UnloadTexture(Texture2D texture); // Unload texture from GPU memory Color *GetImageData(Image image); // Get pixel data from image as a Color struct array Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image -void ImageConvertToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) -void ImageConvertFormat(Image *image, int newFormat); // Convert image data to desired format +void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) +void ImageFormat(Image *image, int newFormat); // Convert image data to desired format +Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) +void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle +void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering) +void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image +Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font) +Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int spacing, Color tint); // Create an image from text (custom sprite font) +void ImageFlipVertical(Image *image); // Flip image vertically +void ImageFlipHorizontal(Image *image); // Flip image horizontally +void ImageColorTint(Image *image, Color color); // Modify image color: tint +void ImageColorInvert(Image *image); // Modify image color: invert +void ImageColorGrayscale(Image *image); // Modify bimage color: grayscale +void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100) +void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255) void GenTextureMipmaps(Texture2D texture); // Generate GPU mipmaps for a texture +void UpdateTexture(Texture2D texture, void *pixels); // Update GPU texture with new data void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2 @@ -607,6 +726,7 @@ void SetModelTexture(Model *model, Texture2D texture); void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set) void DrawModelEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model with extended parameters void DrawModelWires(Model model, Vector3 position, float scale, Color color); // Draw a model wires (with texture if set) +void DrawModelWiresEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec @@ -640,6 +760,45 @@ void SetShaderMap(Shader *shader, int mapLocation, Texture2D texture, int textur void SetBlendMode(int mode); // Set blending mode (alpha, additive, multiplied) +//---------------------------------------------------------------------------------- +// Lighting System Functions (engine-module: lighting) +// NOTE: light and material structs uses float pointers instead of vectors to be compatible with SetShaderValue() +//---------------------------------------------------------------------------------- +// Lights functions +void SetLightPosition(Light *light, Vector3 position); // Set light position converting position vector to float pointer +void SetLightRotation(Light *light, Vector3 rotation); // Set light rotation converting rotation vector to float pointer +void SetLightIntensity(Light *light, float intensity); // Set light intensity value +void SetLightAmbientColor(Light *light, Vector3 color); // Set light ambient color value (it will be multiplied by material ambient color) +void SetLightDiffuseColor(Light *light, Vector3 color); // Set light diffuse color (light color) +void SetLightSpecularColor(Light *light, Vector3 color); // Set light specular color (it will be multiplied by material specular color) +void SetLightSpecIntensity(Light *light, float specIntensity); // Set light specular intensity (specular color scalar multiplier) + +// Materials functions +void SetMaterialAmbientColor(Material *material, Vector3 color); // Set material ambient color value (it will be multiplied by light ambient color) +void SetMaterialDiffuseColor(Material *material, Vector3 color); // Set material diffuse color (material color, should use DrawModel() tint parameter) +void SetMaterialSpecularColor(Material *material, Vector3 color); // Set material specular color (it will be multiplied by light specular color) +void SetMaterialGlossiness(Material *material, float glossiness); // Set material glossiness value (recommended values: 0 - 100) +void SetMaterialNormalDepth(Material *material, float depth); // Set normal map depth (B component from RGB type map scalar multiplier) + +//---------------------------------------------------------------------------------- +// Physics System Functions (engine-module: physics) +//---------------------------------------------------------------------------------- +void InitPhysics(); // Initialize all internal physics values +void SetPhysics(Physics settings); // Set physics settings values using Physics data type to overwrite internal physics settings + +void AddRigidbody(int index, Rigidbody rigidbody); // Initialize a new rigidbody with parameters to internal index slot +void AddCollider(int index, Collider collider); // Initialize a new Collider with parameters to internal index slot + +void ApplyPhysics(int index, Vector2 *position); // Apply physics to internal rigidbody, physics calculations are applied to position pointer parameter +void SetRigidbodyEnabled(int index, bool state); // Set enabled state to a defined rigidbody +void SetRigidbodyVelocity(int index, Vector2 velocity); // Set velocity of rigidbody (without considering of mass value) +void AddRigidbodyForce(int index, Vector2 force); // Set rigidbody force (considering mass value) + +void SetColliderEnabled(int index, bool state); // Set enabled state to a defined collider + +Rigidbody GetRigidbody(int index); // Returns the internal rigidbody data defined by index parameter +Collider GetCollider(int index); // Returns the internal collider data defined by index parameter + //------------------------------------------------------------------------------------ // Audio Loading and Playing Functions (Module: audio) //------------------------------------------------------------------------------------ diff --git a/templates/android_project/jni/libs/libraylib.a b/templates/android_project/jni/libs/libraylib.a index 3e8cce7d..35d3e07d 100644 Binary files a/templates/android_project/jni/libs/libraylib.a and b/templates/android_project/jni/libs/libraylib.a differ -- cgit v1.2.3 From 8e30bd1f697b793babd183b6d172cdbd7b679d80 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Wed, 30 Dec 2015 04:43:24 +0100 Subject: Fixed and improved android template - Added gestures module functions. - Fixed screen tap detection. --- templates/android_project/jni/basic_game.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'templates') diff --git a/templates/android_project/jni/basic_game.c b/templates/android_project/jni/basic_game.c index bf2d5d02..482011a0 100644 --- a/templates/android_project/jni/basic_game.c +++ b/templates/android_project/jni/basic_game.c @@ -30,8 +30,9 @@ void android_main(struct android_app *app) const int screenHeight = 450; GameScreen currentScreen = LOGO; - + InitWindow(screenWidth, screenHeight, app); + InitGesturesSystem(app); // TODO: Initialize all required variables and load all required data here! @@ -50,7 +51,7 @@ void android_main(struct android_app *app) while (!WindowShouldClose()) // Detect window close button or ESC key { // Update - //---------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------- switch(currentScreen) { case LOGO: @@ -70,7 +71,7 @@ void android_main(struct android_app *app) // TODO: Update TITLE screen variables here! // Press enter to change to GAMEPLAY screen - if (IsGestureDetected()) + if (GetGestureType() == GESTURE_TAP) { PlaySound(fx); currentScreen = GAMEPLAY; @@ -81,8 +82,8 @@ void android_main(struct android_app *app) // TODO: Update GAMEPLAY screen variables here! // Press enter to change to ENDING screen - if (IsGestureDetected()) - { + if (GetGestureType() == GESTURE_TAP) + { PlaySound(fx); currentScreen = ENDING; } @@ -92,7 +93,7 @@ void android_main(struct android_app *app) // TODO: Update ENDING screen variables here! // Press enter to return to TITLE screen - if (IsGestureDetected()) + if (GetGestureType() == GESTURE_TAP) { PlaySound(fx); currentScreen = TITLE; @@ -100,6 +101,8 @@ void android_main(struct android_app *app) } break; default: break; } + + UpdateGestures(); //---------------------------------------------------------------------------------- // Draw -- cgit v1.2.3 From 5335f262be89c13271fe4dbaac53c97f6158806d Mon Sep 17 00:00:00 2001 From: raysan5 Date: Thu, 31 Dec 2015 13:34:03 +0100 Subject: Updated makefiles --- templates/advance_game/makefile | 15 +++++++++------ templates/basic_game/makefile | 17 ++++++++++------- templates/basic_test/makefile | 19 +++++++++++-------- templates/simple_game/makefile | 17 ++++++++++------- templates/standard_game/makefile | 17 ++++++++++------- 5 files changed, 50 insertions(+), 35 deletions(-) (limited to 'templates') diff --git a/templates/advance_game/makefile b/templates/advance_game/makefile index 80e9357c..b6dfc534 100644 --- a/templates/advance_game/makefile +++ b/templates/advance_game/makefile @@ -83,7 +83,7 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads else - INCLUDES = -I. -I../../src + INCLUDES = -I. -I../../src -IC:/raylib/raylib/src # external libraries headers # GLFW3 INCLUDES += -I../../external/glfw3/include @@ -97,7 +97,7 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) LFLAGS = -L. -L../../src -L/opt/vc/lib else - LFLAGS = -L. -L../../src + LFLAGS = -L. -L../../src -LC:/raylib/raylib/src # external libraries to link with # GLFW3 LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) @@ -115,8 +115,10 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),LINUX) # libraries for Debian GNU/Linux desktop compiling # requires the following packages: - # libopenal-dev libglew-dev libegl1-mesa-dev - LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -pthread + # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev + LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread + # on XWindow could require also below libraries, just uncomment + #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor else ifeq ($(PLATFORM_OS),OSX) # libraries for OS X 10.9 desktop compiling @@ -136,14 +138,15 @@ ifeq ($(PLATFORM),PLATFORM_RPI) LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal endif ifeq ($(PLATFORM),PLATFORM_WEB) - LIBS = ../../src/libraylib.bc + # just adjust the correct path to libraylib.bc + LIBS = C:/raylib/raylib/src/libraylib.bc endif # define additional parameters and flags for windows ifeq ($(PLATFORM_OS),WINDOWS) # resources file contains windows exe icon # -Wl,--subsystem,windows hides the console window - WINFLAGS = ../../src/resources -Wl,--subsystem,windows + WINFLAGS = C:/raylib/raylib/src/resources -Wl,--subsystem,windows endif ifeq ($(PLATFORM),PLATFORM_WEB) diff --git a/templates/basic_game/makefile b/templates/basic_game/makefile index 5ce3aa3e..9a52c4eb 100644 --- a/templates/basic_game/makefile +++ b/templates/basic_game/makefile @@ -83,7 +83,7 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads else - INCLUDES = -I. -I../../src + INCLUDES = -I. -I../../src -IC:/raylib/raylib/src # external libraries headers # GLFW3 INCLUDES += -I../../external/glfw3/include @@ -97,14 +97,14 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) LFLAGS = -L. -L../../src -L/opt/vc/lib else - LFLAGS = -L. -L../../src + LFLAGS = -L. -L../../src -LC:/raylib/raylib/src # external libraries to link with # GLFW3 LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) ifneq ($(PLATFORM_OS),OSX) # OpenAL Soft LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH) - # GLEW + # GLEW LFLAGS += -L../../external/glew/lib/$(LIBPATH) endif endif @@ -115,8 +115,10 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),LINUX) # libraries for Debian GNU/Linux desktop compiling # requires the following packages: - # libopenal-dev libglew-dev libegl1-mesa-dev - LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -pthread + # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev + LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread + # on XWindow could require also below libraries, just uncomment + #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor else ifeq ($(PLATFORM_OS),OSX) # libraries for OS X 10.9 desktop compiling @@ -136,14 +138,15 @@ ifeq ($(PLATFORM),PLATFORM_RPI) LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal endif ifeq ($(PLATFORM),PLATFORM_WEB) - LIBS = ../../src/libraylib.bc + # just adjust the correct path to libraylib.bc + LIBS = C:/raylib/raylib/src/libraylib.bc endif # define additional parameters and flags for windows ifeq ($(PLATFORM_OS),WINDOWS) # resources file contains windows exe icon # -Wl,--subsystem,windows hides the console window - WINFLAGS = ../../src/resources -Wl,--subsystem,windows + WINFLAGS = C:/raylib/raylib/src/resources -Wl,--subsystem,windows endif ifeq ($(PLATFORM),PLATFORM_WEB) diff --git a/templates/basic_test/makefile b/templates/basic_test/makefile index cf763628..a0ed2608 100644 --- a/templates/basic_test/makefile +++ b/templates/basic_test/makefile @@ -83,7 +83,7 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads else - INCLUDES = -I. -I../../src + INCLUDES = -I. -I../../src -IC:/raylib/raylib/src # external libraries headers # GLFW3 INCLUDES += -I../../external/glfw3/include @@ -97,14 +97,14 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) LFLAGS = -L. -L../../src -L/opt/vc/lib else - LFLAGS = -L. -L../../src + LFLAGS = -L. -L../../src -LC:/raylib/raylib/src # external libraries to link with # GLFW3 LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) ifneq ($(PLATFORM_OS),OSX) # OpenAL Soft LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH) - # GLEW + # GLEW LFLAGS += -L../../external/glew/lib/$(LIBPATH) endif endif @@ -115,11 +115,13 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),LINUX) # libraries for Debian GNU/Linux desktop compiling # requires the following packages: - # libopenal-dev libglew-dev libegl1-mesa-dev - LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -pthread + # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev + LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread + # on XWindow could require also below libraries, just uncomment + #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor else ifeq ($(PLATFORM_OS),OSX) - # libraries for OS X 10.9 desktop compiling + # libraries for OS X 10.9 desktop compiling # requires the following packages: # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa @@ -136,14 +138,15 @@ ifeq ($(PLATFORM),PLATFORM_RPI) LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal endif ifeq ($(PLATFORM),PLATFORM_WEB) - LIBS = ../../src/libraylib.bc + # just adjust the correct path to libraylib.bc + LIBS = C:/raylib/raylib/src/libraylib.bc endif # define additional parameters and flags for windows ifeq ($(PLATFORM_OS),WINDOWS) # resources file contains windows exe icon # -Wl,--subsystem,windows hides the console window - WINFLAGS = ../../src/resources -Wl,--subsystem,windows + WINFLAGS = C:/raylib/raylib/src/resources -Wl,--subsystem,windows endif ifeq ($(PLATFORM),PLATFORM_WEB) diff --git a/templates/simple_game/makefile b/templates/simple_game/makefile index 586233a7..30216e5d 100644 --- a/templates/simple_game/makefile +++ b/templates/simple_game/makefile @@ -83,7 +83,7 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads else - INCLUDES = -I. -I../../src + INCLUDES = -I. -I../../src -IC:/raylib/raylib/src # external libraries headers # GLFW3 INCLUDES += -I../../external/glfw3/include @@ -97,14 +97,14 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) LFLAGS = -L. -L../../src -L/opt/vc/lib else - LFLAGS = -L. -L../../src + LFLAGS = -L. -L../../src -LC:/raylib/raylib/src # external libraries to link with # GLFW3 LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) ifneq ($(PLATFORM_OS),OSX) # OpenAL Soft LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH) - # GLEW + # GLEW LFLAGS += -L../../external/glew/lib/$(LIBPATH) endif endif @@ -115,8 +115,10 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),LINUX) # libraries for Debian GNU/Linux desktop compiling # requires the following packages: - # libopenal-dev libglew-dev libegl1-mesa-dev - LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -pthread + # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev + LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread + # on XWindow could require also below libraries, just uncomment + #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor else ifeq ($(PLATFORM_OS),OSX) # libraries for OS X 10.9 desktop compiling @@ -136,14 +138,15 @@ ifeq ($(PLATFORM),PLATFORM_RPI) LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal endif ifeq ($(PLATFORM),PLATFORM_WEB) - LIBS = ../../src/libraylib.bc + # just adjust the correct path to libraylib.bc + LIBS = C:/raylib/raylib/src/libraylib.bc endif # define additional parameters and flags for windows ifeq ($(PLATFORM_OS),WINDOWS) # resources file contains windows exe icon # -Wl,--subsystem,windows hides the console window - WINFLAGS = ../../src/resources -Wl,--subsystem,windows + WINFLAGS = C:/raylib/raylib/src/resources -Wl,--subsystem,windows endif ifeq ($(PLATFORM),PLATFORM_WEB) diff --git a/templates/standard_game/makefile b/templates/standard_game/makefile index cdb42f53..ec847b0e 100644 --- a/templates/standard_game/makefile +++ b/templates/standard_game/makefile @@ -83,7 +83,7 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads else - INCLUDES = -I. -I../../src + INCLUDES = -I. -I../../src -IC:/raylib/raylib/src # external libraries headers # GLFW3 INCLUDES += -I../../external/glfw3/include @@ -97,14 +97,14 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) LFLAGS = -L. -L../../src -L/opt/vc/lib else - LFLAGS = -L. -L../../src + LFLAGS = -L. -L../../src -LC:/raylib/raylib/src # external libraries to link with # GLFW3 LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) ifneq ($(PLATFORM_OS),OSX) # OpenAL Soft LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH) - # GLEW + # GLEW LFLAGS += -L../../external/glew/lib/$(LIBPATH) endif endif @@ -115,8 +115,10 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),LINUX) # libraries for Debian GNU/Linux desktop compiling # requires the following packages: - # libopenal-dev libglew-dev libegl1-mesa-dev - LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -pthread + # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev + LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread + # on XWindow could require also below libraries, just uncomment + #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor else ifeq ($(PLATFORM_OS),OSX) # libraries for OS X 10.9 desktop compiling @@ -136,14 +138,15 @@ ifeq ($(PLATFORM),PLATFORM_RPI) LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal endif ifeq ($(PLATFORM),PLATFORM_WEB) - LIBS = ../../src/libraylib.bc + # just adjust the correct path to libraylib.bc + LIBS = C:/raylib/raylib/src/libraylib.bc endif # define additional parameters and flags for windows ifeq ($(PLATFORM_OS),WINDOWS) # resources file contains windows exe icon # -Wl,--subsystem,windows hides the console window - WINFLAGS = ../../src/resources -Wl,--subsystem,windows + WINFLAGS = C:/raylib/raylib/src/resources -Wl,--subsystem,windows endif ifeq ($(PLATFORM),PLATFORM_WEB) -- cgit v1.2.3 From 46ea55659393447c33c412cf19a42deecebaa98e Mon Sep 17 00:00:00 2001 From: raysan5 Date: Thu, 31 Dec 2015 13:34:45 +0100 Subject: Gestures system is automatically Init and Updated --- templates/android_project/jni/basic_game.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'templates') diff --git a/templates/android_project/jni/basic_game.c b/templates/android_project/jni/basic_game.c index 482011a0..e8a7e67a 100644 --- a/templates/android_project/jni/basic_game.c +++ b/templates/android_project/jni/basic_game.c @@ -32,7 +32,6 @@ void android_main(struct android_app *app) GameScreen currentScreen = LOGO; InitWindow(screenWidth, screenHeight, app); - InitGesturesSystem(app); // TODO: Initialize all required variables and load all required data here! @@ -51,7 +50,7 @@ void android_main(struct android_app *app) while (!WindowShouldClose()) // Detect window close button or ESC key { // Update - //---------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------- switch(currentScreen) { case LOGO: @@ -101,8 +100,6 @@ void android_main(struct android_app *app) } break; default: break; } - - UpdateGestures(); //---------------------------------------------------------------------------------- // Draw -- cgit v1.2.3 From 3a739c38c591687d0e298a85f1e7bfe4666076bd Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 3 Jan 2016 13:01:42 +0100 Subject: Updated Android project template --- templates/android_project/assets/ambient.ogg | Bin 0 -> 2672956 bytes templates/android_project/jni/basic_game.c | 6 +++++- templates/android_project/jni/include/raylib.h | 26 +++++++++++++++++-------- templates/android_project/jni/libs/libraylib.a | Bin 1536620 -> 1617368 bytes 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 templates/android_project/assets/ambient.ogg (limited to 'templates') diff --git a/templates/android_project/assets/ambient.ogg b/templates/android_project/assets/ambient.ogg new file mode 100644 index 00000000..af7f836e Binary files /dev/null and b/templates/android_project/assets/ambient.ogg differ diff --git a/templates/android_project/jni/basic_game.c b/templates/android_project/jni/basic_game.c index e8a7e67a..8a0413c3 100644 --- a/templates/android_project/jni/basic_game.c +++ b/templates/android_project/jni/basic_game.c @@ -43,7 +43,9 @@ void android_main(struct android_app *app) int framesCounter = 0; // Used to count frames - //SetTargetFPS(60); // Not required on Android, already locked to 60 fps + PlayMusicStream("ambient.ogg"); + + SetTargetFPS(60); // Not required on Android, already locked to 60 fps //-------------------------------------------------------------------------------------- // Main game loop @@ -51,6 +53,8 @@ void android_main(struct android_app *app) { // Update //---------------------------------------------------------------------------------- + UpdateMusicStream(); + switch(currentScreen) { case LOGO: diff --git a/templates/android_project/jni/include/raylib.h b/templates/android_project/jni/include/raylib.h index 4eefa3ea..864a240a 100644 --- a/templates/android_project/jni/include/raylib.h +++ b/templates/android_project/jni/include/raylib.h @@ -1,6 +1,6 @@ /********************************************************************************************** * -* raylib 1.3.0 (www.raylib.com) +* raylib 1.4.0 (www.raylib.com) * * A simple and easy-to-use library to learn videogames programming * @@ -70,7 +70,7 @@ #endif #if defined(PLATFORM_ANDROID) - #include // Defines android_app struct + typedef struct android_app; // Define android_app struct (android_native_app_glue.h) #endif //---------------------------------------------------------------------------------- @@ -291,6 +291,8 @@ typedef struct SpriteFont { int numChars; // Number of characters int *charValues; // Characters values array Rectangle *charRecs; // Characters rectangles within the texture + Vector2 *charOffsets; // Characters offsets (on drawing) + int *charAdvanceX; // Characters x advance (on drawing) } SpriteFont; // Camera type, defines a camera position/orientation in 3d space @@ -430,6 +432,17 @@ typedef enum { GESTURE_PINCH_OUT = 1024 } Gestures; +typedef enum { TOUCH_UP, TOUCH_DOWN, TOUCH_MOVE } TouchAction; + +// Gesture events +// NOTE: MAX_TOUCH_POINTS fixed to 4 +typedef struct { + int touchAction; + int pointCount; + int pointerId[4]; + Vector2 position[4]; +} GestureEvent; + // Camera system modes typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON } CameraMode; @@ -569,16 +582,11 @@ Vector2 GetTouchPosition(void); // Returns touch positio //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) //------------------------------------------------------------------------------------ -Vector2 GetRawTouchPosition(void); // Get touch position (raw) -#if defined(PLATFORM_WEB) -void InitGesturesSystem(void); // Init gestures system (web) -#elif defined(PLATFORM_ANDROID) -void InitGesturesSystem(struct android_app *app); // Init gestures system (android) -#endif void UpdateGestures(void); // Update gestures detected (must be called every frame) bool IsGestureDetected(void); // Check if a gesture have been detected int GetGestureType(void); // Get latest detected gesture void SetGesturesEnabled(unsigned int gestureFlags); // Enable a set of gestures using flags +void ProcessGestureEvent(GestureEvent event); // Process gesture event and translate it into gestures float GetGestureDragIntensity(void); // Get gesture drag intensity float GetGestureDragAngle(void); // Get gesture drag angle @@ -654,6 +662,7 @@ Color *GetImageData(Image image); Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) void ImageFormat(Image *image, int newFormat); // Convert image data to desired format +void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering) Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering) @@ -692,6 +701,7 @@ Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed' +const char *SubText(const char *text, int position, int length); // Get a piece of a text string //------------------------------------------------------------------------------------ // Basic 3d Shapes Drawing Functions (Module: models) diff --git a/templates/android_project/jni/libs/libraylib.a b/templates/android_project/jni/libs/libraylib.a index 35d3e07d..14e10ab7 100644 Binary files a/templates/android_project/jni/libs/libraylib.a and b/templates/android_project/jni/libs/libraylib.a differ -- cgit v1.2.3 From 32508f6db1d3f3c070e80ea42e0a1244a4c88cab Mon Sep 17 00:00:00 2001 From: victorfisac Date: Tue, 5 Jan 2016 12:21:40 +0100 Subject: Fixed Android lock screen bug - Fixed Android locking screen bug. OnDestroy() was called when locking screen. - Power button input must be handled by OS. - AndroidManifest.xml is affected by configChanges="screenSize". - Updated library header for android template. --- templates/android_project/AndroidManifest.xml | 2 +- templates/android_project/jni/include/raylib.h | 36 ++++++++++++++++++-------- 2 files changed, 26 insertions(+), 12 deletions(-) (limited to 'templates') diff --git a/templates/android_project/AndroidManifest.xml b/templates/android_project/AndroidManifest.xml index 8bb0534f..f9f41b33 100644 --- a/templates/android_project/AndroidManifest.xml +++ b/templates/android_project/AndroidManifest.xml @@ -23,7 +23,7 @@ android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" > diff --git a/templates/android_project/jni/include/raylib.h b/templates/android_project/jni/include/raylib.h index 864a240a..641eac4b 100644 --- a/templates/android_project/jni/include/raylib.h +++ b/templates/android_project/jni/include/raylib.h @@ -186,6 +186,12 @@ // TODO: Review Xbox360 USB Controller Buttons +// Android Physic Buttons +#define ANDROID_BACK 4 +#define ANDROID_MENU 82 +#define ANDROID_VOLUME_UP 24 +#define ANDROID_VOLUME_DOWN 25 + // Some Basic Colors // NOTE: Custom raylib color palette for amazing visuals on WHITE background #define LIGHTGRAY (Color){ 200, 200, 200, 255 } // Light Gray @@ -540,6 +546,9 @@ bool IsFileDropped(void); // Check if a file h char **GetDroppedFiles(int *count); // Retrieve dropped files into window void ClearDroppedFiles(void); // Clear dropped files paths buffer +void StorageSaveValue(int position, int value); // Storage save integer value (to defined position) +int StorageLoadValue(int position); // Storage load integer value (from defined position) + //------------------------------------------------------------------------------------ // Input Handling Functions (Module: core) //------------------------------------------------------------------------------------ @@ -578,6 +587,9 @@ bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad b int GetTouchX(void); // Returns touch position X (relative to screen size) int GetTouchY(void); // Returns touch position Y (relative to screen size) Vector2 GetTouchPosition(void); // Returns touch position XY (relative to screen size) +bool IsButtonPressed(int button); // Detect if an android physic button has been pressed +bool IsButtonDown(int button); // Detect if an android physic button is being pressed +bool IsButtonReleased(int button); // Detect if an android physic button has been released //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) @@ -793,21 +805,23 @@ void SetMaterialNormalDepth(Material *material, float depth); // Set n //---------------------------------------------------------------------------------- // Physics System Functions (engine-module: physics) //---------------------------------------------------------------------------------- -void InitPhysics(); // Initialize all internal physics values -void SetPhysics(Physics settings); // Set physics settings values using Physics data type to overwrite internal physics settings +void InitPhysics(); // Initialize all internal physics values +void SetPhysics(Physics settings); // Set physics settings values using Physics data type to overwrite internal physics settings -void AddRigidbody(int index, Rigidbody rigidbody); // Initialize a new rigidbody with parameters to internal index slot -void AddCollider(int index, Collider collider); // Initialize a new Collider with parameters to internal index slot +void AddRigidbody(int index, Rigidbody rigidbody); // Initialize a new rigidbody with parameters to internal index slot +void AddCollider(int index, Collider collider); // Initialize a new Collider with parameters to internal index slot -void ApplyPhysics(int index, Vector2 *position); // Apply physics to internal rigidbody, physics calculations are applied to position pointer parameter -void SetRigidbodyEnabled(int index, bool state); // Set enabled state to a defined rigidbody -void SetRigidbodyVelocity(int index, Vector2 velocity); // Set velocity of rigidbody (without considering of mass value) -void AddRigidbodyForce(int index, Vector2 force); // Set rigidbody force (considering mass value) +void ApplyPhysics(int index, Vector2 *position); // Apply physics to internal rigidbody, physics calculations are applied to position pointer parameter +void SetRigidbodyEnabled(int index, bool state); // Set enabled state to a defined rigidbody +void SetRigidbodyVelocity(int index, Vector2 velocity); // Set velocity of rigidbody (without considering of mass value) +void SetRigidbodyAcceleration(int index, Vector2 acceleration); // Set acceleration of rigidbody (without considering of mass value) +void AddRigidbodyForce(int index, Vector2 force); // Set rigidbody force (considering mass value) +void AddForceAtPosition(Vector2 position, float intensity, float radius); // Add a force to all enabled rigidbodies at a position -void SetColliderEnabled(int index, bool state); // Set enabled state to a defined collider +void SetColliderEnabled(int index, bool state); // Set enabled state to a defined collider -Rigidbody GetRigidbody(int index); // Returns the internal rigidbody data defined by index parameter -Collider GetCollider(int index); // Returns the internal collider data defined by index parameter +Rigidbody GetRigidbody(int index); // Returns the internal rigidbody data defined by index parameter +Collider GetCollider(int index); // Returns the internal collider data defined by index parameter //------------------------------------------------------------------------------------ // Audio Loading and Playing Functions (Module: audio) -- cgit v1.2.3 From fe0cf8f9a9d6cafa40a1baf8b3cdace0268ccb82 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Tue, 5 Jan 2016 13:58:20 +0100 Subject: Added some comments and fixed spaces --- templates/android_project/jni/include/raylib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/templates/android_project/jni/include/raylib.h b/templates/android_project/jni/include/raylib.h index 641eac4b..72211b59 100644 --- a/templates/android_project/jni/include/raylib.h +++ b/templates/android_project/jni/include/raylib.h @@ -589,7 +589,7 @@ int GetTouchY(void); // Returns touch positio Vector2 GetTouchPosition(void); // Returns touch position XY (relative to screen size) bool IsButtonPressed(int button); // Detect if an android physic button has been pressed bool IsButtonDown(int button); // Detect if an android physic button is being pressed -bool IsButtonReleased(int button); // Detect if an android physic button has been released +bool IsButtonReleased(int button); // Detect if an android physic button has been released //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) @@ -805,7 +805,7 @@ void SetMaterialNormalDepth(Material *material, float depth); // Set n //---------------------------------------------------------------------------------- // Physics System Functions (engine-module: physics) //---------------------------------------------------------------------------------- -void InitPhysics(); // Initialize all internal physics values +void InitPhysics(void); // Initialize all internal physics values void SetPhysics(Physics settings); // Set physics settings values using Physics data type to overwrite internal physics settings void AddRigidbody(int index, Rigidbody rigidbody); // Initialize a new rigidbody with parameters to internal index slot -- cgit v1.2.3 From 9c9aeaef47fe612dbc0f446920fca9cb54781aef Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 13 Feb 2016 12:21:29 +0100 Subject: Added web template (shell) for html5 games --- templates/web_shell/shell.html | 239 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 templates/web_shell/shell.html (limited to 'templates') diff --git a/templates/web_shell/shell.html b/templates/web_shell/shell.html new file mode 100644 index 00000000..c154ee7e --- /dev/null +++ b/templates/web_shell/shell.html @@ -0,0 +1,239 @@ + + + + + + + raylib HTML5 GAME + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
Downloading...
+ + + + + +
+ +
+
+ +
+ +
+ + + + + {{{ SCRIPT }}} + + \ No newline at end of file -- cgit v1.2.3