[Notice of Holidays]
Please note that our staff will not be available from 2024/Dec/28 - 2025/Jan/5 JST.
The Live2D Creators Forum will remain open during the holidays.
Submissions that require a response will be answered after we reopen for business.
Please note that it will take longer than usual to respond to your request.
How to set an image as the background in the Live Wallpaper on Android?
The Live Wallpaper example working great but it's always has a very sad black background. I've tried to set the background the same way as sampleApp1 (using setupBackground(context)) but in GLWallpaperService it won't load the background resource. >.<
0 ·
Comments
Please try the following .
1) Copy from [sample/sampleApp1/src/jp/live2d/utils/android] to [liveWallpaper]
2) Copy from [sample/sampleApp1/src/jp/live2d/sample/LAppDefine.java] to [liveWallpaper]
3) Copy from [sample/sampleApp1/assets/image/back_class_normal.png] to [liveWallpaper]
4) Fixed LiveWallpaperService.java(Fixed Points Add the Comment "Add Code") 5) Fixed Live2DRenderer.java(Fixed Points Add the Comment "Add Code")
You can change the background image if change of BACK_IMAGE_NAME of LAppDefine.java .
I am sorry if I post the question here, I just thought it is related very closely.
Drawing point of the background is the following code .
Live2DRenderer.java - onDrawFrame() In other words , change the value of glTranslatef.
I don't know about the hit area .
I have never tried together with wallpaper .
Also... is there a way to reduce memory usage? seems that it's taking a lot of memory(ram?) quite huge . Is it because of *.mtn animation too long? or texture too much?
gl.glScalef(2.4f, 2.4f, 2.4f); // scale(x, y, z)
gl.glTranslatef(0.0f, -0.3f, 0.0f); // position(x, y, z)
gl.glOrthof(0 , modelWidth , modelWidth / aspect , 0 , 0.5f , -0.5f ) ;
to :
gl.glScalef(2.0f, 2.0f, 2.0f); // scale(x, y, z)
gl.glTranslatef(0.0f, -0.1f, 0.0f); // position(x, y, z)
gl.glOrthof(0 , modelWidth , modelWidth / aspect , 0 , 0.5f , -0.5f ) ;
Because it is the size and position of my model i tried returning it to your original code but still doesn't work (background doesn't move)
I am still tinkering though lol
on LiveWallpaperService.java
I added :
@Override public void onVisibilityChanged(boolean visible) { if (!visible) { renderer.motionMgr.stopAllMotions(); } else { renderer.motionMgr.startMotion(renderer.motion, false); } }
Seems to reduce the memory usage significantly on my device. (though this might not be entirely correct . . but it works)