10 |
11 | TouchManager::TouchManager()
12 | : _startY(0.0f)
13 | , _startX(0.0f)
14 | , _lastX(0.0f)
15 | , _lastY(0.0f)
16 | , _lastX1(0.0f)
17 | , _lastY1(0.0f)
18 | , _lastX2(0.0f)
19 | , _lastY2(0.0f)
20 | , _lastTouchDistance(0.0f)
21 | , _deltaX(0.0f)
22 | , _deltaY(0.0f)
23 | , _scale(1.0f)
24 | , _touchSingle(false)
25 | , _flipAvailable(false)
26 | { }
27 |
28 | void TouchManager::TouchesBegan(float deviceX, float deviceY)
29 | {
30 | _lastX = deviceX;
31 | _lastY = deviceY;
32 | _startX = deviceX;
33 | _startY = deviceY;
34 | _lastTouchDistance = -1.0f;
35 | _flipAvailable = true;
36 | _touchSingle = true;
37 | }
38 |
39 | void TouchManager::TouchesMoved(float deviceX, float deviceY)
40 | {
41 | _lastX = deviceX;
42 | _lastY = deviceY;
43 | _lastTouchDistance = -1.0f;
44 | _touchSingle = true;
45 | }
46 |
47 | void TouchManager::TouchesMoved(float deviceX1, float deviceY1, float deviceX2, float deviceY2)
48 | {
49 | float distance = CalculateDistance(deviceX1, deviceY1, deviceX2, deviceY2);
50 | float centerX = (deviceX1 + deviceX2) * 0.5f;
51 | float centerY = (deviceY1 + deviceY2) * 0.5f;
52 |
53 | if (_lastTouchDistance > 0.0f)
54 | {
55 | _scale = powf(distance / _lastTouchDistance, 0.75f);
56 | _deltaX = CalculateMovingAmount(deviceX1 - _lastX1, deviceX2 - _lastX2);
57 | _deltaY = CalculateMovingAmount(deviceY1 - _lastY1, deviceY2 - _lastY2);
58 | }
59 | else
60 | {
61 | _scale = 1.0f;
62 | _deltaX = 0.0f;
63 | _deltaY = 0.0f;
64 | }
65 |
66 | _lastX = centerX;
67 | _lastY = centerY;
68 | _lastX1 = deviceX1;
69 | _lastY1 = deviceY1;
70 | _lastX2 = deviceX2;
71 | _lastY2 = deviceY2;
72 | _lastTouchDistance = distance;
73 | _touchSingle = false;
74 | }
75 |
76 | float TouchManager::GetFlickDistance() const
77 | {
78 | return CalculateDistance(_startX, _startY, _lastX, _lastY);
79 | }
80 |
81 | float TouchManager::CalculateDistance(float x1, float y1, float x2, float y2) const
82 | {
83 | return sqrtf((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
84 | }
85 |
86 | float TouchManager::CalculateMovingAmount(float v1, float v2)
87 | {
88 | if ((v1 > 0.0f) != (v2 > 0.0f))
89 | {
90 | return 0.0f;
91 | }
92 |
93 | float sign = v1 > 0.0f ? 1.0f : -1.0f;
94 | float absoluteValue1 = fabsf(v1);
95 | float absoluteValue2 = fabsf(v2);
96 | return sign * ((absoluteValue1 < absoluteValue2) ? absoluteValue1 : absoluteValue2);
97 | }
98 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/cpp/TouchManager.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright(c) Live2D Inc. All rights reserved.
3 | *
4 | * Use of this source code is governed by the Live2D Open Software license
5 | * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6 | */
7 |
8 | #pragma once
9 |
10 | /**
11 | * @brief タッチマネジャー
12 | */
13 | class TouchManager
14 | {
15 | public:
16 | /**
17 | * @brief コンストラクタ
18 | */
19 | TouchManager();
20 |
21 | float GetCenterX() const { return _lastX; }
22 | float GetCenterY() const { return _lastY; }
23 | float GetDeltaX() const { return _deltaX; }
24 | float GetDeltaY() const{ return _deltaY; }
25 | float GetStartX() const{ return _startX; }
26 | float GetStartY() const{ return _startY; }
27 | float GetScale() const { return _scale; }
28 | float GetX() const{ return _lastX; }
29 | float GetY() const{ return _lastY; }
30 | float GetX1() const{ return _lastX1; }
31 | float GetY1() const{ return _lastY1; }
32 | float GetX2() const{ return _lastX2; }
33 | float GetY2() const{ return _lastY2; }
34 | bool IsSingleTouch() const { return _touchSingle; }
35 | bool IsFlickAvailable() const { return _flipAvailable; }
36 | void DisableFlick() { _flipAvailable = false; }
37 |
38 | /*
39 | * @brief タッチ開始時イベント
40 | *
41 | * @param[in] deviceY タッチした画面のyの値
42 | * @param[in] deviceX タッチした画面のxの値
43 | */
44 | void TouchesBegan(float deviceX, float deviceY);
45 |
46 | /*
47 | * @brief ドラッグ時のイベント
48 | *
49 | * @param[in] deviceX タッチした画面のyの値
50 | * @param[in] deviceY タッチした画面のxの値
51 | */
52 | void TouchesMoved(float deviceX, float deviceY);
53 |
54 | /*
55 | * @brief ドラッグ時のイベント
56 | *
57 | * @param[in] deviceX1 1つめのタッチした画面のxの値
58 | * @param[in] deviceY1 1つめのタッチした画面のyの値
59 | * @param[in] deviceX2 2つめのタッチした画面のxの値
60 | * @param[in] deviceY2 2つめのタッチした画面のyの値
61 | */
62 | void TouchesMoved(float deviceX1, float deviceY1, float deviceX2, float deviceY2);
63 |
64 | /*
65 | * @brief フリックの距離測定
66 | *
67 | * @return フリック距離
68 | */
69 | float GetFlickDistance() const;
70 |
71 | private:
72 | /*
73 | * @brief 点1から点2への距離を求める
74 | *
75 | * @param[in] x1 1つめのタッチした画面のxの値
76 | * @param[in] y1 1つめのタッチした画面のyの値
77 | * @param[in] x2 2つめのタッチした画面のxの値
78 | * @param[in] y2 2つめのタッチした画面のyの値
79 | * @return 2点の距離
80 | */
81 | float CalculateDistance(float x1, float y1, float x2, float y2) const;
82 |
83 | /*
84 | * 二つの値から、移動量を求める。
85 | * 違う方向の場合は移動量0。同じ方向の場合は、絶対値が小さい方の値を参照する
86 | *
87 | * @param[in] v1 1つめの移動量
88 | * @param[in] v2 2つめの移動量
89 | *
90 | * @return 小さい方の移動量
91 | */
92 | float CalculateMovingAmount(float v1, float v2);
93 |
94 | float _startY; // タッチを開始した時のxの値
95 | float _startX; // タッチを開始した時のyの値
96 | float _lastX; // シングルタッチ時のxの値
97 | float _lastY; // シングルタッチ時のyの値
98 | float _lastX1; // ダブルタッチ時の一つ目のxの値
99 | float _lastY1; // ダブルタッチ時の一つ目のyの値
100 | float _lastX2; // ダブルタッチ時の二つ目のxの値
101 | float _lastY2; // ダブルタッチ時の二つ目のyの値
102 | float _lastTouchDistance; // 2本以上でタッチしたときの指の距離
103 | float _deltaX; // 前回の値から今回の値へのxの移動距離。
104 | float _deltaY; // 前回の値から今回の値へのyの移動距離。
105 | float _scale; // このフレームで掛け合わせる拡大率。拡大操作中以外は1。
106 | bool _touchSingle; // シングルタッチ時はtrue
107 | bool _flipAvailable; // フリップが有効かどうか
108 |
109 | };
110 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/java/com/live2d/demo/JniBridgeJava.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright(c) Live2D Inc. All rights reserved.
3 | *
4 | * Use of this source code is governed by the Live2D Open Software license
5 | * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6 | */
7 |
8 | package com.live2d.demo;
9 |
10 | import android.content.Context;
11 |
12 | import java.io.IOException;
13 | import java.io.InputStream;
14 |
15 | public class JniBridgeJava {
16 |
17 | private static final String LIBRARY_NAME = "Demo";
18 | private static Context _context;
19 |
20 | static {
21 | System.loadLibrary(LIBRARY_NAME);
22 | }
23 |
24 | // Native -----------------------------------------------------------------
25 |
26 | public static native void nativeOnStart();
27 |
28 | public static native void nativeOnDestroy();
29 |
30 | public static native void nativeOnSurfaceCreated();
31 |
32 | public static native void nativeOnSurfaceChanged(int width, int height);
33 |
34 | public static native void nativeOnDrawFrame();
35 |
36 | public static native void nativeOnTouchesBegan(float pointX, float pointY);
37 |
38 | public static native void nativeOnTouchesEnded(float pointX, float pointY);
39 |
40 | public static native void nativeOnTouchesMoved(float pointX, float pointY);
41 |
42 | public static native void nativeStartRandomMotion();
43 |
44 | public static native void nativeStartMotion(int index);
45 |
46 | public static native void nativeSetClearColor(float r, float g, float b);
47 |
48 | public static native void SetBackGroundSpriteAlpha(float a);
49 |
50 | public static native void SetGravitationalAccelerationX(float gravity);
51 |
52 | // Java -----------------------------------------------------------------
53 |
54 | public static void SetContext(Context context) {
55 | _context = context;
56 | }
57 |
58 | public static byte[] LoadFile(String filePath) {
59 | InputStream fileData = null;
60 | try {
61 | fileData = _context.getAssets().open(filePath);
62 | int fileSize = fileData.available();
63 | byte[] fileBuffer = new byte[fileSize];
64 | fileData.read(fileBuffer, 0, fileSize);
65 | return fileBuffer;
66 | } catch (IOException e) {
67 | e.printStackTrace();
68 | return null;
69 | } finally {
70 | try {
71 | if (fileData != null) {
72 | fileData.close();
73 | }
74 | } catch (IOException e) {
75 | e.printStackTrace();
76 | }
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/java/com/live2d/demo/Live2DGLRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright(c) Live2D Inc. All rights reserved.
3 | *
4 | * Use of this source code is governed by the Live2D Open Software license
5 | * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6 | */
7 |
8 | package com.live2d.demo;
9 |
10 | import android.content.Context;
11 | import android.hardware.Sensor;
12 | import android.hardware.SensorEvent;
13 | import android.hardware.SensorEventListener;
14 | import android.hardware.SensorManager;
15 | import android.opengl.GLSurfaceView;
16 |
17 | import javax.microedition.khronos.egl.EGLConfig;
18 | import javax.microedition.khronos.opengles.GL10;
19 |
20 | public class Live2DGLRenderer implements GLSurfaceView.Renderer, SensorEventListener {
21 | Context con;
22 |
23 | private SensorManager sensorManager;
24 | private Sensor sensor;
25 |
26 |
27 | public Live2DGLRenderer(Context context)
28 | {
29 | con = context;
30 | sensorManager = (SensorManager)con.getSystemService(Context.SENSOR_SERVICE);
31 | if (sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY) != null){
32 | sensor = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
33 | }
34 | sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_FASTEST);
35 | }
36 |
37 | public void onSurfaceCreated(GL10 gl, EGLConfig config) {
38 | JniBridgeJava.nativeOnSurfaceCreated();
39 | }
40 |
41 | public void onSurfaceChanged(GL10 gl, int width, int height) {
42 | JniBridgeJava.nativeOnSurfaceChanged(width, height);
43 | }
44 |
45 | public void onDrawFrame(GL10 gl) {
46 | JniBridgeJava.nativeOnDrawFrame();
47 | }
48 |
49 | @Override
50 | public void onSensorChanged(SensorEvent event) {
51 | JniBridgeJava.SetGravitationalAccelerationX(event.values[0]);
52 | }
53 |
54 | @Override
55 | public void onAccuracyChanged(Sensor sensor, int accuracy) { }
56 |
57 | /**
58 | * Called when the engine is destroyed. Do any necessary clean up because
59 | * at this point your renderer instance is now done for.
60 | */
61 | public void release() {
62 | sensorManager.unregisterListener(this,sensor);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/java/com/live2d/demo/Live2DReceiver.java:
--------------------------------------------------------------------------------
1 | package com.live2d.demo;
2 |
3 | import java.util.Random;
4 |
5 | import android.content.BroadcastReceiver;
6 | import android.content.Context;
7 | import android.content.Intent;
8 |
9 | public class Live2DReceiver extends BroadcastReceiver {
10 |
11 | private boolean airPlaneMode;
12 |
13 | public Live2DReceiver (){
14 | super();
15 | airPlaneMode = false;
16 | }
17 |
18 | @Override
19 | public void onReceive(Context context, Intent intent) {
20 | switch (intent.getAction()) {
21 | case Intent.ACTION_SCREEN_ON:
22 | JniBridgeJava.nativeStartRandomMotion();
23 | break;
24 | // Android API 31から非推奨
25 | case Intent.ACTION_CLOSE_SYSTEM_DIALOGS:
26 | Random rnd = new Random();
27 | float r = rnd.nextFloat();
28 | float g = rnd.nextFloat();
29 | float b = rnd.nextFloat();
30 | JniBridgeJava.nativeSetClearColor(r,g,b);
31 | break;
32 | case Intent.ACTION_AIRPLANE_MODE_CHANGED:
33 | airPlaneMode = !airPlaneMode;
34 | if (airPlaneMode)
35 | {
36 | JniBridgeJava.SetBackGroundSpriteAlpha(1.0f);
37 | }
38 | else
39 | {
40 | JniBridgeJava.SetBackGroundSpriteAlpha(0.0f);
41 | }
42 | break;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/java/com/live2d/demo/LiveWallpaperService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright(c) Live2D Inc. All rights reserved.
3 | *
4 | * Use of this source code is governed by the Live2D Open Software license
5 | * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6 | */
7 |
8 | package com.live2d.demo;
9 |
10 | import android.app.ActivityManager;
11 | import android.content.BroadcastReceiver;
12 | import android.content.Context;
13 | import android.content.Intent;
14 | import android.content.IntentFilter;
15 | import android.content.pm.ConfigurationInfo;
16 | import android.hardware.usb.UsbManager;
17 | import android.view.MotionEvent;
18 | import android.view.SurfaceHolder;
19 |
20 | import net.rbgrn.android.glwallpaperservice.*;
21 |
22 | public class LiveWallpaperService extends GLWallpaperService {
23 |
24 | public LiveWallpaperService() {
25 | super();
26 | }
27 |
28 | public Engine onCreateEngine() {
29 | Live2DWallpaperEngine engine = new Live2DWallpaperEngine();
30 |
31 | BroadcastReceiver br = new Live2DReceiver();
32 | IntentFilter filter = new IntentFilter();
33 | filter.addAction(Intent.ACTION_SCREEN_ON);
34 | filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); // Android API 31から非推奨
35 | filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
36 | this.registerReceiver(br,filter);
37 |
38 | return engine;
39 | }
40 |
41 | @Override
42 | public void onDestroy() {
43 | super.onDestroy();
44 | }
45 |
46 | class Live2DWallpaperEngine extends GLEngine {
47 | Live2DGLRenderer renderer;
48 |
49 | public Live2DWallpaperEngine() {
50 | super();
51 |
52 | JniBridgeJava.SetContext(getApplicationContext());
53 | JniBridgeJava.nativeOnStart();
54 | }
55 |
56 | @Override
57 | public void onCreate(SurfaceHolder surfaceHolder) {
58 | super.onCreate(surfaceHolder);
59 |
60 | // Check if the system supports OpenGL ES 2.0.
61 | // システムがOpenGL ES 2.0に対応しているかのチェック
62 | final ActivityManager activityManager =
63 | (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
64 | final ConfigurationInfo configurationInfo =
65 | activityManager.getDeviceConfigurationInfo();
66 | final boolean supportsEs2 =
67 | configurationInfo.reqGlEsVersion >= 0x20000;
68 |
69 | if (supportsEs2)
70 | {
71 | // Request an OpenGL ES 2.0 compatible context.
72 | // OpenGL ES 2.0互換のコンテキストを要求
73 | setEGLContextClientVersion(2);
74 |
75 | // On Honeycomb+ devices, this improves the performance when
76 | // leaving and resuming the live wallpaper.
77 | // Honeycomb以降のデバイスでは、ライブ壁紙を終了して再開した際のパフォーマンスが向上します。
78 | setPreserveEGLContextOnPause(true);
79 |
80 | // Set the renderer.
81 | // レンダラーの設定
82 | renderer = new Live2DGLRenderer(getApplicationContext());
83 | setRenderer(renderer);
84 | }
85 | }
86 |
87 | @Override
88 | public void onTouchEvent(MotionEvent event) {
89 | float pointX = event.getX();
90 | float pointY = event.getY();
91 | switch (event.getAction()) {
92 | case MotionEvent.ACTION_DOWN:
93 | JniBridgeJava.nativeOnTouchesBegan(pointX, pointY);
94 | break;
95 | case MotionEvent.ACTION_UP:
96 | JniBridgeJava.nativeOnTouchesEnded(pointX, pointY);
97 | break;
98 | case MotionEvent.ACTION_MOVE:
99 | JniBridgeJava.nativeOnTouchesMoved(pointX, pointY);
100 | break;
101 | }
102 | }
103 |
104 | public void onDestroy() {
105 | super.onDestroy();
106 | JniBridgeJava.nativeOnDestroy();
107 |
108 | if (renderer != null) {
109 | renderer.release();
110 | }
111 | renderer = null;
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/java/net/rbgrn/android/glwallpaperservice/Apache_License_2.0_license.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/java/net/rbgrn/android/glwallpaperservice/GLWallpaperService-CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # GLWallpaperService Changelog
2 |
3 | Based on [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html), any changes made to GLWallpaperService.java by Live2D will be written to this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6 |
7 | ## [Unreleased]
8 |
9 | ### Changed
10 | - Remove `GLThread` and related processing.
11 | - Create a class that extends `GLSurfaceView` add related processing.
12 | - Remove deprecated functions and unnecessary variables.
13 |
14 | ---
15 |
16 | ©Live2D
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/java/net/rbgrn/android/glwallpaperservice/NOTICE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2008 The Android Open Source Project
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 | Portions of this software were developed by Robert Green. The original
16 | software is available from
17 | http://www.rbgrn.net/content/354-glsurfaceview-adapted-3d-live-wallpapers
18 |
19 | Other contributors include
20 | Mark Guerra - https://github.com/markfguerra
21 | TaDaa - https://github.com/TaDaa
22 | Timo Griese - https://github.com/Projekt2501
23 | Walter Reid - https://github.com/walterreid
24 | Zachary Burke - http://mobilecoder.wordpress.com
25 | Jay Weisskopf - http://jayschwa.net
26 | Cédric Roux - https://github.com/Cedroux
27 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Live2DWallpaper
3 | Live2DWallpaper
4 |
5 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/AndroidWallPaper/app/src/main/res/xml/wallpaper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
--------------------------------------------------------------------------------
/AndroidWallPaper/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.2.2'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | google()
19 | mavenCentral()
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
26 |
--------------------------------------------------------------------------------
/AndroidWallPaper/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 |
21 | # Android SDK version that will be used as the compile project
22 | PROP_COMPILE_SDK_VERSION=30
23 |
24 | # Android SDK version that will be used as the earliest version of android this application can run on
25 | PROP_MIN_SDK_VERSION=16
26 |
27 | # Android SDK version that will be used as the latest version of android this application has been tested on
28 | PROP_TARGET_SDK_VERSION=30
29 |
30 |
31 | # List of CPU Archtexture to build that application with
32 | # Available architextures (armeabi-v7a | arm64-v8a | x86)
33 | # To build for multiple architexture, use the `:` between them
34 | # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86
35 | PROP_APP_ABI=armeabi-v7a
36 |
--------------------------------------------------------------------------------
/AndroidWallPaper/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/AndroidWallPaper/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jul 26 12:08:42 JST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/AndroidWallPaper/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/AndroidWallPaper/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/AndroidWallPaper/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':Demo'
2 | project(':Demo').projectDir = new File(settingsDir, 'app')
3 |
--------------------------------------------------------------------------------
/Core/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6 |
7 |
8 | ## 2021-03-09
9 |
10 | ### Added
11 | * Add funtcions for Viewer.
12 |
13 | * `csmGetParameterKeyCounts`
14 | * `csmGetParameterKeyValues`
15 |
16 | ### Changed
17 |
18 | * Update Core version to `04.01.0000`.
19 |
20 |
21 | ## 2020-01-30
22 |
23 | ### Added
24 |
25 | * Add static library(.lib) for statically linking DLL.
26 | * Add symbol file for Windows dynamic library (dll).
27 |
28 |
29 | ## 2019-11-19
30 |
31 | ### Fixed
32 |
33 | * Fix linking static libraries for Windows (.lib).
34 |
35 |
36 | ## 2019-11-14
37 |
38 | ### Added
39 |
40 | * Support Visual Studio 2019.
41 | * Support macOS dynamic library (dylib).
42 |
43 | ### Changed
44 |
45 | * Update Windows dynamic library: Use Visual Studio 2019 for building.
46 |
47 | ### Security
48 |
49 | * Bundle certificate and notary ticket to macOS shared library.
50 |
51 |
52 | ## 2019-09-04
53 |
54 | ### Added
55 |
56 | * Support new Inverted Masking features.
57 | * Support ARM64 architecture for Universal Windows Platform.
58 |
59 | ### Changed
60 |
61 | * Upgrade Core version to 04.00.0000 (67108864). This upgrade is following Cubism Editor 4.0 features.
62 | * Add calling convention for *Windows/x86 DLL* only.
63 |
64 | ### Removed
65 |
66 | * Remove bitcode binary due to suspension of *Cubism Bindings.*
67 |
68 |
69 | ## 2019-04-09
70 |
71 | ### Added
72 |
73 | * Support Universal Windows Platform for Windows Store Application.
74 |
75 |
76 | ## 2019-01-31
77 |
78 | ### Added
79 |
80 | * Add API to get the parent part of the specified part.
81 | * Add API to get moc3 version.
82 |
83 |
84 | ## 2018-12-20
85 |
86 | ### Added
87 |
88 | * [Native] Add new function: `csmGetPartParentPartIndices`.
89 | * [Native, 3.3 Support] Support new Warp Deformer features.
90 |
91 | ### Changed
92 |
93 | * Upgrade Core version to 03.03.0000 (50528256). This upgrade is following Cubism Editor 3.3 features.
94 |
95 |
96 | ## 2018-08-22
97 |
98 | ### Added
99 |
100 | * [Native] Add support for Neon.
101 |
102 |
103 | ## 2018-05-14
104 |
105 | ### Added
106 |
107 | * [Native] Add Windows **Visual C++ 2013** library.
108 | * [Windows] Add runtime library choice `MT`, `MD`, `MTd`, `MDd`.
109 | * [iOS] Add support for iPhone Simulator SDK.
110 |
111 | ### Fixed
112 |
113 | * Fix an error occurred when linking libraries for Android `arm64-v8a`.
114 |
115 |
116 | ## 2017-11-17
117 |
118 | ### Fixed
119 |
120 | * Fix processing of vertex index.
121 |
122 |
123 | ## 2017-10-05
124 |
125 | ### Added
126 |
127 | * Provide bitcode for iOS.
128 |
129 |
130 | ## 2017-08-09
131 |
132 | ### Added
133 |
134 | * [Native] Add Android *arm64-v8a* ABI library.
135 |
136 | ### Fixed
137 |
138 | * Fix drawing order in certain scenarios.
139 |
140 |
141 | ## 2017-07-12
142 |
143 | ### Added
144 |
145 | * Add experimental support for Emscripten.
146 | * Add `CHANGELOG.md`.
147 |
148 | ### Fixed
149 |
150 | * Fix access violation in certain scenarios.
151 | * Fix update result in certain scenarios.
152 |
153 |
154 | ## 2017-05-02
155 |
156 | ### Added
157 |
158 | * [Native] Add experimental support for Raspberry PI.
159 | * Add `README.md`.
160 |
--------------------------------------------------------------------------------
/Core/LICENSE.md:
--------------------------------------------------------------------------------
1 | ## Live2D Proprietary Software License
2 |
3 | Live2D Cubism Core is available under Live2D Proprietary Software License.
4 |
5 | * [Live2D Proprietary Software License Agreement](https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_en.html)
6 | * [Live2D Proprietary Software 使用許諾契約書](https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_jp.html)
7 |
--------------------------------------------------------------------------------
/Core/README.md:
--------------------------------------------------------------------------------
1 | # Live2D Cubism Core
2 |
3 | This folder contains header and platform-specific library files for developing native applications.
4 |
5 | What's the Core anyway? It's a small library that allows you to load Cubism models in your application.
6 |
7 |
8 | ## Getting Started
9 |
10 | You probably want to play back animations and want to display your models on screen, too.
11 |
12 | [Go here](https://github.com/Live2D/CubismNativeSamples) for further information.
13 |
14 |
15 | ## File Structure
16 |
17 | ```
18 | Core
19 | ├─ dll # Shared (Dynamic) Library files
20 | ├─ include # Header file
21 | └─ lib # Static Library files
22 | ```
23 |
24 |
25 | ## Library List
26 |
27 | | Platform | Architecture | dll | lib | Path | Note |
28 | | --- | --- | --- | --- | --- | --- |
29 | | Android | ARM64 | ✓ | ✓ | android/arm64-v8a | |
30 | | Android | ARMv7 | ✓ | ✓ | android/armeabi-v7a | |
31 | | Android | x86 | ✓ | ✓ | android/x86 | |
32 | | iOS | ARM64 | | ✓ | ios/xxx-iphoneos | iOS Devices |
33 | | iOS | x86_64 | | ✓ | ios/xxx-iphonesimulator | iOS Simulator |
34 | | Linux | x86_64 | ✓ | ✓ | linux/x86_64 | |
35 | | macOS | x86_64 | ✓ | ✓ | macos | |
36 | | Raspberry Pi | ARM | ✓ | ✓ | experimental/rpi | |
37 | | UWP | ARM | ✓ | | experimental/uwp/arm | |
38 | | UWP | ARM64 | ✓ | | experimental/uwp/arm64 | |
39 | | UWP | x64 | ✓ | | experimental/uwp/x64 | |
40 | | UWP | x86 | ✓ | | experimental/uwp/x86 | |
41 | | Windows | x86 | ✓ | ✓ | windows/x86 | |
42 | | Windows | x86_64 | ✓ | ✓ | windows/x86_64 | |
43 |
44 | ### Experimental Library
45 |
46 | `Raspberry Pi` and `UWP` are experimental libraries.
47 |
48 | ### Windows Static Library
49 |
50 | Libraries are located under VC++ version name directory.
51 |
52 | Below is the Visual Studio version for VC++ version.
53 |
54 | | VC++ version | Visual Studio version |
55 | | ---: | --- |
56 | | 120 | Visual Studio 2013 |
57 | | 140 | Visual Studio 2015 |
58 | | 141 | Visual Studio 2017 |
59 | | 142 | Visual Studio 2019 |
60 |
61 | Also, the suffix library (`_MD`, `_MDd`, `_MT`, `_MTd`) refers to the
62 | [Use Run-Time Library](https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library)
63 | option used to compile the library.
64 |
65 | ### Calling convention
66 |
67 | When using dynamic library of *Windows/x86*, explicitly using `__stdcall` as calling convention.
68 |
--------------------------------------------------------------------------------
/Core/RedistributableFiles.txt:
--------------------------------------------------------------------------------
1 | The following is a list of files available for redistribution
2 | under the terms of the Live2D Proprietary Software License Agreement:
3 |
4 | - dll/android/arm64-v8a/libLive2DCubismCore.so
5 | - dll/android/armeabi-v7a/libLive2DCubismCore.so
6 | - dll/android/x86/libLive2DCubismCore.so
7 | - dll/experimental/rpi/libLive2DCubismCore.so
8 | - dll/experimental/uwp/arm/Live2DCubismCore.dll
9 | - dll/experimental/uwp/arm64/Live2DCubismCore.dll
10 | - dll/experimental/uwp/x64/Live2DCubismCore.dll
11 | - dll/experimental/uwp/x86/Live2DCubismCore.dll
12 | - dll/linux/x86_64/libLive2DCubismCore.so
13 | - dll/macos/Live2DCubismCore.bundle
14 | - dll/macos/libLive2DCubismCore.dylib
15 | - dll/windows/x86/Live2DCubismCore.dll
16 | - dll/windows/x86/Live2DCubismCore.lib
17 | - dll/windows/x86_64/Live2DCubismCore.dll
18 | - dll/windows/x86_64/Live2DCubismCore.lib
19 | - lib/android/arm64-v8a/libLive2DCubismCore.a
20 | - lib/android/armeabi-v7a/libLive2DCubismCore.a
21 | - lib/android/x86/libLive2DCubismCore.a
22 | - lib/experimental/rpi/libLive2DCubismCore.a
23 | - lib/ios/Debug-iphoneos/libLive2DCubismCore.a
24 | - lib/ios/Debug-iphonesimulator/libLive2DCubismCore.a
25 | - lib/ios/Release-iphoneos/libLive2DCubismCore.a
26 | - lib/ios/Release-iphonesimulator/libLive2DCubismCore.a
27 | - lib/linux/x86_64/libLive2DCubismCore.a
28 | - lib/macos/libLive2DCubismCore.a
29 | - lib/windows/x86/120/Live2DCubismCore_MD.lib
30 | - lib/windows/x86/120/Live2DCubismCore_MDd.lib
31 | - lib/windows/x86/120/Live2DCubismCore_MT.lib
32 | - lib/windows/x86/120/Live2DCubismCore_MTd.lib
33 | - lib/windows/x86/140/Live2DCubismCore_MD.lib
34 | - lib/windows/x86/140/Live2DCubismCore_MDd.lib
35 | - lib/windows/x86/140/Live2DCubismCore_MT.lib
36 | - lib/windows/x86/140/Live2DCubismCore_MTd.lib
37 | - lib/windows/x86/141/Live2DCubismCore_MD.lib
38 | - lib/windows/x86/141/Live2DCubismCore_MDd.lib
39 | - lib/windows/x86/141/Live2DCubismCore_MT.lib
40 | - lib/windows/x86/141/Live2DCubismCore_MTd.lib
41 | - lib/windows/x86/142/Live2DCubismCore_MD.lib
42 | - lib/windows/x86/142/Live2DCubismCore_MDd.lib
43 | - lib/windows/x86/142/Live2DCubismCore_MT.lib
44 | - lib/windows/x86/142/Live2DCubismCore_MTd.lib
45 | - lib/windows/x86_64/120/Live2DCubismCore_MD.lib
46 | - lib/windows/x86_64/120/Live2DCubismCore_MDd.lib
47 | - lib/windows/x86_64/120/Live2DCubismCore_MT.lib
48 | - lib/windows/x86_64/120/Live2DCubismCore_MTd.lib
49 | - lib/windows/x86_64/140/Live2DCubismCore_MD.lib
50 | - lib/windows/x86_64/140/Live2DCubismCore_MDd.lib
51 | - lib/windows/x86_64/140/Live2DCubismCore_MT.lib
52 | - lib/windows/x86_64/140/Live2DCubismCore_MTd.lib
53 | - lib/windows/x86_64/141/Live2DCubismCore_MD.lib
54 | - lib/windows/x86_64/141/Live2DCubismCore_MDd.lib
55 | - lib/windows/x86_64/141/Live2DCubismCore_MT.lib
56 | - lib/windows/x86_64/141/Live2DCubismCore_MTd.lib
57 | - lib/windows/x86_64/142/Live2DCubismCore_MD.lib
58 | - lib/windows/x86_64/142/Live2DCubismCore_MDd.lib
59 | - lib/windows/x86_64/142/Live2DCubismCore_MT.lib
60 | - lib/windows/x86_64/142/Live2DCubismCore_MTd.lib
61 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | ## Definitions
2 |
3 | ### Live2D Cubism Components
4 |
5 | Cubism Android Wallpaper Sample is included in Live2D Cubism Components.
6 |
7 | Cubism Android Wallpaper Sample は Live2D Cubism Components に含まれます。
8 |
9 | Cubism Android Wallpaper Sample 包括在 Live2D Cubism Components 中。
10 |
11 | ## Cubism SDK Release License
12 |
13 | *All business* users must obtain a Cubism SDK Release License. "Business" means an entity with the annual gross revenue more than ten million (10,000,000) JPY for the most recent fiscal year.
14 |
15 | * [Cubism SDK Release License](https://www.live2d.com/en/download/cubism-sdk/release-license/)
16 |
17 | 直近会計年度の売上高が 1000 万円以上の事業者様がご利用になる場合は、Cubism SDK リリースライセンス(出版許諾契約)に同意していただく必要がございます。
18 |
19 | * [Cubism SDK リリースライセンス](https://www.live2d.com/ja/download/cubism-sdk/release-license/)
20 |
21 | 如果您的企业在最近一个会计年度的销售额达到或超过1000万日元,您必须得到Cubism SDK的出版授权许可(出版许可协议)。
22 |
23 | * [Cubism SDK发行许可证](https://www.live2d.com/zh-CHS/download/cubism-sdk/release-license/)
24 |
25 | ## Live2D Open Software License
26 |
27 | Live2D Cubism Components is available under Live2D Open Software License.
28 |
29 | * [Live2D Open Software License Agreement](https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html)
30 | * [Live2D Open Software 使用許諾契約書](https://www.live2d.com/eula/live2d-open-software-license-agreement_jp.html)
31 | * [Live2D Open Software 使用授权协议](https://www.live2d.com/eula/live2d-open-software-license-agreement_cn.html)
32 |
33 |
34 | ## Live2D Proprietary Software License
35 |
36 | Live2D Cubism Core is available under Live2D Proprietary Software License.
37 |
38 | * [Live2D Proprietary Software License Agreement](https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_en.html)
39 | * [Live2D Proprietary Software 使用許諾契約書](https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_jp.html)
40 | * [Live2D Proprietary Software 使用授权协议](https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_cn.html)
41 |
42 |
43 | ## Free Material License
44 |
45 | Live2D models listed below are available under Free Material License.
46 |
47 | * [Free Material License Agreement](https://www.live2d.com/eula/live2d-free-material-license-agreement_en.html)
48 | * [無償提供マテリアルの使用許諾契約書](https://www.live2d.com/eula/live2d-free-material-license-agreement_jp.html)
49 | * [无偿提供素材使用授权协议](https://www.live2d.com/eula/live2d-free-material-license-agreement_cn.html)
50 |
51 | ```
52 | Samples/Resources/Haru
53 | Samples/Resources/Hiyori
54 | Samples/Resources/Mark
55 | Samples/Resources/Natori
56 | Samples/Resources/Rice
57 | ```
58 |
59 | If you use these models, you must agree to the terms of a contract set [here](https://docs.live2d.com/cubism-editor-manual/sample-model/) for each model.
60 |
61 |
62 | ---
63 |
64 | Please contact us from [here](https://www.live2d.jp/contact/) for more license information.
65 |
--------------------------------------------------------------------------------
/NOTICE.md:
--------------------------------------------------------------------------------
1 | ## [帰属表示] 本プロジェクトで利用しているソースコードについて
2 | 本 プロジェクトには、[Apache 2.0ライセンス](https://www.apache.org/licenses/LICENSE-2.0.html)で配布されている製作物が含まれています。
3 |
4 | ---
5 |
6 | ©Live2D
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Cubism Android Wallpaper Sample
2 |
3 | Live2D Cubism 4 Editor で出力したモデルを表示する LiveWallpaper アプリケーションのサンプルです。
4 |
5 | Cubism Native Framework および Live2D Cubism Core と組み合わせて使用します。
6 |
7 | 利用には事前に下記のダウンロードが必要です
8 |
9 | * AndroidStudio
10 | * Android SDK
11 | * Android SDK Build-Tools
12 | * Android NDK
13 | * CMake
14 |
15 |
16 | ## ライセンス
17 |
18 | 本 SDK を使用する前に[ライセンス](LICENSE.md)をご確認ください。
19 |
20 |
21 | ## 注意事項
22 |
23 | 本 SDK を使用する前に [注意事項](NOTICE.md)をご確認ください。
24 |
25 |
26 | ## ブランチ
27 | Git上には3つのブランチを用意しています
28 |
29 | ### master ブランチ
30 | 2021年8月28日に開催したCubism SDKワークショップの解答部分を含めたフルプロジェクトのブランチです。
31 | すぐにアプリケーションを実行させたい、動作を体験したいという方向けです。
32 |
33 | ### for-workshop ブランチ
34 | 2021年8月28日に開催した Cubism SDK ワークショップで実際に利用したプロジェクトのブランチです。
35 | 解答部分が削除されているため、 Cubism SDK ワークショップの問題を解きたい、もしくは実装の練習がしたいという方向けです。
36 |
37 | ### use-acceleration ブランチ
38 | master ブランチを一部改変したフルプロジェクトのブランチです。
39 | 重力加速度の値に応じた位置へ移動する master ブランチのプロジェクトとは異なり、重力のかかっている向きと大きさに応じた力を加えるような処理を行っています。
40 |
41 |
42 | ## ディレクトリ構成
43 |
44 | ```
45 | .
46 | ├─ Core # Live2D Cubism Core が含まれるディレクトリ
47 | ├─ Framework # レンダリングやアニメーション機能などのソースコードが含まれるディレクトリ
48 | ├─ thirdParty # サードパーティ製のヘッダーが含まれるディレクトリ
49 | └─ AndroidWallPaper # Android Studio プロジェクト
50 | ```
51 |
52 |
53 | ## Cubism Native Framework
54 |
55 | モデルを表示、操作するための各種機能を提供します。
56 |
57 |
58 | ## Live2D Cubism Core for Native
59 |
60 | Cubism Native Frameworkを利用するために必要なライブラリです。
61 |
62 | 当リポジトリには Live2D Cubism Core for Native は同梱されていません。
63 |
64 | ダウンロードするには[こちら](https://www.live2d.com/download/cubism-sdk/download-native/)のページを参照ください。
65 | ダウンロードした Zip ファイルの該当する中身を `Core` ディレクトリにコピーしてください。
66 |
67 |
68 | ## SDKマニュアル
69 |
70 | [Cubism SDK Manual](https://docs.live2d.com/cubism-sdk-manual/top/)
71 |
72 |
73 | ## 変更履歴
74 |
75 | 当リポジトリの変更履歴については [CHANGELOG.md](CHANGELOG.md) を参照ください。
76 |
77 |
78 | ## 開発環境
79 |
80 | | 開発ツール | バージョン |
81 | | --- | --- |
82 | | Android Studio | 4.2.1 |
83 | | CMake | 3.18.1 |
84 |
85 | ### Thirdparty
86 |
87 | | サードパーティ | バージョン |
88 | | -------------- | ---------- |
89 | | [stb_image.h] | 2.23 |
90 | | [GLWallpaperService.java] | 0.9.2 |
91 |
92 | ### Android
93 |
94 | | Android SDK tools | バージョン |
95 | | --- | --- |
96 | | Android NDK | 22.1.7171670 |
97 | | Android SDK | 30.0.3 |
98 |
99 |
100 | ## 動作確認環境
101 |
102 | | プラットフォーム | バージョン |
103 | | --- | --- |
104 | | Windows 10 | 20H2 |
105 |
106 | ### Android
107 |
108 | | バージョン | デバイス | Tegra |
109 | | --- | --- | --- |
110 | | 11 | Pixel 3a | |
111 | | 7.1.1 | Nexus 9 | ✔︎ |
112 |
--------------------------------------------------------------------------------
/thirdParty/stb/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | stb
4 | ===
5 |
6 | single-file public domain (or MIT licensed) libraries for C/C++
7 |
8 | Noteworthy:
9 |
10 | * image loader: [stb_image.h](stb_image.h)
11 | * image writer: [stb_image_write.h](stb_image_write.h)
12 | * image resizer: [stb_image_resize.h](stb_image_resize.h)
13 | * font text rasterizer: [stb_truetype.h](stb_truetype.h)
14 | * typesafe containers: [stb_ds.h](stb_ds.h)
15 |
16 | Most libraries by stb, except: stb_dxt by Fabian "ryg" Giesen, stb_image_resize
17 | by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.
18 |
19 |
20 |
21 | library | lastest version | category | LoC | description
22 | --------------------- | ---- | -------- | --- | --------------------------------
23 | **[stb_vorbis.c](stb_vorbis.c)** | 1.17 | audio | 5502 | decode ogg vorbis files from file/memory to float/16-bit signed output
24 | **[stb_image.h](stb_image.h)** | 2.23 | graphics | 7559 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
25 | **[stb_truetype.h](stb_truetype.h)** | 1.22 | graphics | 4888 | parse, decode, and rasterize characters from truetype fonts
26 | **[stb_image_write.h](stb_image_write.h)** | 1.13 | graphics | 1619 | image writing to disk: PNG, TGA, BMP
27 | **[stb_image_resize.h](stb_image_resize.h)** | 0.96 | graphics | 2630 | resize images larger/smaller with good quality
28 | **[stb_rect_pack.h](stb_rect_pack.h)** | 1.00 | graphics | 628 | simple 2D rectangle packer with decent quality
29 | **[stb_ds.h](stb_ds.h)** | 0.62 | utility | 1723 | typesafe dynamic array and hash tables for C, will compile in C++
30 | **[stb_sprintf.h](stb_sprintf.h)** | 1.06 | utility | 1860 | fast sprintf, snprintf for C/C++
31 | **[stretchy_buffer.h](stretchy_buffer.h)** | 1.03 | utility | 262 | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
32 | **[stb_textedit.h](stb_textedit.h)** | 1.13 | user interface | 1404 | guts of a text editor for games etc implementing them from scratch
33 | **[stb_voxel_render.h](stb_voxel_render.h)** | 0.88 | 3D graphics | 3806 | Minecraft-esque voxel rendering "engine" with many more features
34 | **[stb_dxt.h](stb_dxt.h)** | 1.08b | 3D graphics | 728 | Fabian "ryg" Giesen's real-time DXT compressor
35 | **[stb_perlin.h](stb_perlin.h)** | 0.4 | 3D graphics | 427 | revised Perlin noise (3D input, 1D output)
36 | **[stb_easy_font.h](stb_easy_font.h)** | 1.0 | 3D graphics | 303 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
37 | **[stb_tilemap_editor.h](stb_tilemap_editor.h)** | 0.41 | game dev | 4161 | embeddable tilemap editor
38 | **[stb_herringbone_wa...](stb_herringbone_wang_tile.h)** | 0.7 | game dev | 1221 | herringbone Wang tile map generator
39 | **[stb_c_lexer.h](stb_c_lexer.h)** | 0.11 | parsing | 966 | simplify writing parsers for C-like languages
40 | **[stb_divide.h](stb_divide.h)** | 0.92 | math | 421 | more useful 32-bit modulus e.g. "euclidean divide"
41 | **[stb_connected_comp...](stb_connected_components.h)** | 0.96 | misc | 1049 | incrementally compute reachability on grids
42 | **[stb.h](stb.h)** | 2.35 | misc | 14453 | helper functions for C, mostly redundant in C++; basically author's personal stuff
43 | **[stb_leakcheck.h](stb_leakcheck.h)** | 0.5 | misc | 190 | quick-and-dirty malloc/free leak-checking
44 | **[stb_include.h](stb_include.h)** | 0.01 | misc | 288 | implement recursive #include support, particularly for GLSL
45 |
46 | Total libraries: 22
47 | Total lines of C code: 56088
48 |
49 |
50 | FAQ
51 | ---
52 |
53 | #### What's the license?
54 |
55 | These libraries are in the public domain. You can do anything you
56 | want with them. You have no legal obligation
57 | to do anything else, although I appreciate attribution.
58 |
59 | They are also licensed under the MIT open source license, if you have lawyers
60 | who are unhappy with public domain. Every source file includes an explicit
61 | dual-license for you to choose from.
62 |
63 | #### Are there other single-file public-domain/open source libraries with minimal dependencies out there?
64 |
65 | [Yes.](https://github.com/nothings/single_file_libs)
66 |
67 | #### If I wrap an stb library in a new library, does the new library have to be public domain/MIT?
68 |
69 | No, because it's public domain you can freely relicense it to whatever license your new
70 | library wants to be.
71 |
72 | #### What's the deal with SSE support in GCC-based compilers?
73 |
74 | stb_image will either use SSE2 (if you compile with -msse2) or
75 | will not use any SIMD at all, rather than trying to detect the
76 | processor at runtime and handle it correctly. As I understand it,
77 | the approved path in GCC for runtime-detection require
78 | you to use multiple source files, one for each CPU configuration.
79 | Because stb_image is a header-file library that compiles in only
80 | one source file, there's no approved way to build both an
81 | SSE-enabled and a non-SSE-enabled variation.
82 |
83 | While we've tried to work around it, we've had multiple issues over
84 | the years due to specific versions of gcc breaking what we're doing,
85 | so we've given up on it. See https://github.com/nothings/stb/issues/280
86 | and https://github.com/nothings/stb/issues/410 for examples.
87 |
88 | #### Some of these libraries seem redundant to existing open source libraries. Are they better somehow?
89 |
90 | Generally they're only better in that they're easier to integrate,
91 | easier to use, and easier to release (single file; good API; no
92 | attribution requirement). They may be less featureful, slower,
93 | and/or use more memory. If you're already using an equivalent
94 | library, there's probably no good reason to switch.
95 |
96 | #### Can I link directly to the table of stb libraries?
97 |
98 | You can use [this URL](https://github.com/nothings/stb#stb_libs) to link directly to that list.
99 |
100 | #### Why do you list "lines of code"? It's a terrible metric.
101 |
102 | Just to give you some idea of the internal complexity of the library,
103 | to help you manage your expectations, or to let you know what you're
104 | getting into. While not all the libraries are written in the same
105 | style, they're certainly similar styles, and so comparisons between
106 | the libraries are probably still meaningful.
107 |
108 | Note though that the lines do include both the implementation, the
109 | part that corresponds to a header file, and the documentation.
110 |
111 | #### Why single-file headers?
112 |
113 | Windows doesn't have standard directories where libraries
114 | live. That makes deploying libraries in Windows a lot more
115 | painful than open source developers on Unix-derivates generally
116 | realize. (It also makes library dependencies a lot worse in Windows.)
117 |
118 | There's also a common problem in Windows where a library was built
119 | against a different version of the runtime library, which causes
120 | link conflicts and confusion. Shipping the libs as headers means
121 | you normally just compile them straight into your project without
122 | making libraries, thus sidestepping that problem.
123 |
124 | Making them a single file makes it very easy to just
125 | drop them into a project that needs them. (Of course you can
126 | still put them in a proper shared library tree if you want.)
127 |
128 | Why not two files, one a header and one an implementation?
129 | The difference between 10 files and 9 files is not a big deal,
130 | but the difference between 2 files and 1 file is a big deal.
131 | You don't need to zip or tar the files up, you don't have to
132 | remember to attach *two* files, etc.
133 |
134 | #### Why "stb"? Is this something to do with Set-Top Boxes?
135 |
136 | No, they are just the initials for my name, Sean T. Barrett.
137 | This was not chosen out of egomania, but as a moderately sane
138 | way of namespacing the filenames and source function names.
139 |
140 | #### Will you add more image types to stb_image.h?
141 |
142 | If people submit them, I generally add them, but the goal of stb_image
143 | is less for applications like image viewer apps (which need to support
144 | every type of image under the sun) and more for things like games which
145 | can choose what images to use, so I may decline to add them if they're
146 | too rare or if the size of implementation vs. apparent benefit is too low.
147 |
148 | #### Do you have any advice on how to create my own single-file library?
149 |
150 | Yes. https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
151 |
152 | #### Why public domain?
153 |
154 | I prefer it over GPL, LGPL, BSD, zlib, etc. for many reasons.
155 | Some of them are listed here:
156 | https://github.com/nothings/stb/blob/master/docs/why_public_domain.md
157 |
158 | #### Why C?
159 |
160 | Primarily, because I use C, not C++. But it does also make it easier
161 | for other people to use them from other languages.
162 |
163 | #### Why not C99? stdint.h, declare-anywhere, etc.
164 |
165 | I still use MSVC 6 (1998) as my IDE because it has better human factors
166 | for me than later versions of MSVC.
167 |
168 |
169 |
170 |
--------------------------------------------------------------------------------