Comments (3)
你好,没有额外开其他线程。
我实现了一个GameView,继承自View类,在GameView不断调用postInvalidate()方法,这样就驱动着GameView不断重绘,可以参考这里的代码:
https://github.com/iSpring/GamePlane/blob/master/app/src/main/java/com/ispring/gameplane/game/GameView.java#L214
from gameplane.
我明白是用postInvalidate()方法来重绘了,但我在代码中找不到是在哪一块不断【实时】调用了这个函数,你是设置了什么监听器来实时调用postInvalidate()这个函数的,还是说怎么实现的吖,具体是哪个代码不断调用了呢(注:我想知道的是“不断调用”这个过程是在哪里执行的,而不是哪个函数调用了postInvalidate()),不知道我说清楚了吗
from gameplane.
postInvalidate()方法会触发View执行onDraw()方法,所以会出现如下调用过程:
onDraw() -> 用Canvas绘图,绘图完成后调用postInvalidate()方法 -> 然后再次触发onDraw() -> ...
可以调试跟一下代码就清楚了
from gameplane.
Related Issues (3)
- License HOT 1
- How i can change size of image HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gameplane.