In the past two days, I have nothing to learn about game development. After reading some materials, I am ready to start. For future coding convenience, I first wrote a simple game framework to help myself do my exercises later.
If there are no special requirements in the future-such as opengl or something, we will try to use this simple framework for implementation. If there are optimizations, they will be updated throughout the process. If there are any problems, I hope you can help me provide some suggestions.
My basic refresh Thread class
LoopThread DEBUG = Object lock = RUNNING = 1 PAUSE = 2 STOP = 0 runState = WeakReference<CustomSurfaceViewCallBack>= WeakReference<CustomSurfaceViewCallBack> .runState =.getName()+" exit, lock="+ loop() (runState!= (runState === (callBack == = (runState ==500(runState== (runState== = .runState = .runState = .runState =(
Refresh Interface
Basic game display interface
CustomSurfaceView SurfaceView = singleThread = setSingleThread (dt! = UnsupportedOperationException ("must invoke setSingleThread before surfaceCreated ". singleThread = surfaceChanged (SurfaceHolder holder, format, width, (singleThread) {= SingleThread (= DrawThread (= ProcessThread (= (t = (dt! = (Pt! = (Dt! = (Pt! = DrawThread. setName ("DrawThread --" + SingleThread. setName ("SingleThread --" + ProcessThread. setName ("ProcessThread --" + (callBack! === (Canvas! = (Canvas! =View Code
The implementation of the display is also the besell curve to be displayed in the previous article. Of course, implementation is much simpler than the original code.
PathActivity = PathView( PathView = 0xaf22aa22= = === 0.8f*= 0.8f* surfaceChanged(SurfaceHolder holder, format, 50, 50/2
I hope you can correct me more. It is inevitable that many threads are synchronized.