Programming with SurfaceView and thread strategy for game development

后端 未结 3 910
别那么骄傲
别那么骄傲 2020-12-24 14:55

I am using a SurfaceView and a rendering thread to develop a game based on structure like LunarLander.

However, I faced many problems, and here I want to point them

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 15:53

    the solution is here

    public void surfaceCreated(SurfaceHolder holder){
    
                if (plot_thread.getState() == Thread.State.TERMINATED) {
                    plot_thread = new WaveformPlotThread(getHolder(), this);
                    plot_thread.setRunning(true);
                    plot_thread.start();
                }
                else {
                    plot_thread.setRunning(true);
                    plot_thread.start();
                }
            }
    

提交回复
热议问题