Skip to content
This repository has been archived by the owner on Jan 16, 2018. It is now read-only.

Commit

Permalink
scale with resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
faceair committed Dec 29, 2017
1 parent 2ea2717 commit 175fd06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

## 跳跃系数

跟系统分辨率分辨率有关,但具体换算关系还不太清楚。下面两份数据供参考。
跟系统分辨率有关,但具体换算关系还不太清楚。下面两份数据供参考。
1. 我的手机系统分辨率 720*1280 跳跃系数 2.04
2. 原作者手机分辨率是 1920*1080 跳跃系数是 1.35

Expand Down
12 changes: 9 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ func main() {
bounds := src.Bounds()
w, h := bounds.Max.X, bounds.Max.Y

w10 := (w / 720 * 10)
w20 := (w / 720 * 20)
w30 := (w / 720 * 30)
w35 := (w / 720 * 35)
h200 := (h / 1280 * 200)

points := [][]int{}
for y := 0; y < h; y++ {
line := 0
Expand All @@ -60,7 +66,7 @@ func main() {
if colorSimilar(c, jumpCubeColor, 20) {
line++
} else {
if y > 200 && x-line > 10 && line > 30 {
if y > h200 && x-line > w10 && line > w30 {
points = append(points, []int{x - line/2, y, line})
}
line = 0
Expand All @@ -78,13 +84,13 @@ func main() {
possible := [][]int{}
for y := 0; y < h; y++ {
line := 0
bgColor := src.At(w-10, y)
bgColor := src.At(w-w10, y)
for x := 0; x < w; x++ {
c := src.At(x, y)
if !colorSimilar(c, bgColor, 10) {
line++
} else {
if y > 200 && x-line > 10 && line > 35 && ((x-line/2) < (jumpCube[0]-20) || (x-line/2) > (jumpCube[0]+20)) {
if y > h200 && x-line > w10 && line > w35 && ((x-line/2) < (jumpCube[0]-w20) || (x-line/2) > (jumpCube[0]+w20)) {
possible = append(possible, []int{x - line/2, y, line, x})
}
line = 0
Expand Down

0 comments on commit 175fd06

Please sign in to comment.