瀏覽代碼

Updated Android project template

pull/69/head
raysan5 9 年之前
父節點
當前提交
3a739c38c5
共有 4 個檔案被更改,包括 23 行新增9 行删除
  1. 二進制
      templates/android_project/assets/ambient.ogg
  2. +5
    -1
      templates/android_project/jni/basic_game.c
  3. +18
    -8
      templates/android_project/jni/include/raylib.h
  4. 二進制
      templates/android_project/jni/libs/libraylib.a

二進制
templates/android_project/assets/ambient.ogg 查看文件


+ 5
- 1
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 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 // Main game loop
@ -51,6 +53,8 @@ void android_main(struct android_app *app)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateMusicStream();
switch(currentScreen) switch(currentScreen)
{ {
case LOGO: case LOGO:

+ 18
- 8
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 * A simple and easy-to-use library to learn videogames programming
* *
@ -70,7 +70,7 @@
#endif #endif
#if defined(PLATFORM_ANDROID) #if defined(PLATFORM_ANDROID)
cp">#include <android_native_app_glue.h> // Defines android_app struct
k">typedef struct android_app; // Define android_app struct (android_native_app_glue.h)
#endif #endif
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -291,6 +291,8 @@ typedef struct SpriteFont {
int numChars; // Number of characters int numChars; // Number of characters
int *charValues; // Characters values array int *charValues; // Characters values array
Rectangle *charRecs; // Characters rectangles within the texture Rectangle *charRecs; // Characters rectangles within the texture
Vector2 *charOffsets; // Characters offsets (on drawing)
int *charAdvanceX; // Characters x advance (on drawing)
} SpriteFont; } SpriteFont;
// Camera type, defines a camera position/orientation in 3d space // Camera type, defines a camera position/orientation in 3d space
@ -430,6 +432,17 @@ typedef enum {
GESTURE_PINCH_OUT = 1024 GESTURE_PINCH_OUT = 1024
} Gestures; } 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 // Camera system modes
typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON } CameraMode; 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) // 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) void UpdateGestures(void); // Update gestures detected (must be called every frame)
bool IsGestureDetected(void); // Check if a gesture have been detected bool IsGestureDetected(void); // Check if a gesture have been detected
int GetGestureType(void); // Get latest detected gesture int GetGestureType(void); // Get latest detected gesture
void SetGesturesEnabled(unsigned int gestureFlags); // Enable a set of gestures using flags 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 GetGestureDragIntensity(void); // Get gesture drag intensity
float GetGestureDragAngle(void); // Get gesture drag angle 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 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 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 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) 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 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 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 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 *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) // Basic 3d Shapes Drawing Functions (Module: models)

二進制
templates/android_project/jni/libs/libraylib.a 查看文件


Loading…
取消
儲存