Skip to content

Commit

Permalink
android-studio 2.2.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
elementc committed Dec 13, 2016
1 parent dd907e5 commit 0763a3a
Show file tree
Hide file tree
Showing 7 changed files with 574 additions and 72 deletions.
2 changes: 1 addition & 1 deletion engine/compilers/android-studio/android-studio.iml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="android-studio" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" version="4">
<module external.linked.project.id="android-studio" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
Expand Down
218 changes: 197 additions & 21 deletions engine/compilers/android-studio/app/app.iml

Large diffs are not rendered by default.

37 changes: 7 additions & 30 deletions engine/compilers/android-studio/app/build.gradle
@@ -1,10 +1,9 @@
apply plugin: 'com.android.application'

/*import org.apache.tools.ant.taskdefs.condition.Os*/

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion 25
buildToolsVersion "25.0.1"

externalNativeBuild{
ndkBuild{
Expand All @@ -14,34 +13,18 @@ android {
defaultConfig {
applicationId "com.garagegames.torque2d"
minSdkVersion 16
targetSdkVersion 23
targetSdkVersion 25

sourceSets.main {
assets.srcDirs=[
'src/main/assets',
'src/main/game'
]
// jni.srcDirs = ['../../../source/']
// jniLibs.srcDir 'src/main/libs'

ndk {
abiFilters 'x86', 'x86_64', 'armeabi-v7a'
}
}
/* task buildNative(type: Exec, description: 'Compile JNI source via NDK') {
def ndkDir = plugins.getPlugin('com.android.application').sdkHandler.getNdkFolder()
def extension = (Os.isFamily(Os.FAMILY_WINDOWS))? '.cmd' : ''
commandLine "$ndkDir/ndk-build" + extension,
'-C', file('src/main/jni').absolutePath,
'-j', Runtime.runtime.availableProcessors(),
'all',
'NDK_DEBUG=1'
}*/

/* task cleanNative(type: Exec, description: 'Clean JNI object files') {
def ndkDir = plugins.getPlugin('com.android.application').sdkHandler.getNdkFolder()
def extension = (Os.isFamily(Os.FAMILY_WINDOWS))? '.cmd' : ''
commandLine "$ndkDir/ndk-build" + extension,
'-C', file('src/main/jni').absolutePath,
'clean'
}*/

task copyGame(type: Copy, description: 'Copy torque scripts and modules'){
from('../../../../'){
Expand All @@ -67,18 +50,12 @@ android {
delete 'src/main/game/'
}

/*clean.dependsOn 'cleanNative'*/
clean.dependsOn 'wipeGame'

tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn copyGame
}
/*tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn buildNative
}*/
/*tasks.withType(com.android.build.gradle.tasks.NdkCompile){task->
task.enabled = false
}*/


}

Expand Down
2 changes: 1 addition & 1 deletion engine/compilers/android-studio/build.gradle
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha7'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}

Expand Down
26 changes: 13 additions & 13 deletions engine/source/gui/editor/guiGraphCtrl.cc
Expand Up @@ -120,10 +120,10 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
temp2 = (S32)(((F32)getExtent().x / (F32)mPlots[k].mGraphData.size()) * (F32)sample);

GLfloat verts[] = {
getPosition().x + temp1, (getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale),
getPosition().x + temp2, (getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale),
getPosition().x + temp2, getPosition().y + getExtent().y,//may need to switch these last two
getPosition().x + temp1, getPosition().y + getExtent().y,
static_cast<GLfloat>(getPosition().x + temp1), static_cast<GLfloat>((getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale)),
static_cast<GLfloat>(getPosition().x + temp2), static_cast<GLfloat>((getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale)),
static_cast<GLfloat>(getPosition().x + temp2), static_cast<GLfloat>(getPosition().y + getExtent().y),//may need to switch these last two
static_cast<GLfloat>(getPosition().x + temp1), static_cast<GLfloat>(getPosition().y + getExtent().y),
};
glVertexPointer(2, GL_FLOAT, 0, verts);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
Expand All @@ -149,10 +149,10 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
temp2 = (S32)(((F32)getExtent().x / (F32)mPlots[k].mGraphData.size()) * (F32)sample);

GLfloat verts[] = {
getPosition().x + temp1, (getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale),
getPosition().x + temp2, (getPosition().y + getExtent().y) - (S32)(getDatum(k, sample+1) * Scale),
getPosition().x + temp2, getPosition().y + getExtent().y,//may need to switch these last two
getPosition().x + temp1, getPosition().y + getExtent().y,
static_cast<GLfloat>(getPosition().x + temp1), static_cast<GLfloat>((getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale)),
static_cast<GLfloat>(getPosition().x + temp2), static_cast<GLfloat>((getPosition().y + getExtent().y) - (S32)(getDatum(k, sample+1) * Scale)),
static_cast<GLfloat>(getPosition().x + temp2), static_cast<GLfloat>(getPosition().y + getExtent().y),//may need to switch these last two
static_cast<GLfloat>(getPosition().x + temp1), static_cast<GLfloat>(getPosition().y + getExtent().y),
};
glVertexPointer(2, GL_FLOAT, 0, verts);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
Expand All @@ -170,10 +170,10 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
temp2 = (S32)(((F32)getExtent().x / (F32)mPlots[k].mGraphData.size()) * (F32)sample);

GLfloat last[] = {
getPosition().x + temp1, (getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale),
getPosition().x + temp2, (getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale),
getPosition().x + temp2, getPosition().y + getExtent().y,
getPosition().x + temp1, getPosition().y + getExtent().y,
static_cast<GLfloat>(getPosition().x + temp1), static_cast<GLfloat>((getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale)),
static_cast<GLfloat>(getPosition().x + temp2), static_cast<GLfloat>((getPosition().y + getExtent().y) - (S32)(getDatum(k, sample) * Scale)),
static_cast<GLfloat>(getPosition().x + temp2), static_cast<GLfloat>(getPosition().y + getExtent().y),
static_cast<GLfloat>(getPosition().x + temp1), static_cast<GLfloat>(getPosition().y + getExtent().y),
};
glVertexPointer(2, GL_FLOAT, 0, last);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
Expand All @@ -194,7 +194,7 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
temp = (S32)(((F32)getExtent().x / (F32)mPlots[k].mGraphData.size()) * (F32)0);

GLfloat verts[] = {
getPosition().x + temp, getPosition().y + getExtent().y - (S32)(getDatum(k, 0) * Scale),
static_cast<GLfloat>(getPosition().x + temp), static_cast<GLfloat>(getPosition().y + getExtent().y - (S32)(getDatum(k, 0) * Scale)),
0, 0
};

Expand Down
12 changes: 6 additions & 6 deletions engine/source/gui/guiColorPicker.cc
Expand Up @@ -103,8 +103,8 @@ void GuiColorPickerCtrl::initPersistFields()
#if defined(TORQUE_OS_IOS) || defined(TORQUE_OS_ANDROID) || defined(TORQUE_OS_EMSCRIPTEN)
void dglDrawBlendBox(RectI &bounds, ColorF &c1, ColorF &c2, ColorF &c3, ColorF &c4)
{
S32 left = bounds.point.x, right = bounds.point.x + bounds.extent.x - 1;
S32 top = bounds.point.y, bottom = bounds.point.y + bounds.extent.y - 1;
GLfloat left = bounds.point.x, right = bounds.point.x + bounds.extent.x - 1;
GLfloat top = bounds.point.y, bottom = bounds.point.y + bounds.extent.y - 1;

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Expand All @@ -117,10 +117,10 @@ void dglDrawBlendBox(RectI &bounds, ColorF &c1, ColorF &c2, ColorF &c3, ColorF &
right, bottom,
};
const GLubyte squareColors[] = {
255 * c1.red, 255 * c1.green, 255 * c1.blue, 255 * c1.alpha,
255 * c2.red, 255 * c2.green, 255 * c2.blue, 255 * c2.alpha,
255 * c3.red, 255 * c3.green, 255 * c3.blue, 255 * c3.alpha,
255 * c4.red, 255 * c4.green, 255 * c4.blue, 255 * c4.alpha,
static_cast<GLubyte>(255 * c1.red), static_cast<GLubyte>(255 * c1.green), static_cast<GLubyte>(255 * c1.blue), static_cast<GLubyte>(255 * c1.alpha),
static_cast<GLubyte>(255 * c2.red), static_cast<GLubyte>(255 * c2.green), static_cast<GLubyte>(255 * c2.blue), static_cast<GLubyte>(255 * c2.alpha),
static_cast<GLubyte>(255 * c3.red), static_cast<GLubyte>(255 * c3.green), static_cast<GLubyte>(255 * c3.blue), static_cast<GLubyte>(255 * c3.alpha),
static_cast<GLubyte>(255 * c4.red), static_cast<GLubyte>(255 * c4.green), static_cast<GLubyte>(255 * c4.blue), static_cast<GLubyte>(255 * c4.alpha),
};
glVertexPointer(2, GL_FLOAT, 0, verts);
glEnableClientState(GL_VERTEX_ARRAY);
Expand Down

0 comments on commit 0763a3a

Please sign in to comment.