George J
George J

Reputation: 355

How do Linux users test Cocos2d-x applications for Android?

I tried to test cocos2d-x apps on AVD but they didn't work on them. But it is necessary to check how it looks on different screens (I have only one physical device). On Windows there are Cocos Studio where you can change screen, but thre are not such thing for Linux. How do you check it ?

Upvotes: 0

Views: 77

Answers (2)

0xDEADBEEF
0xDEADBEEF

Reputation: 81

Have you tried Genymotion Android Emulator?

It offers a lot of predefined Android devices and is much faster than the default Android emulator. Among other things, its speed comes from running x86 instead of ARM instructions, so you'll need to add x86 to the list of ABIs that your app targets. That could be as simple as adding x86 to the end of this line in your Application.mk file:

APP_ABI := armeabi x86

Upvotes: 1

GaloisPlusPlus
GaloisPlusPlus

Reputation: 403

I don't know whether there is a linux-version GLViewImpl or not. If it exists, you can check whether there is an API like createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor) in this class.

  • If createWithRect does exist, things get easier.

You can:

  1. Write the screen resolution into some configuration file.
  2. Read from the configuration file to get the width and height of the screen.

Then create an OpenGLView:

auto glview = cocos2d::GLViewImpl::createWithRect(yourTitle.c_str(), Rect(0, 0, width, height));

Finally set it to the director:

Director::getInstance()->setOpenGLView(glview);

In this way, when you want to test your app on different screens, you can just modify the configuration file without recompiling your source code.

  • If createWithRect doesn't exist, you may have to use OpenGL API like glfwSetWindowSize to change the setting of the current OpenGLView by yourself.

Upvotes: 1

Related Questions