Skip to content

Commit

Permalink
Add opengl background view can desktroy object gp if it is out of range
Browse files Browse the repository at this point in the history
  • Loading branch information
kineita committed May 5, 2020
1 parent ef0172d commit 4db8a67
Show file tree
Hide file tree
Showing 20 changed files with 706 additions and 236 deletions.
31 changes: 31 additions & 0 deletions opengl/src/main/java/jp/eita/canvasgl/glview/GLObject.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
*
* * Copyright [2020 - Present] [Lê Trần Ngọc Thành - 瑛太 (eita)] [kineita (Github)]
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package jp.eita.canvasgl.glview

import android.graphics.Canvas
import jp.eita.canvasgl.ICanvasGL

abstract class GLObject {

abstract fun glDraw(iCanvasGL: ICanvasGL)

abstract fun normalDraw(canvas: Canvas)

abstract fun onDestroy()
}
13 changes: 4 additions & 9 deletions openglsample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
/*
* Copyright [2020 - Present] [Lê Trần Ngọc Thành - 瑛太 (eita)] [kineita (Github)]
*
Expand All @@ -18,6 +17,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.eita.example">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
Expand All @@ -35,13 +35,8 @@
</intent-filter>
</activity>

<activity android:name="jp.eita.example.bubble.OpenGLActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="jp.eita.example.main.bubble.BubbleActivity" />

<activity android:name=".main.reaction.ReactionActivity" />
</application>
</manifest>
44 changes: 44 additions & 0 deletions openglsample/src/main/java/jp/eita/example/AnimatorUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
*
* * Copyright [2020 - Present] [Lê Trần Ngọc Thành - 瑛太 (eita)] [kineita (Github)]
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package jp.eita.example

import android.os.Handler
import jp.eita.example.model.MovableCollisionObject
import jp.eita.example.structure.AlphaList
import jp.eita.example.structure.ScaleRatioList

object AnimatorUtils {

private val listMovableCollisionObject: MutableList<MovableCollisionObject> = ArrayList()

private val scaleRatioList: ScaleRatioList = ScaleRatioList(0)

private val alphaList: AlphaList = AlphaList(0)

private val runnableScaleSizeRatio = Runnable {

}

fun animateScaleSize(movableCollisionObject: MovableCollisionObject, scaleSizeRatio: Float, timeDelayToAnimate: Long) {
listMovableCollisionObject.add(movableCollisionObject)
scaleRatioList.add(scaleSizeRatio)
movableCollisionObject.scaleSizeRatio = scaleSizeRatio
Handler().postDelayed(runnableScaleSizeRatio, timeDelayToAnimate)
}
}
70 changes: 0 additions & 70 deletions openglsample/src/main/java/jp/eita/example/bubble/OpenGLView.kt

This file was deleted.

This file was deleted.

14 changes: 10 additions & 4 deletions openglsample/src/main/java/jp/eita/example/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import jp.eita.example.main.OpenGLName.OPENGL
import jp.eita.example.R
import jp.eita.example.bubble.OpenGLActivity
import jp.eita.example.main.bubble.BubbleActivity
import jp.eita.example.main.OpenGLName.OPENGL
import jp.eita.example.main.OpenGLName.REACTION
import jp.eita.example.main.reaction.ReactionActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
Expand All @@ -33,7 +35,10 @@ class MainActivity : AppCompatActivity() {
val intent: Intent
when (it.tag) {
OPENGL -> {
intent = Intent(this, OpenGLActivity::class.java)
intent = Intent(this, BubbleActivity::class.java)
}
REACTION -> {
intent = Intent(this, ReactionActivity::class.java)
}
else -> {
return@OnClickListener
Expand All @@ -43,7 +48,8 @@ class MainActivity : AppCompatActivity() {
}

private val listParameters: List<OpenGLParameters> = listOf(
OpenGLParameters(OPENGL)
OpenGLParameters(OPENGL),
OpenGLParameters(REACTION)
)

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
2 changes: 2 additions & 0 deletions openglsample/src/main/java/jp/eita/example/main/OpenGLName.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ package jp.eita.example.main
object OpenGLName {

const val OPENGL: String = "Bubble"

const val REACTION: String = "Reaction"
}
Loading

0 comments on commit 4db8a67

Please sign in to comment.