mirror of
https://github.com/etlegacy/JoyStick.git
synced 2025-02-19 18:30:53 +00:00
nougat update
This commit is contained in:
parent
bcc68b351f
commit
f72905eb44
9 changed files with 32 additions and 32 deletions
|
@ -30,7 +30,7 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.github.erz05:JoyStick:1.0.2@aar'
|
||||
compile 'com.github.erz05:JoyStick:1.0.3@aar'
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.1"
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.erz.joystick"
|
||||
minSdkVersion 11
|
||||
targetSdkVersion 23
|
||||
targetSdkVersion 25
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ android {
|
|||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:23.1.0'
|
||||
compile 'com.android.support:design:23.1.0'
|
||||
compile 'com.android.support:appcompat-v7:25.0.0'
|
||||
compile 'com.android.support:design:25.0.0'
|
||||
compile project(':joysticklibrary')
|
||||
}
|
||||
}
|
|
@ -21,4 +21,4 @@
|
|||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
|
@ -46,4 +46,4 @@ public class GameLoop extends Thread {
|
|||
} catch (Exception ignore) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -78,13 +78,13 @@ public class GameView extends SurfaceView implements SurfaceHolder.Callback {
|
|||
canvas.drawColor(Color.BLACK);
|
||||
|
||||
if (stars != null && stars.size() > 0) {
|
||||
for (i=0; i<size; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
stars.get(i).draw(canvas, paint, width, height, maxRadius);
|
||||
}
|
||||
}
|
||||
|
||||
posX -= Math.cos(angle) * (power/2);
|
||||
posY += Math.sin(-angle) * (power/2);
|
||||
posX -= Math.cos(angle) * (power / 2);
|
||||
posY += Math.sin(-angle) * (power / 2);
|
||||
if (posX > width - radius) posX = width - radius;
|
||||
if (posX < radius) posX = radius;
|
||||
if (posY > height - radius) posY = height - radius;
|
||||
|
@ -110,23 +110,23 @@ public class GameView extends SurfaceView implements SurfaceHolder.Callback {
|
|||
this.height = height;
|
||||
min = Math.min(width, height);
|
||||
|
||||
centerX = width/2;
|
||||
centerY = height/2;
|
||||
centerX = width / 2;
|
||||
centerY = height / 2;
|
||||
posX = centerX;
|
||||
posY = centerY;
|
||||
radius = min/12;
|
||||
radius = min / 12;
|
||||
rectF = new RectF(posX - radius, posY - radius, posX + radius, posY + radius);
|
||||
|
||||
minSpeed = (int) (min/75);
|
||||
maxSpeed = (int) (min/25);
|
||||
minSpeed = (int) (min / 75);
|
||||
maxSpeed = (int) (min / 25);
|
||||
|
||||
minRadius = (int) (min/250);
|
||||
maxRadius = (int) (min/220);
|
||||
minRadius = (int) (min / 250);
|
||||
maxRadius = (int) (min / 220);
|
||||
|
||||
if (maxRadius == minRadius) maxRadius += minRadius;
|
||||
|
||||
stars = new Vector<>();
|
||||
for (i=0; i<size; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
tmpRadius = random.nextInt(maxRadius - minRadius) + minRadius;
|
||||
maxX = width - tmpRadius;
|
||||
maxY = height - tmpRadius;
|
||||
|
|
|
@ -42,4 +42,4 @@ public class Star {
|
|||
y = - (max * 4) - radius;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.3.0'
|
||||
classpath 'com.android.tools.build:gradle:2.2.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
@ -20,4 +20,4 @@ allprojects {
|
|||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
}
|
|
@ -2,12 +2,12 @@ apply plugin: 'com.android.library'
|
|||
apply plugin: 'com.novoda.bintray-release'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.1"
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 11
|
||||
targetSdkVersion 23
|
||||
targetSdkVersion 25
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ publish {
|
|||
userOrg = 'erz05'
|
||||
groupId = 'com.github.erz05'
|
||||
artifactId = 'JoyStick'
|
||||
version = '1.0.2'
|
||||
version = '1.0.3'
|
||||
description = 'Android Library for JoyStick View'
|
||||
website = 'https://github.com/erz05/JoyStick'
|
||||
}
|
||||
}
|
|
@ -120,13 +120,13 @@ public class JoyStick extends View {
|
|||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
width = MeasureSpec.getSize(widthMeasureSpec);
|
||||
height = MeasureSpec.getSize(heightMeasureSpec);
|
||||
centerX = width/2;
|
||||
centerY = height/2;
|
||||
centerX = width / 2;
|
||||
centerY = height / 2;
|
||||
min = Math.min(width, height);
|
||||
posX = centerX;
|
||||
posY = centerY;
|
||||
buttonRadius = (min / 2f * (percentage/100f));
|
||||
radius = (min / 2f * ((100f-percentage)/100f));
|
||||
buttonRadius = (min / 2f * (percentage / 100f));
|
||||
radius = (min / 2f * ((100f - percentage) / 100f));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue