English 中文(简体)
制图
原标题:Graphics Choppy

我正试图向我的游戏过渡,把两个轨道图分开,像从中半向下向上向上向车和向上半向车开车。 不管怎么说,当我这样做时,它确实看着杂乱,框架比率似乎不稳定/无法承受。 这里我怎么做。

public class TFView extends View{
...
public void startlevel(Canvas c){
     long l =(SystemClock.currentThreadTimeMillis()-starttime)/3;//*(height/500);
    if(l<1000){
        c.drawBitmap(metalbottom,0,height/2+l,p);
         c.drawBitmap(metaltop,0,0-l,p);}
    }
 public void endlevel(Canvas c){
     long l =(SystemClock.currentThreadTimeMillis()-failtime)/3;
    if(l>=height/2){
        c.drawBitmap(metaltop, 0, 0, p);
        c.drawBitmap(metalbottom, 0,height/2 , p);
    }
    else{
        c.drawBitmap(metalbottom,0,-height/2+l,p);
     c.drawBitmap(metaltop,0,height-l,p);}
 }}

并且我为我分别打开/打开大门创造了时间。 因此,你认为,我应该改变,使之更顺利过渡? 把它转化为表面调查是否有助于?

最佳回答

I had the same problem. I know what you mean with "choppy". The animation speed is NOT consistent even though you have a time based animation i.e. you are using

SystemClock.currentThreadTimeMillis()

The choppiness is caused by currentThreadTimeMillis(). It "returns milliseconds running in the current thread". That is, when you use currentThreadTimeMillis() "time" only elapses when the current thread is RUNNING. But your renderer thread is NOT ALWAYS running - as you would expect in a multitasking environment. Thus every time the thread is not running your animation is also not "running" (time is not elapsing).

解决办法: 用途

SystemClock.elapsedRealtime()
问题回答

我必须承认我不是安乐施会的最佳选择,但我认为我是这样。

根据您的解释,请您使用

如我所知,如果安乐团提供的图像不够,你就应当把自己的图像用在单独的读物上,执行

这有助于,或看Lunar Lander





相关问题
What to look for in performance analyzer in VS 2008

What to look for in performance analyzer in VS 2008 I am using VS Team system and got the performance wizard and reports going. What benchmarks/process do I use? There is a lot of stuff in the ...

SQL Table Size And Query Performance

We have a number of items coming in from a web service; each item containing an unknown number of properties. We are storing them in a database with the following Schema. Items - ItemID - ...

How to speed up Visual Studio 2008? Add more resources?

I m using Visual Studio 2008 (with the latest service pack) I also have ReSharper 4.5 installed. ReSharper Code analysis/ scan is turned off. OS: Windows 7 Enterprise Edition It takes me a long time ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

热门标签