Data like brushes, starters,... now is loaded from assets in the android port.

This commit is contained in:
Pere Pujal i Carabantes 2018-01-18 00:41:38 +01:00
parent 4366697e8d
commit a24c65451a
2 changed files with 164 additions and 0 deletions

50
src/android_assets.h Normal file
View file

@ -0,0 +1,50 @@
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
*/
#ifndef TP_ANDROID_ASSETS
#define TP_ANDROID_ASSETS
#include <jni.h>
#include "debug.h"
#include "dirwalk.h"
#include "progressbar.h"
#include <android/asset_manager.h>
/* AAssetManager_openDir() only lists files, not directories, so we can't relay on
directory exploring and have to keep track of what we put on the assets dir */
#define ASSETS_BRUSHES_DIR "data/brushes"
#define ASSETS_STAMPS_DIR "stamps/cartoon/tux"
AAssetDir * open_asset_dir(char * dirname);
void load_brushes_from_assets(SDL_Surface * screen, SDL_Texture *texture, SDL_Renderer *renderer, const char * dirname, void (*fn) (SDL_Surface * screen,
SDL_Texture * texture,
SDL_Renderer * renderer,
const char *restrict const dir,
unsigned dirlen, tp_ftw_str * files,
unsigned count, const char *restrict const locale) );
void load_from_assets(SDL_Surface * screen, SDL_Texture *texture, SDL_Renderer *renderer, const char * dirname, void (*fn) (SDL_Surface * screen,
SDL_Texture * texture,
SDL_Renderer * renderer,
const char *restrict const dir,
unsigned dirlen, tp_ftw_str * files,
unsigned count, const char *restrict const locale) );
JNIEXPORT jboolean Java_org_tuxpaint_tuxpaintActivity_managertojni(JNIEnv * env, jclass clazz, jobject mgr);
#endif