Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lfkdsk/JustWeEngine
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.12
Choose a base ref
...
head repository: lfkdsk/JustWeEngine
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Oct 10, 2016

  1. Update SimpleEngine.java

    “return true;”
    移入判断体内,否则多个按钮会无法响应
    hnshilei authored Oct 10, 2016
    Copy the full SHA
    24addb7 View commit details

Commits on Oct 11, 2016

  1. Update FrameAnimation.java

    重载了构造函数,添加了interval选项,可以实现动画切换间隔时间控制,单位ms.
    hnshilei authored Oct 11, 2016
    Copy the full SHA
    b6457a1 View commit details

Commits on Dec 14, 2016

  1. Copy the full SHA
    bdea290 View commit details

Commits on Dec 15, 2016

  1. Copy the full SHA
    caee18b View commit details
  2. fixed ZoomAnimation

    fixed ZoomAnimation
    hnshilei committed Dec 15, 2016
    Copy the full SHA
    6479fc3 View commit details
  3. Copy the full SHA
    1b0f1d9 View commit details
  4. Copy the full SHA
    5bc7cb5 View commit details

Commits on Dec 17, 2016

  1. update readme.md

    lfkdsk committed Dec 17, 2016
    Copy the full SHA
    129484e View commit details

Commits on Jan 1, 2017

  1. fix bug in folder names

    lfkdsk committed Jan 1, 2017
    Copy the full SHA
    18c5e35 View commit details
  2. fix bug in folder names

    lfkdsk committed Jan 1, 2017
    Copy the full SHA
    574b873 View commit details
  3. fix bug in folder names

    lfkdsk committed Jan 1, 2017
    Copy the full SHA
    0bf2261 View commit details
  4. fix bug in folder names

    lfkdsk committed Jan 1, 2017
    Copy the full SHA
    0113b28 View commit details
  5. fix bug in folder names

    lfkdsk committed Jan 1, 2017
    Copy the full SHA
    8a92db2 View commit details
  6. fix bug in folder names

    lfkdsk committed Jan 1, 2017
    Copy the full SHA
    bb5e7ac View commit details
  7. fix bug in folder names

    lfkdsk committed Jan 1, 2017
    3
    Copy the full SHA
    db7ae82 View commit details

Commits on Jan 2, 2017

  1. update read me

    lfkdsk committed Jan 2, 2017
    Copy the full SHA
    6c846d2 View commit details
  2. Delete workspace.xml

    lfkdsk authored Jan 2, 2017
    Copy the full SHA
    7956eb7 View commit details
  3. update read me

    lfkdsk committed Jan 2, 2017
    Copy the full SHA
    cb38e5b View commit details
  4. Copy the full SHA
    eb5a515 View commit details
  5. update read me

    lfkdsk committed Jan 2, 2017
    Copy the full SHA
    12132f9 View commit details
  6. update read me

    lfkdsk committed Jan 2, 2017
    Copy the full SHA
    351554e View commit details

Commits on Feb 23, 2017

  1. Update README.md

    lfkdsk authored Feb 23, 2017
    Copy the full SHA
    0cddc27 View commit details

Commits on Feb 24, 2017

  1. update demo from hnshilei

    lfkdsk authored Feb 24, 2017
    Copy the full SHA
    a76acbd View commit details

Commits on Feb 27, 2017

  1. Copy the full SHA
    c16268c View commit details

Commits on Feb 28, 2017

  1. update engine.jar & gradle

    lfkdsk committed Feb 28, 2017
    Copy the full SHA
    aecaa2f View commit details
  2. Copy the full SHA
    05e48b2 View commit details

Commits on Jan 8, 2018

  1. Update README.md

    lfkdsk authored Jan 8, 2018
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b465b31 View commit details
Showing with 723 additions and 238 deletions.
  1. +15 −7 README.md
  2. +7 −7 build.gradle
  3. +1 −1 eng_info.md
  4. +19 −2 engine/build.gradle
  5. +1 −0 engine/proguard-rules.pro
  6. +0 −140 engine/src/main/java/com/lfk/justweengine/Utils/script/NumberUtils.java
  7. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/AliveAnimation.java
  8. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/AlphaAnimation.java
  9. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/AnimType.java
  10. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/BaseAnim.java
  11. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/CircleMoveAnimation.java
  12. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/DoAfterAnimation.java
  13. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/FenceAnimation.java
  14. +5 −2 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/FrameAnimation.java
  15. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/MoveAnimation.java
  16. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/ShootAnimation.java
  17. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/SpinAnimation.java
  18. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/ThrobAnimation.java
  19. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/VelocityAnimation.java
  20. 0 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/WrapMoveAnimation.java
  21. +18 −23 engine/src/main/java/com/lfk/justweengine/{Anim → anim}/ZoomAnimation.java
  22. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Bone/BoneGroupSprite.java
  23. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Bone/BoneSprite.java
  24. +2 −1 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Button/BaseButton.java
  25. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Button/BaseButtonAnimation.java
  26. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Button/ColorAnimation.java
  27. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Button/OnClickListener.java
  28. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Button/TextButton.java
  29. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Button/TextureButton.java
  30. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Button/ZoomCenterButtonAnim.java
  31. +8 −7 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Sprite/BaseSprite.java
  32. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Sprite/BaseSub.java
  33. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Sprite/FrameType.java
  34. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Sprite/StateFinder.java
  35. 0 engine/src/main/java/com/lfk/justweengine/{Drawable → drawable}/Sprite/StateSprite.java
  36. 0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/Engine.java
  37. 0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/GameTextPrinter.java
  38. +1 −0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/GameTexture.java
  39. +2 −1 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/GameTimer.java
  40. 0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/Layer/ButtonLayer.java
  41. 0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/Layer/DefaultLayer.java
  42. 0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/Layer/Layer.java
  43. +11 −2 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/Layer/LayerEngine.java
  44. 0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/Layer/Screen.java
  45. 0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/Layer/SimpleLayerEngine.java
  46. 0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/ObjectPool.java
  47. +1 −0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/ObjectPoolGroup.java
  48. +13 −2 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/SimpleEngine.java
  49. 0 engine/src/main/java/com/lfk/justweengine/{Engine → engine}/TouchMode.java
  50. 0 engine/src/main/java/com/lfk/justweengine/{Info → info}/UIdefaultData.java
  51. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/blueTooth/BlueToothServer.java
  52. +58 −32 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/blueTooth/BluetoothChatService.java
  53. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/blueTooth/OnMessageBack.java
  54. +1 −1 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/crashHandler/AfterCrashListener.java
  55. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/crashHandler/CrashHandler.java
  56. +1 −1 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/crashHandler/CrashHandlerDefault.java
  57. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/database/DataBase.java
  58. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/database/LabelName.java
  59. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/database/Node.java
  60. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/database/TableName.java
  61. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/database/User.java
  62. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/io/FileIO.java
  63. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/io/GameIO.java
  64. +392 −0 engine/src/main/java/com/lfk/justweengine/utils/joystick/JoystickView.java
  65. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/AndroidLogTool.java
  66. +2 −2 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/LogCat.java
  67. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/LogLevel.java
  68. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/LogParser.java
  69. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/LogTool.java
  70. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/Logger.java
  71. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/LoggerPrinter.java
  72. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/Options.java
  73. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/Printer.java
  74. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/logger/Settings.java
  75. 0 engine/src/main/java/com/lfk/justweengine/{Utils/Music → utils/music}/Music.java
  76. 0 engine/src/main/java/com/lfk/justweengine/{Utils/Music → utils/music}/MusicPlayer.java
  77. 0 engine/src/main/java/com/lfk/justweengine/{Utils/Music → utils/music}/SoundManager.java
  78. 0 engine/src/main/java/com/lfk/justweengine/{Utils/Music → utils/music}/SoundPlayer.java
  79. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/quad/Collisionable.java
  80. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/quad/QuadTree.java
  81. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/script/Exp.java
  82. +1 −1 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/script/Function.java
  83. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/script/KeyCode.java
  84. +140 −0 engine/src/main/java/com/lfk/justweengine/utils/script/NumberUtils.java
  85. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/script/ScriptManager.java
  86. 0 engine/src/main/java/com/lfk/justweengine/{Utils/ShowLogger → utils/showLogger}/LogHandler.java
  87. 0 engine/src/main/java/com/lfk/justweengine/{Utils/ShowLogger → utils/showLogger}/LogPrinter.java
  88. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/tools/DisplayUtils.java
  89. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/tools/ImageHelper.java
  90. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/tools/NetUtils.java
  91. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/tools/PicUtils.java
  92. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/tools/ServiceUtils.java
  93. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/tools/SpUtils.java
  94. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/tools/ValidatorsUtils.java
  95. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/ChangeCharset.java
  96. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/Interface/OnLogResult.java
  97. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/Interface/OnPermissionFile.java
  98. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/Interface/OnPostData.java
  99. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/Interface/OnWebFileResult.java
  100. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/Interface/OnWebResult.java
  101. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/Interface/OnWebStringResult.java
  102. +1 −1 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/RequestSolve.java
  103. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/Servers.java
  104. +2 −2 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/WebServer.java
  105. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/WebServerDefault.java
  106. 0 engine/src/main/java/com/lfk/justweengine/{Utils → utils}/webServer/WebServerService.java
  107. +17 −0 engine/src/main/res/values/attr_joy_stick.xml
  108. +2 −1 gradle.properties
  109. +1 −1 info.md
  110. BIN jar/engine.jar
  111. +1 −1 tw_info.md
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# JustWeEngine - Android Game FrameWork
An easy open source Android Native Game FrameWork.
![logo](art/logo.png)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-JustWeEngine-green.svg?style=true)](https://android-arsenal.com/details/1/2903) [![](https://jitpack.io/v/lfkdsk/JustWeEngine.svg)](https://jitpack.io/#lfkdsk/JustWeEngine)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-JustWeEngine-green.svg?style=true)](https://android-arsenal.com/details/1/2903)
[![](https://jitpack.io/v/lfkdsk/JustWeEngine.svg)](https://jitpack.io/#lfkdsk/JustWeEngine)
[![](https://img.shields.io/badge/downloads-5k%20last%20version-blue.svg)](https://github.com/lfkdsk/JustWeEngine/releases/tag/v1.13)
[![GitHub release](https://img.shields.io/badge/JustWeEngine-v1.13-green.svg)](https://github.com/lfkdsk/JustWeEngine/releases/tag/v1.13)
[![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/lfkdsk/JustWeEngine)


An easy open source Android Native Game FrameWork.

## Engine Flow Chart
![engine](art/engine.jpg)
@@ -29,7 +35,7 @@ An easy open source Android Native Game FrameWork.
``` groovy
dependencies {
compile 'com.github.lfkdsk:JustWeEngine:v1.10'
compile 'com.github.lfkdsk:JustWeEngine:v1.13'
}
```
@@ -54,17 +60,19 @@ An easy open source Android Native Game FrameWork.
<dependency>
<groupId>com.github.lfkdsk</groupId>
<artifactId>JustWeEngine</artifactId>
<version>v1.10</version>
<version>v1.13</version>
</dependency>

```

## Engine in V1.10
## Engine in V1.13

* A plane game Demo:[Demo地址](https://github.com/lfkdsk/EngineDemo)
* Extra modules:[JustWeTools](https://github.com/lfkdsk/JustWeTools)
* Demo for network:[JustWe-WebServer](https://github.com/lfkdsk/JustWe-WebServer)
* StudioVSEclipse from [ice1000](https://github.com/ice1000)[StudioVSEclipse](https://github.com/ice1000/StudioVSEclipse)
* StudioVSEclipse from [ice1000](https://github.com/ice1000)
[StudioVSEclipse](https://github.com/ice1000/StudioVSEclipse)
* Hungry Shark from [hnshilei](https://github.com/hnshilei): [HungryShark](https://github.com/hnshilei/justweTest_HungryShark)

## User Guidance

@@ -84,7 +92,7 @@ Please send your feedback as long as there occurs any inconvenience or problem.

## License

Copyright 2015 [刘丰恺](http://www.cnblogs.com/lfk-dsk/)
Copyright 2017 [刘丰恺](http://www.cnblogs.com/lfk-dsk/)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -18,19 +18,19 @@ allprojects {
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

task releaseJar(type: Copy) {
from( 'build/intermediates/bundles/debug')
from( 'build/bundles/release')
into( 'build/libs')
include('classes.jar')
rename('calsses.jar', 'JustWeEngine' + '.jar')
rename('classes.jar', 'engine_' + version + '.jar')
}

task releaseLib(type: Copy, dependsOn: releaseJar) {
into "../../release"
from 'libs'
from 'build/libs'
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion eng_info.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ An easy open source Android Native Game FrameWork.
``` groovy
dependencies {
compile 'com.github.lfkdsk:JustWeEngine:v1.10'
compile 'com.github.lfkdsk:JustWeEngine:v1.13'
}
```
21 changes: 19 additions & 2 deletions engine/build.gradle
Original file line number Diff line number Diff line change
@@ -2,20 +2,37 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
buildToolsVersion "23.0.3"

defaultConfig {
minSdkVersion 15
targetSdkVersion 23
targetSdkVersion 24
versionCode 1
versionName "1.0"
}

lintOptions {
abortOnError false
}

buildTypes {
release {
//混淆
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

debug {
minifyEnabled false
// Zipalign优化
zipAlignEnabled true
// 移除无用的resource文件
shrinkResources true
// 加载默认混淆配置文件
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
1 change: 1 addition & 0 deletions engine/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -15,3 +15,4 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keep class com.lfkdsk.justweengine.**{ public *;}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.lfk.justweengine.anim;

import com.lfk.justweengine.engine.GameTimer;

/**
* 逐帧动画
*
@@ -10,7 +12,8 @@ public class FrameAnimation extends BaseAnim {
private int firstFrame;
private int lastFrame;
private int direction;
private int interval;//帧动画切换时间间隔,单位ms
private int interval;
// 帧动画切换时间间隔,单位ms
private GameTimer timer;

public FrameAnimation(int firstFrame, int lastFrame, int direction) {
@@ -22,7 +25,7 @@ public FrameAnimation(int firstFrame, int lastFrame, int direction) {
this.interval = 0;
timer = new GameTimer();
}

public FrameAnimation(int firstFrame, int lastFrame, int direction, int interval) {
this.firstFrame = firstFrame;
this.lastFrame = lastFrame;
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

import android.renderscript.Float2;


/**
* 按钮放大缩小动画
*
@@ -16,21 +17,20 @@ public class ZoomAnimation extends BaseAnim {
public int touchType;
private boolean changeType;

// speed永为正值
// speed永为正值
public ZoomAnimation(float from, float to, float speed) {
this.from = from;
this.to = to;
this.speed = speed;
start = false;
animating = false;
this.start = false;
this.animating = true;
changeType = false;
animType = AnimType.ZOOM;
}

@Override
public Float2 adjustScale(Float2 ori) {
if (!start) {
from = ori.x;
start = true;
}

@@ -40,32 +40,27 @@ public Float2 adjustScale(Float2 ori) {
return ori;
}

if (ori.x == to && ori.y == to) {
touchType = -touchType;
float temp = to;
to = from;
from = temp;
changeType = true;
return ori;
}

if (from < to) { // 放大
if (ori.x + speed <= to) {
ori.x += speed;
ori.y += speed;
if (from + speed < to) {
from += speed;
} else {
ori.x = to;
ori.y = to;
from = to;
}
} else if (from > to) { // 缩小
if (ori.x - speed >= to) {
ori.x -= speed;
ori.x -= speed;
if (from - speed > to) {
from -= speed;
} else {
ori.x = to;
ori.y = to;
from = to;
}
}

if (from == to) {
touchType = -touchType;
changeType = true;
}

ori.x = from;
ori.y = from;
return ori;
}

Original file line number Diff line number Diff line change
@@ -97,5 +97,6 @@ public BaseButtonAnimation getAnimation() {
return b_baseAnim;
}

public void setNormal(boolean b_normal){}
public void setNormal(boolean b_normal) {
}
}
Original file line number Diff line number Diff line change
@@ -173,22 +173,20 @@ public void drawWithFixedFrame() {
// set rect
src.set(u, v, u + s_width, v + s_height);
// scale
int w = (int) (s_width * s_scale.x);
int h = (int) (s_height * s_scale.y);
int w = s_width;//* s_scale.x
int h = s_height;
s_dst.set(0, 0, w, h);
// draw the frame
s_paint.setAlpha(s_alpha);
s_frameBitmap.eraseColor(Color.TRANSPARENT);

s_frameCanvas.drawBitmap(s_texture.getBitmap(), src, s_dst, s_paint);

s_matrix.reset();

s_mat_scale.reset();
s_mat_rotate.reset();
s_mat_translation.reset();

s_mat_scale.setScale(s_scale.x, s_scale.y);
s_mat_scale.setScale((float) Math.sqrt(s_scale.x), (float) Math.sqrt(s_scale.y));
s_mat_rotate.setRotate((float) Math.toDegrees(s_rotation));
s_mat_translation.setTranslate(s_position.x, s_position.y);

@@ -541,8 +539,8 @@ public void setOffender(BaseSub e_offender) {
public RectF getBounds() {
// scaled
return new RectF((int) s_position.x, (int) s_position.y,
(int) (s_position.x + s_width * s_scale.x),
(int) (s_position.y + s_height * s_scale.y));
(int) (s_position.x + s_width * Math.sqrt(s_scale.x)),
(int) (s_position.y + s_height * Math.sqrt(s_scale.y)));//这里取平方根,不然假设scale=2,算出来就变成了放大4倍。
}

/**
@@ -660,6 +658,9 @@ protected void doAnimation(BaseAnim anim) {
s_position = anim.adjustPosition(s_position);
s_alive = anim.adjustAlive(s_alive);
break;
case ZOOM:
s_scale = anim.adjustScale(s_scale);
break;
}
// listener
if (afterAnimation != null)
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ public void setBitmap(Bitmap e_bitmap) {

/**
* 从大图取出小图
*
* @param x 横轴
* @param y 纵轴
* @param w 宽
Original file line number Diff line number Diff line change
@@ -2,8 +2,9 @@

/**
* 计时器
*
* <p>
* 控制帧数\节律
*
* @author liufengkai
* Created by liufengkai on 15/11/27.
*/
Original file line number Diff line number Diff line change
@@ -5,7 +5,9 @@
import android.graphics.RectF;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.FrameLayout;

import com.lfk.justweengine.drawable.Sprite.BaseSub;
import com.lfk.justweengine.engine.Engine;
@@ -21,6 +23,8 @@
public abstract class LayerEngine extends Engine {
protected Screen layerEngineScreen;

protected FrameLayout layerEngineScreenLayout;

public abstract void init();

public abstract void load();
@@ -67,6 +71,12 @@ public void Touch(MotionEvent event) {
touch(event);
}
});

layerEngineScreenLayout = new FrameLayout(this);
layerEngineScreenLayout.addView(layerEngineScreen, new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
));
}

@Override
@@ -78,11 +88,10 @@ protected void onCreate(Bundle savedInstanceState) {
this.Engine();
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFormat(PixelFormat.TRANSLUCENT);
setContentView(layerEngineScreen);
setContentView(layerEngineScreenLayout);
layerEngineScreen.createScreen();

Logger.d("engine onCreate end");

}

/**
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ public class ObjectPoolGroup {
private final ObjectPool.publicObjectFactory factory;
// default max size
private final int maxSize;

/**
* 初始化对象池
*
Original file line number Diff line number Diff line change
@@ -16,7 +16,9 @@
import android.view.MotionEvent;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.FrameLayout;

import com.lfk.justweengine.drawable.Button.BaseButton;
import com.lfk.justweengine.drawable.Sprite.BaseSub;
@@ -36,6 +38,7 @@
*/
public abstract class SimpleEngine extends Engine implements Runnable, View.OnTouchListener {
private SurfaceView e_surfaceView;
private FrameLayout e_surfaceViewLayout;
private Canvas e_canvas;
// 主循环
private Thread e_thread;
@@ -143,8 +146,15 @@ protected void onCreate(Bundle savedInstanceState) {
// init surfaceView
e_surfaceView = new SurfaceView(this);

e_surfaceViewLayout = new FrameLayout(this);

e_surfaceViewLayout.addView(e_surfaceView, new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
));

// set content view
setContentView(e_surfaceView);
setContentView(e_surfaceViewLayout);

// touch listener
e_surfaceView.setOnTouchListener(this);
@@ -741,8 +751,9 @@ private boolean findTouchButton(MotionEvent event) {
button.setNormal(false);
e_is_hit_button = true;
e_hit_button = button;
return true; //移入判断体,否则多个按钮会无法响应
}
return true;
// return true;
}
break;
case MotionEvent.ACTION_UP:
Original file line number Diff line number Diff line change
@@ -70,8 +70,9 @@ public class BluetoothChatService {

/**
* Constructor. Prepares a new BluetoothChat session.
* @param context The UI Activity Context
* @param handler A Handler to send messages back to the UI Activity
*
* @param context The UI Activity Context
* @param handler A Handler to send messages back to the UI Activity
*/
public BluetoothChatService(Context context, Handler handler) {
mAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -81,7 +82,8 @@ public BluetoothChatService(Context context, Handler handler) {

/**
* Set the current state of the chat connection
* @param state An integer defining the current connection state
*
* @param state An integer defining the current connection state
*/
private synchronized void setState(int state) {
if (D) Log.d(TAG, "setState() " + mState + " -> " + state);
@@ -92,22 +94,30 @@ private synchronized void setState(int state) {
}

/**
* Return the current connection state. */
* Return the current connection state.
*/
public synchronized int getState() {
return mState;
}

/**
* Start the chat service. Specifically start AcceptThread to begin a
* session in listening (server) mode. Called by the Activity onResume() */
* session in listening (server) mode. Called by the Activity onResume()
*/
public synchronized void start() {
if (D) Log.d(TAG, "start");

// Cancel any thread attempting to make a connection
if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
if (mConnectThread != null) {
mConnectThread.cancel();
mConnectThread = null;
}

// Cancel any thread currently running a connection
if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
if (mConnectedThread != null) {
mConnectedThread.cancel();
mConnectedThread = null;
}

setState(STATE_LISTEN);

@@ -124,19 +134,26 @@ public synchronized void start() {

/**
* Start the ConnectThread to initiate a connection to a remote device.
* @param device The BluetoothDevice to connect
*
* @param device The BluetoothDevice to connect
* @param secure Socket Security type - Secure (true) , Insecure (false)
*/
public synchronized void connect(BluetoothDevice device, boolean secure) {
if (D) Log.d(TAG, "connect to: " + device);

// Cancel any thread attempting to make a connection
if (mState == STATE_CONNECTING) {
if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
if (mConnectThread != null) {
mConnectThread.cancel();
mConnectThread = null;
}
}

// Cancel any thread currently running a connection
if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
if (mConnectedThread != null) {
mConnectedThread.cancel();
mConnectedThread = null;
}

// Start the thread to connect with the given device
mConnectThread = new ConnectThread(device, secure);
@@ -146,18 +163,25 @@ public synchronized void connect(BluetoothDevice device, boolean secure) {

/**
* Start the ConnectedThread to begin managing a Bluetooth connection
* @param socket The BluetoothSocket on which the connection was made
* @param device The BluetoothDevice that has been connected
*
* @param socket The BluetoothSocket on which the connection was made
* @param device The BluetoothDevice that has been connected
*/
public synchronized void connected(BluetoothSocket socket, BluetoothDevice
device, final String socketType) {
if (D) Log.d(TAG, "connected, Socket Type:" + socketType);

// Cancel the thread that completed the connection
if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
if (mConnectThread != null) {
mConnectThread.cancel();
mConnectThread = null;
}

// Cancel any thread currently running a connection
if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
if (mConnectedThread != null) {
mConnectedThread.cancel();
mConnectedThread = null;
}

// Cancel the accept thread because we only want to connect to one device
if (mSecureAcceptThread != null) {
@@ -213,6 +237,7 @@ public synchronized void stop() {

/**
* Write to the ConnectedThread in an unsynchronized manner
*
* @param out The bytes to write
* @see ConnectedThread#write(byte[])
*/
@@ -270,13 +295,13 @@ private class AcceptThread extends Thread {

public AcceptThread(boolean secure) {
BluetoothServerSocket tmp = null;
mSocketType = secure ? "Secure":"Insecure";
mSocketType = secure ? "Secure" : "Insecure";

// Create a new listening server socket
try {
if (secure) {
tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE,
MY_UUID_SECURE);
MY_UUID_SECURE);
} else {
tmp = mAdapter.listenUsingInsecureRfcommWithServiceRecord(
NAME_INSECURE, MY_UUID_INSECURE);
@@ -309,21 +334,21 @@ public void run() {
if (socket != null) {
synchronized (BluetoothChatService.this) {
switch (mState) {
case STATE_LISTEN:
case STATE_CONNECTING:
// Situation normal. Start the connected thread.
connected(socket, socket.getRemoteDevice(),
mSocketType);
break;
case STATE_NONE:
case STATE_CONNECTED:
// Either not ready or already connected. Terminate new socket.
try {
socket.close();
} catch (IOException e) {
Log.e(TAG, "Could not close unwanted socket", e);
}
break;
case STATE_LISTEN:
case STATE_CONNECTING:
// Situation normal. Start the connected thread.
connected(socket, socket.getRemoteDevice(),
mSocketType);
break;
case STATE_NONE:
case STATE_CONNECTED:
// Either not ready or already connected. Terminate new socket.
try {
socket.close();
} catch (IOException e) {
Log.e(TAG, "Could not close unwanted socket", e);
}
break;
}
}
}
@@ -469,7 +494,8 @@ public void run() {

/**
* Write to the connected OutStream.
* @param buffer The bytes to write
*
* @param buffer The bytes to write
*/
public void write(byte[] buffer) {
try {
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.lfk.justweengine.utils.crashHandler;

/**
* AfterCrashListener
* AfterCrashListener
* save info after crash
*
* @author liufengkai
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ public class CrashHandlerDefault {
public static final String Log_Default_Path =
Environment.getExternalStorageDirectory() + "/CrashLog";

public static void init(){
public static void init() {
File file = new File(CrashHandlerDefault.Log_Default_Path);
if (!file.exists()) {
file.mkdirs();
Original file line number Diff line number Diff line change
@@ -0,0 +1,392 @@
package com.lfk.justweengine.utils.joystick;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

import com.lfk.justweengine.R;


/**
* Joystick
*
* @author liufengkai
* Created by liufengkai on 2016/12/16.
*/

public class JoystickView extends View implements Runnable {

///////////////////////////////////////////////////////////////////////////
// interface
///////////////////////////////////////////////////////////////////////////

public interface OnMovedListener {
/**
* CallBack For Moved
*
* @param angle angle of the button
* @param length the length of you moved
*/
void onMoved(int angle, int length);
}

private OnMovedListener mOnMovedListener;

private int mPosX = 0;
private int mPosY = 0;
/**
* the center of the button
*/
private int mCenterX = 0;
private int mCenterY = 0;

/**
* button radius
*/
private int mButtonRadius;
/**
* boarder radius
*/
private int mBorderRadius;

private int mBackgroundColor = Color.WHITE;

private boolean isCircleWithBackground = false;

private Bitmap mCircleBackground = null;

private Paint mPaintBackground;
private Paint mPaintCircleBorder;
private Paint mPaintBitmapBackground;
private Paint mPaintCircleButton;

private int mCurrentPointAction = MotionEvent.ACTION_CANCEL;

/**
* border default color
*/
private static final int DEFAULT_COLOR = Color.GREEN;

/**
* background default color
*/
private static final int DEFAULT_BACKGROUND_COLOR = Color.TRANSPARENT;

/**
* default view size
*/
private static final int DEFAULT_SIZE = 200;

/**
* default button size
*/
private static final double RATIO_SIZE_BUTTON = 0.25;

/**
* default border size
*/
private static final double RATIO_SIZE_BORDER = 0.75;

/**
* default border 's width
*/
private static final int DEFAULT_WIDTH_BORDER = 3;

private static final int DEFAULT_LOOP_INTERVAL = 50; // in milliseconds

private OnMovedListener mCallback = null;

private long mLoopInterval = DEFAULT_LOOP_INTERVAL;

private boolean isRunning = false;

private Thread mThread = null;

public JoystickView(Context context, AttributeSet attrs) {
super(context, attrs);

int buttonColor = DEFAULT_COLOR;
int borderColor = DEFAULT_COLOR;
int backgroundColor = DEFAULT_BACKGROUND_COLOR;
int borderWidth = DEFAULT_WIDTH_BORDER;

if (attrs != null) {
TypedArray styledAttributes = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.JoystickView,
0, 0
);


buttonColor = styledAttributes.getColor(R.styleable.JoystickView_JV_buttonColor, DEFAULT_COLOR);
borderColor = styledAttributes.getColor(R.styleable.JoystickView_JV_borderColor, DEFAULT_COLOR);
backgroundColor = styledAttributes.getColor(R.styleable.JoystickView_JV_backgroundColor, DEFAULT_BACKGROUND_COLOR);
borderWidth = styledAttributes.getDimensionPixelSize(R.styleable.JoystickView_JV_borderWidth, DEFAULT_WIDTH_BORDER);
// mFixedCenter = styledAttributes.getBoolean(R.styleable.JoystickView_JV_fixedCenter, DEFAULT_FIXED_CENTER);

styledAttributes.recycle();
}

mPaintCircleButton = new Paint();
mPaintCircleButton.setAntiAlias(true);
mPaintCircleButton.setColor(buttonColor);
mPaintCircleButton.setStyle(Paint.Style.FILL);

mPaintCircleBorder = new Paint();
mPaintCircleBorder.setAntiAlias(true);
mPaintCircleBorder.setColor(borderColor);
mPaintCircleBorder.setStyle(Paint.Style.STROKE);
mPaintCircleBorder.setStrokeWidth(borderWidth);

mPaintBackground = new Paint();
mPaintBackground.setAntiAlias(true);
mPaintBackground.setColor(backgroundColor);
mPaintBackground.setStyle(Paint.Style.FILL);
}

public JoystickView(Context context) {
this(context, null);
}


///////////////////////////////////////////////////////////////////////////
// initial message
///////////////////////////////////////////////////////////////////////////

private void initial() {
mCenterX = mPosX = getWidth() / 2;
mCenterY = mPosY = getWidth() / 2;
downPosX = 0;
downPosY = 0;
deltaX = 0;
deltaY = 0;
setRunning(false);
}


///////////////////////////////////////////////////////////////////////////
// draw
///////////////////////////////////////////////////////////////////////////

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);

// draw background color
canvas.drawColor(mBackgroundColor);
// if (isCircleWithBackground && mCircleBackground != null) {
//
// }
// border background
canvas.drawCircle(mCenterX, mCenterY, mBorderRadius, mPaintBackground);
// circle border background
canvas.drawCircle(mCenterX, mCenterY, mBorderRadius, mPaintCircleBorder);
// circle button
canvas.drawCircle(mPosX, mPosY, mButtonRadius, mPaintCircleButton);
}

///////////////////////////////////////////////////////////////////////////
// measure size
///////////////////////////////////////////////////////////////////////////

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int d = Math.min(measure(widthMeasureSpec), measure(heightMeasureSpec));
setMeasuredDimension(d, d);
}

private int measure(int measureSpec) {
if (MeasureSpec.getMode(measureSpec) == MeasureSpec.UNSPECIFIED) {
// if no bounds are specified return a default size (200)
return DEFAULT_SIZE;
} else {
// As you want to fill the available space
// always return the full available bounds.
return MeasureSpec.getSize(measureSpec);
}
}


@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);

initial();

// radius based on smallest size : height OR width
int d = Math.min(w, h);
mButtonRadius = (int) (d / 2 * RATIO_SIZE_BUTTON);
mBorderRadius = (int) (d / 2 * RATIO_SIZE_BORDER);
}

///////////////////////////////////////////////////////////////////////////
// onTouchEvent
///////////////////////////////////////////////////////////////////////////

int downPosX = 0, downPosY = 0;
int deltaX = 0, deltaY = 0;
boolean absLargeFlag = false;

@Override
public boolean onTouchEvent(MotionEvent event) {
// to move the button according to the finger coordinate
mCurrentPointAction = event.getAction();

int currentPosX = (int) (event.getX());
int currentPosY = (int) (event.getY());

switch (mCurrentPointAction) {
case MotionEvent.ACTION_DOWN:
downPosX = currentPosX;
downPosY = currentPosY;

if (mThread == null) {
mThread = new Thread(this);
setRunning(true);
mThread.start();
}

break;
case MotionEvent.ACTION_MOVE:
deltaX = currentPosX - downPosX;
deltaY = currentPosY - downPosY;

mPosX += deltaX;
mPosY += deltaY;

double abs = getAbs(mPosX, mPosY);

if (absLargeFlag && abs > mBorderRadius) {
mPosX = currentPosX;
mPosY = currentPosY;
abs = getAbs(mPosX, mPosY);
}

if (abs > mBorderRadius) {
absLargeFlag = true;

mPosX = (int) ((mPosX - mCenterX) * mBorderRadius / abs + mCenterX);
mPosY = (int) ((mPosY - mCenterY) * mBorderRadius / abs + mCenterY);

downPosX = mPosX;
downPosY = mPosY;
break;
} else {
absLargeFlag = false;
}

downPosX = currentPosX;
downPosY = currentPosY;
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
initial();
invalidate();
return true;
}

invalidate();

return true;
}

private double getAbs(int posX, int posY) {
return Math.sqrt((posX - mCenterX) * (posX - mCenterX)
+ (posY - mCenterY) * (posY - mCenterY));
}

/**
* Process the angle following the 360° counter-clock protractor rules.
*
* @return the angle of the button
*/
private int getAngle() {
int angle = (int) Math.toDegrees(Math.atan2(mCenterY - mPosY, mPosX - mCenterX));
return angle < 0 ? angle + 360 : angle; // make it as a regular counter-clock protractor
}


/**
* Process the strength as a percentage of the distance between the center and the border.
*
* @return the strength of the button
*/
private int getStrength() {
return (int) (100 * Math.sqrt((mPosX - mCenterX)
* (mPosX - mCenterX) + (mPosY - mCenterY)
* (mPosY - mCenterY)) / mBorderRadius);
}

///////////////////////////////////////////////////////////////////////////
// getter && setter
///////////////////////////////////////////////////////////////////////////

public OnMovedListener getOnMovedListener() {
return mOnMovedListener;
}

public void setOnMovedListener(OnMovedListener onMovedListener) {
mOnMovedListener = onMovedListener;
}

public int getBackgroundColor() {
return mBackgroundColor;
}

@Override
public void setBackgroundColor(int backgroundColor) {
mBackgroundColor = backgroundColor;
}

public void setCircleBackground(Bitmap circleWithBackground) {
setCircleWithBackground(true);
this.mCircleBackground = circleWithBackground;
}

public void setCircleWithBackground(boolean circleWithBackground) {
isCircleWithBackground = circleWithBackground;
}

public OnMovedListener getCallback() {
return mCallback;
}

public void setCallback(OnMovedListener callback) {
mCallback = callback;
}

public boolean isRunning() {
return isRunning;
}

public void setRunning(boolean running) {
isRunning = running;
}

private Runnable runnable = new Runnable() {
public void run() {
if (mCallback != null)
mCallback.onMoved(getAngle(), getStrength());
}
};

@Override
public void run() {
while (isRunning) {

post(runnable);

try {
Thread.sleep(mLoopInterval);
} catch (InterruptedException e) {
break;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ public LogCat filter(String tag, LogLevel lev) {

if (!TextUtils.isEmpty(tag)) {
commandLine.add(tag.trim() + ":" + levStr);
// Log.d("ddd", "filter: " + commandLine.get(commandLine.size()-1));
// Log.d("ddd", "filter: " + commandLine.get(commandLine.size()-1));
commandLine.add("*:S");
} else {
commandLine.add("*:" + levStr);
@@ -87,7 +87,7 @@ public Process commit() {
exec = Runtime.getRuntime().exec(commandLine.toArray(new String[this.commandLine.size()]));
} catch (IOException e) {
e.printStackTrace();
}finally {
} finally {
commandLine = new ArrayList<>(DEFAULT_COMMAND);
}
return exec;
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ public class Function {
private long startIndex;
// 函数结束位置
private long endIndex;

public Function(long startIndex, long endIndex) {
this.startIndex = startIndex;
this.endIndex = endIndex;
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package com.lfk.justweengine.utils.script;

public class NumberUtils {

private NumberUtils() {

}

public static int mid(int i, int min, int max) {
return (int) Math.max(i, Math.min(min, max));
}

public static int[] getLimit(float x, float y, float width, float height,
float rotate) {
double rotation = Math.toRadians(rotate);
double angSin = Math.sin(rotation);
double angCos = Math.cos(rotation);
int newW = (int) Math.floor((width * Math.abs(angCos))
+ (height * Math.abs(angSin)));
int newH = (int) Math.floor((height * Math.abs(angCos))
+ (width * Math.abs(angSin)));
int centerX = (int) (x + (width / 2));
int centerY = (int) (y + (height / 2));
int newX = (int) (centerX - (newW / 2));
int newY = (int) (centerY - (newH / 2));
return new int[]{newX, newY, newW, newH};
}

final static private String[] zeros = {"", "0", "00", "000", "0000",
"00000", "000000", "0000000", "00000000", "000000000", "0000000000"};

/**
* 为指定数值补足位数
*
* @param number
* @param numDigits
* @return
*/
public static String addZeros(long number, int numDigits) {
return addZeros(String.valueOf(number), numDigits);
}

/**
* 为指定数值补足位数
*
* @param number
* @param numDigits
* @return
*/
public static String addZeros(String number, int numDigits) {
int length = numDigits - number.length();
if (length != 0) {
number = zeros[length] + number;
}
return number;
}

/**
* 判断是否为数字
*
* @param param
* @return
*/
public static boolean isNan(String param) {
boolean result = false;
if (param == null || "".equals(param)) {
return result;
}
param = param.replace('d', '_').replace('f', '_');
try {
Double test = new Double(param);
test.intValue();
result = true;
} catch (NumberFormatException ex) {
return result;
}
return result;
}

/**
* 检查一个数字是否为空
*
* @param val
* @return
*/
public static boolean isEmpty(int val) {
return (val == Integer.MIN_VALUE) ? true : 0 == val;
}

/**
* 检查一个字符串数字是否为空
*
* @param val
* @return
*/
public static boolean isEmpty(String val) {
return (val == null | "".equals(val) | (val != null && val.equals(Integer
.toString(Integer.MAX_VALUE))));
}

/**
* 单纯计算两个数值的百分比
*
* @param divisor
* @param dividend
* @return
*/
public static double toPercent(long divisor, long dividend) {
if (divisor == 0 || dividend == 0) {
return 0f;
}
double cf = divisor * 1f;
double pf = dividend * 1f;

return (Math.round(cf / pf * 10000f) * 1f) / 100f;
}

/**
* 获得100%进制剩余数值百分比。
*
* @param maxValue
* @param minusValue
* @return
*/
public static double minusPercent(double maxValue, double minusValue) {
return 100 - ((minusValue / maxValue) * 100);
}

/**
* 获得100%进制数值百分比。
*
* @param maxValue
* @param minusValue
* @return
*/
public static double percent(double maxValue, double minValue) {
return (minValue / maxValue) * 100;
}

}
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ public class RequestSolve extends Thread {
// url in link
private String url;
private HashMap<String, String> params;
// private String urlName = "";
// private String urlName = "";
private int type;

public RequestSolve(Socket s) {
Original file line number Diff line number Diff line change
@@ -109,8 +109,8 @@ public void apply(final String rule) {
webServerRule.put(rule, new OnPermissionFile() {
@Override
public File OnPermissionFile(String name) {
Logger.e(WebServerDefault.WebServerFiles + rule + name);
return new File(WebServerDefault.WebServerFiles + rule + name);
Logger.e(WebServerDefault.WebServerFiles + rule + name);
return new File(WebServerDefault.WebServerFiles + rule + name);
}
});
}
17 changes: 17 additions & 0 deletions engine/src/main/res/values/attr_joy_stick.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<declare-styleable name="JoystickView">

<attr name="JV_buttonColor" format="color"/>

<attr name="JV_borderColor" format="color"/>

<attr name="JV_backgroundColor" format="color"/>

<attr name="JV_borderWidth" format="dimension"/>

<attr name="JV_fixedCenter" format="boolean"/>

</declare-styleable>
</resources>
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -15,4 +15,5 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
version = 1.0.3
2 changes: 1 addition & 1 deletion info.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ An easy open source Android Native Game FrameWork.
``` groovy
dependencies {
compile 'com.github.lfkdsk:JustWeEngine:v1.10'
compile 'com.github.lfkdsk:JustWeEngine:v1.13'
}
```
Binary file modified jar/engine.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion tw_info.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ An easy open source Android Native Game FrameWork.
``` groovy
dependencies {
compile 'com.github.lfkdsk:JustWeEngine:v1.05beta'
compile 'com.github.lfkdsk:JustWeEngine:v1.13'
}
```