Skip to content

Commit

Permalink
Merge branch 'libgdx:master' into android
Browse files Browse the repository at this point in the history
  • Loading branch information
Frosty-J authored May 18, 2022
2 parents 9af4e08 + e03b757 commit 9ba833f
Show file tree
Hide file tree
Showing 94 changed files with 6,270 additions and 70 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/fix-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Apply formatter
- name: Generate MobiVM MetalANGLE backend
run: ./gradlew :backends:gdx-backend-robovm-metalangle:generate :backends:gdx-backend-robovm-metalangle:spotlessApply
- name: Commit generation changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add backends/gdx-backend-robovm-metalangle/src
git commit -m "Generate MobiVM MetalANGLE backend" -a
continue-on-error: true
- name: Apply formater
run: ./gradlew spotlessApply
- name: Commit formatting changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Apply formatter" -a
continue-on-error: true
- name: Push formatting changes
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ libgdx-*.zip.MD5

#the LWJGL3 libs are pulled via fetch.xml
/backends/gdx-backend-lwjgl3/libs/lwjgl*.jar
/backends/gdx-backend-robovm-metalangle/res/META-INF/robovm/ios/libs

#ensure gdx-setup.jar works properly
!/extensions/gdx-setup/src/com/badlogic/gdx/setup/resources/gwt/war
Expand Down
17 changes: 14 additions & 3 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[1.10.1]
[1.11.1]
- iOS: Add new MobiVM MetalANGLE backend

[1.11.0]
- [BREAKING CHANGE] iOS: Increased min supported iOS version to 9.0. Update your Info.plist file if necessary.
- [BREAKING CHANGE] Removed Maven and Ant build systems. libGDX is now solely built with Gradle. See https://libgdx.com/dev/from-source/ for updated build instructions.
- [BREAKING CHANGE] Android Moved natives loading out of static init block, see #5795
- [BREAKING CHANGE] Linux: Shared libraries are now built on Ubuntu 18.04 (up from Ubuntu 16.04)
Expand Down Expand Up @@ -47,16 +51,23 @@
- API Fix: Move vertex array index buffer limit to backends to fix issue with numIndices parameter
- API Fix: TexturePacker: Fix wrong Y value when using padding
- API Fix: Lwjgl3Net: Add fallback to xdg-open on Linux if Desktop.BROWSE is unavailable
- API Addition: Add NWSEResize, NESWResize, AllResize, and NotAllowed SystemCursors
- API Addition: Add NWSEResize, NESWResize, AllResize, NotAllowed and None SystemCursors
- API Addition: GWTApplication#getJavaHeap and getNativeHeap are now supported
- API Addition: Box2D Shape now implements Disposable
- API Addition: Addes Tooltip#setTouchIndependent; see #6758
- API Addition: Added ChainShape#clear method
- API Addition: Added Tooltip#setTouchIndependent; see #6758
- API Addition: Emulate Timer#isEmpty on GWT
- API Addition: Bits add copy constructor public Bits (Bits bitsToCpy)
- API Addition: Added List#drawSelection().
- API Addition: GwtApplicationConfiguration#xrCompatible
- API Fix: setSystemCursor() now works on Android
- API Fix: getDisplayMode() is now more accurate on Android and GWT.
- API Addition: JsonValue#iterator(String) to more easily iterate a child that may not exist.
- API Addition: Added ExtendViewport#setScaling, eg for use with Scaling.contain.
- API Addition: Added application lifecycle methods to IOSAudio for custom audio implementations.
- API Addition: Added getBoundingRectangle() to Polyline
- API Addition: ShapeRenderer#check() has now protected visibility
- API Addition: Add ability to host GWT module on a different domain than the site, see #6851

[1.10.0]
- [BREAKING CHANGE] Android armeabi support has been removed. To migrate your projects: remove any dependency with natives-armeabi qualifier from your gradle build file, this apply to gdx-platform, gdx-bullet-platform, gdx-freetype-platform and gdx-box2d-platform.
Expand Down
33 changes: 33 additions & 0 deletions THIRDPARTY
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
ANGLE/MetalANGLE:
// Copyright 2018 The ANGLE Project Authors.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// Neither the name of TransGaming Inc., Google Inc., 3DLabs Inc.
// Ltd., nor the names of their contributors may be used to endorse
// or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

package com.badlogic.gdx.backends.android;

import android.os.Build;
import android.view.PointerIcon;
import android.view.View;

import com.badlogic.gdx.graphics.Cursor;
import com.badlogic.gdx.utils.GdxRuntimeException;

public class AndroidCursor implements Cursor {

static void setSystemCursor (View view, SystemCursor systemCursor) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
int type;
switch (systemCursor) { //@off
case Arrow: type = PointerIcon.TYPE_DEFAULT; break;
case Ibeam: type = PointerIcon.TYPE_TEXT; break;
case Crosshair: type = PointerIcon.TYPE_CROSSHAIR; break;
case Hand: type = PointerIcon.TYPE_HAND; break;
case HorizontalResize: type = PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW; break;
case VerticalResize: type = PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW; break;
case NWSEResize: type = PointerIcon.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW; break;
case NESWResize: type = PointerIcon.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW; break;
case AllResize: type = PointerIcon.TYPE_ALL_SCROLL; break;
case NotAllowed: type = PointerIcon.TYPE_NO_DROP; break; // Closest match
case None: type = PointerIcon.TYPE_NULL; break;
default: throw new GdxRuntimeException("Unknown system cursor " + systemCursor); //@on
}
view.setPointerIcon(PointerIcon.getSystemIcon(view.getContext(), type));
}
}

@Override
public void dispose () {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,8 @@ public void setCursor (Cursor cursor) {

@Override
public void setSystemCursor (SystemCursor systemCursor) {
View view = ((AndroidGraphics)app.getGraphics()).getView();
AndroidCursor.setSystemCursor(view, systemCursor);
}

private class AndroidDisplayMode extends DisplayMode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,8 @@ public void setBackBufferConfig (int r, int g, int b, int a, int depth, int sten
this.samples = samples;
}

/** Set transparent window hint
* @deprecated Results may vary on different OS and GPUs. See https://github.com/glfw/glfw/issues/1237
/** Set transparent window hint. Results may vary on different OS and GPUs. Usage with the ANGLE backend is less consistent.
* @param transparentFramebuffer */
@Deprecated
public void setTransparentFramebuffer (boolean transparentFramebuffer) {
this.transparentFramebuffer = transparentFramebuffer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ static void disposeSystemCursors () {
}

static void setSystemCursor (long windowHandle, SystemCursor systemCursor) {
if (systemCursor == SystemCursor.None) {
GLFW.glfwSetInputMode(windowHandle, GLFW.GLFW_CURSOR, GLFW.GLFW_CURSOR_HIDDEN);
return;
} else {
GLFW.glfwSetInputMode(windowHandle, GLFW.GLFW_CURSOR, GLFW.GLFW_CURSOR_NORMAL);
}
Long glfwCursor = systemCursors.get(systemCursor);
if (glfwCursor == null) {
long handle = 0;
Expand Down
136 changes: 136 additions & 0 deletions backends/gdx-backend-robovm-metalangle/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
import org.gradle.internal.os.OperatingSystem

sourceSets {
generator {
java {
srcDir 'generator'
}
resources {
srcDir 'generator'
}
}
main {
java {
srcDir 'src'
}
resources {
srcDir 'res'
}
}
}
configurations {
generatorCompile.extendsFrom testCompile
generatorRuntime.extendsFrom testRuntime
}

configurations { generator }

dependencies {
api libraries.robovm
generatorImplementation 'com.github.javaparser:javaparser-core:3.24.2'
}

task generate(type: JavaExec) {
dependsOn configurations.generator

main = 'JavaCodeGenerator'
classpath = sourceSets.generator.runtimeClasspath

inputs.dir '../gdx-backend-robovm/src/'
outputs.dir 'src/'
}

task fetchMetalANGLE(type: Download) {
doFirst {
file("build/tmp").mkdirs();
}
src 'https://github.com/kakashidinho/metalangle/releases/download/gles3-0.0.7/MetalANGLE.framework.ios.zip'
dest 'build/tmp/MetalANGLE.framework.ios.zip'
onlyIfModified true
useETag "all"
}

task fetchMetalANGLESimulator(type: Download) {
doFirst {
file("build/tmp").mkdirs();
}
src 'https://github.com/kakashidinho/metalangle/releases/download/gles3-0.0.7/MetalANGLE.framework.ios.simulator.zip'
dest 'build/tmp/MetalANGLE.framework.ios.simulator.zip'
onlyIfModified true
useETag "all"
}

task verifyMetalANGLE(dependsOn: fetchMetalANGLE, type: Verify) {
src 'build/tmp/MetalANGLE.framework.ios.zip'
algorithm 'SHA-256'
checksum '66fcf9eed2ede9e5725bf64e5b3169e0f39d1a515fe425447354c41968fc7999'
}

task verifyMetalANGLESimulator(dependsOn: fetchMetalANGLESimulator, type: Verify) {
src 'build/tmp/MetalANGLE.framework.ios.simulator.zip'
algorithm 'SHA-256'
checksum 'e9aa526d2f19c57e1efbae4ec04d76701da4cf596bf8c6fb6ef6c507dbc2fdc4'
}

task extractMetalANGLE(dependsOn: verifyMetalANGLE, type: Copy) {
doFirst {
file("build/tmp/real").mkdirs();
}
from zipTree('build/tmp/MetalANGLE.framework.ios.zip')
into 'build/tmp/real'
}

task extractMetalANGLESimulator(dependsOn: verifyMetalANGLESimulator, type: Copy) {
doFirst {
file("build/tmp/sim").mkdirs();
}
from zipTree('build/tmp/MetalANGLE.framework.ios.simulator.zip')
into 'build/tmp/sim'
}

task buildMetalANGLE(dependsOn: [
extractMetalANGLE,
extractMetalANGLESimulator
], type: Exec) {
doFirst {
file("res/META-INF/robovm/ios/libs").mkdirs();
}
commandLine 'xcodebuild', '-create-xcframework', '-framework', 'build/tmp/real/MetalANGLE.framework', '-framework', 'build/tmp/sim/MetalANGLE.framework', '-output', 'res/META-INF/robovm/ios/libs/MetalANGLE.xcframework'
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}

inputs.dir 'build/tmp/real/MetalANGLE.framework'
inputs.dir 'build/tmp/sim/MetalANGLE.framework'
outputs.dir 'res/META-INF/robovm/ios/libs/MetalANGLE.xcframework'
}

task jnigenBuildIOS(dependsOn: buildMetalANGLE) {
}

task jnigenBuild() {
}

//Dummy task to make compatible with publish
task jnigen() {
}

if(OperatingSystem.current() == OperatingSystem.MAC_OS) {
jnigenBuild.dependsOn jnigenBuildIOS
}
Loading

0 comments on commit 9ba833f

Please sign in to comment.