GithubHelp home page GithubHelp logo

怎么刷新界面的 about gameplane HOT 3 CLOSED

ispring avatar ispring commented on May 31, 2024
怎么刷新界面的

from gameplane.

Comments (3)

iSpring avatar iSpring commented on May 31, 2024 1

你好,没有额外开其他线程。

我实现了一个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.

liushunyu avatar liushunyu commented on May 31, 2024

我明白是用postInvalidate()方法来重绘了,但我在代码中找不到是在哪一块不断【实时】调用了这个函数,你是设置了什么监听器来实时调用postInvalidate()这个函数的,还是说怎么实现的吖,具体是哪个代码不断调用了呢(注:我想知道的是“不断调用”这个过程是在哪里执行的,而不是哪个函数调用了postInvalidate()),不知道我说清楚了吗

from gameplane.

iSpring avatar iSpring commented on May 31, 2024

postInvalidate()方法会触发View执行onDraw()方法,所以会出现如下调用过程:
onDraw() -> 用Canvas绘图,绘图完成后调用postInvalidate()方法 -> 然后再次触发onDraw() -> ...

可以调试跟一下代码就清楚了

from gameplane.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.