简体   繁体   English

在创建2D OpenGL-ES 2.0游戏的基本裸露方法中寻求帮助

[英]Seeking help in a basic, bare bones method of creating a 2D OpenGL-ES 2.0 Game

I have made many Android applications that use Java code and the XML layouts, however I am very new to OpenGL ES. 我制作了许多使用Java代码和XML布局的Android应用程序,但是我对OpenGL ES还是很陌生。 I have programmed games in Swing Java, including pong, and an intermediate level 2d platformer (with a map editor, too!). 我已经用Swing Java对游戏进行了编程,包括pong和一个中级2d平台游戏(也带有地图编辑器!)。 I have extensive knowledge in Java, however, OpenGL is a new doorway I wish to open. 我对Java有广泛的了解,但是OpenGL是我希望打开的新门户。

Using guides online, I have made simple things in OpenGL ES, including a cube that I manually mapped the co-ordinates for (which was a very fun experience), and drawing a triangle on the screen. 使用在线指南,我在OpenGL ES中做了简单的事情,包括一个立方体,我手动为其绘制了坐标(非常有趣的体验),并在屏幕上绘制了一个三角形。

My question is, how can I make a 2d game with OpenGL ES? 我的问题是,如何使用OpenGL ES制作2D游戏? Now, what I've tried doesn't quite work well, as the images I draw arent to scale, and no matter what guide I use, the image is always choppy and not the right size on my Nexus S that I am debugging to. 现在,我尝试过的效果并不理想,因为我绘制的图像无法缩放,无论我使用什么指南,该图像在我调试到的Nexus S上总是不固定且尺寸不合适。

What I need to learn to do is, be able to draw images and objects to the screen with OpenGL ES, and learn how to perform a game loop. 我需要学习的是,能够使用OpenGL ES在屏幕上绘制图像和对象,并学习如何执行游戏循环。 I havent looked into a game loop in Android, but will soon. 我还没有研究过Android中的游戏循环,但很快就会发现。 What I want to master first is drawing crisp, HD images to the screen, which just won't work for me. 我首先要掌握的是在屏幕上绘制清晰的高清图像,这对我不起作用。

If you require me to post examples of what I have done in the past, of course I will. 如果您要求我发布过去所做的事例,我当然会。 But I am hoping you can help me with a fresh start. 但我希望您能帮助我重新开始。 Thank you. 谢谢。

TL;DR: How to draw crisp, HD, 2D images to the screen using OpenGL ES, and how to have a game loop in Android? TL; DR: 如何使用OpenGL ES在屏幕上绘制清晰的高清2D图像,以及如何在Android中进行游戏循环?

You probably heard of Cocos2d, a 2d gaming framework that works as a wrapper on OpenGL. 您可能听说过Cocos2d,这是一种2D游戏框架,可以用作OpenGL的包装器。 It was originally developed for iOS, but it was ported to Android to. 它最初是为iOS开发的,但后来移植到了Android。

The project page: https://github.com/ZhouWeikuan/cocos2d/tree/master/cocos2d-android 项目页面: https : //github.com/ZhouWeikuan/cocos2d/tree/master/cocos2d-android

Great starters guide: http://dan.clarke.name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/ 入门指南: http//dan.clarke.name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM