java SE 2d 游戏使用哪些类以获得最佳性能
我正在将 J2ME 2D 游戏引擎移植到 J2SE,我想知道应该使用哪些类来获得最佳性能。我目前正在使用 SingleFameApplication 创建一个窗口、一个用于主游戏循环的 FrameView 和一个用于渲染表面的 JPanel。但这可能不会。
问题是当我启动引擎时打开一个窗口,但当我开始执行(渲染+物理+碰撞检测)时它会挂起。有人可以解释一下要使用哪些类吗?我应该将游戏循环放在一个新线程中(还是frameview有它自己的线程)?我应该使用 JFrame 而不是 SingleFrameApplication 吗?
i'm porting my J2ME 2D game engine to J2SE and i was wondering which classes should i use to archive the best performance. I'm currently using SingleFameApplication for creating a window, a FrameView for the main game loop and a JPanel for a surface to render on. But this probably wont do..
The problem is when i start the engine in opens a window but when i start executing (rendering + physics + collision detection) it hangs. Can someone explain which classes to use? Should i put the game loop in a new thread (or does frameview have its own thread)? Should i use JFrame instead of SingleFrameApplication?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为选择合适的框架与此没有太大关系。
您能否提供有关崩溃/挂起的更多信息?在那之前我想我们会在黑暗中拍摄。
是的,将循环放在线程中(包含所有关键处理)并且仅在需要时进行绘制总是一个好主意。 (很像进度条的类比)
问候
I dont think choosing the right Frame has much to do with this.
Could you provide more info of the crash / hang? Until then I guess we would be shooting in the dark.
Yes, always a good idea to have the loop in a Thread (with all the critical processing) and only paint when needed. (much like the progress bar analogy)
regards