如何为Windows和Android创建SDL2 Visual Studio 2015或2017解决方案? [英] How do you create SDL2 Visual Studio 2015 or 2017 Solution For Windows and Android?

查看:205
本文介绍了如何为Windows和Android创建SDL2 Visual Studio 2015或2017解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2015集成了Android模拟器支持.他们甚至有一个预制的模板来设置Windows Phone,Android和iOS目标.似乎应该有某种方法可以在同一解决方案中设置SDL 2.0,以便在Android和Windows目标之间轻松切换.

Visual Studio 2015 has integrated Android Emulator support. They even have a pre-made template to set up Windows Phone, Android, and iOS targets. It seems like there should be some way of setting up SDL 2.0 in the same solution to easily toggle between Android and Windows targets.

这个问题的有效答案将只是一组步骤,以设置示例SDL2程序的目标,该程序编译并创建一个简单的OpenGL/ES上下文旋转多维数据集或类似的对象,这将创建一个窗口并作为Windows .exe或根据目标在android仿真器中执行.

A valid answer to this question will simply be a set of steps to set up the targets for an example SDL2 program that compiles and creates a simple OpenGL/ES context rotating cube or similar which will either create a window and run as a windows .exe or execute in the android emulator depending on the target.

请在带编号的项目符号列表中包括答案正文中的所有步骤,以便它是完整的独立答案.

Please include all steps in the body of your answer in a numbered bullet list so that it is a complete stand-alone answer.

推荐答案

适用于android特定设置. (设置makefile,AndroidManifest.xml等)请参考Internet上的SDL2/docs/readme.android和常规的命令行android帮助".

For android specific settings. (Setting up makefiles, the AndroidManifest.xml, etc.) refer to SDL2/docs/readme.android and general "command line android help" on the internet.

设置VS2015解决方案通常如下:

Setting up the VS2015 solution generally goes as follows:

  • 创建新文件夹project
  • 将游戏源放入project/src
  • project/
  • 中创建共享项目项目
  • project/android
  • 中创建一个android makefile项目
  • project/android
  • 中创建一个android basic application(ANT)项目
  • SDL2/android-proj的内容复制到project/android
  • 在解决方案资源管理器中,选中显示所有文件"和包括在项目中"从SDL2/android-proj到jn之外的所有文件,再到基本应用程序项目.
  • 在基本应用程序项目的引用中添加makefile项目.
  • 在makefile项目的引用中添加共享项项目.
  • 编辑project/android/jni/src/Android.mk以在projects/src
  • 中编译文件
  • 构建makefile项目之后,将其生成的.so文件从project/android/libs/添加到基本应用程序项目中.
  • 像往常一样创建其他项目,除了不包括源代码,而在引用中包括共享项项目.
  • Create new folder project
  • Put game source in project/src
  • Create shared items project in project/
  • Create an android makefile project into project/android
  • Create an android basic application(ANT) project into project/android
  • Copy the contents of SDL2/android-proj to project/android
  • In the solution explorer check "show all files" and "include in project" all files from SDL2/android-proj except jni to the basic application project.
  • In the references of the basic app project add the makefile project.
  • In the references of the makefile project add the shared items project.
  • Edit project/android/jni/src/Android.mk to compile your files in projects/src
  • After building the makefile project, add its resulting .so files from project/android/libs/ to the basic app project.
  • Create other project like usual except instead of including source, just include shared items project in references.

在这里您可以找到共享项目项目:

Here is where you can find the shared items project:

这篇关于如何为Windows和Android创建SDL2 Visual Studio 2015或2017解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆