Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into web
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Dec 29, 2022
2 parents ab81e54 + bd8f5bf commit 8ad68b7
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 29 deletions.
25 changes: 25 additions & 0 deletions src/android/AndroidMiniFB.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,28 @@ mfb_get_monitor_scale(struct mfb_window *window, float *scale_x, float *scale_y)
*scale_y = 1.0f;
}
}

//-------------------------------------
bool
mfb_set_viewport(struct mfb_window *window, unsigned offset_x, unsigned offset_y, unsigned width, unsigned height) {
if(window == 0x0) {
return false;
}

SWindowData *window_data = (SWindowData *) window;

if(offset_x + width > window_data->window_width) {
return false;
}
if(offset_y + height > window_data->window_height) {
return false;
}

window_data->dst_offset_x = offset_x;
window_data->dst_offset_y = offset_y;
window_data->dst_width = width;
window_data->dst_height = height;
calc_dst_factor(window_data, window_data->window_width, window_data->window_height);

return true;
}
6 changes: 3 additions & 3 deletions tests/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
compileSdkVersion 31
ndkVersion '22.1.7171670'

defaultConfig {
applicationId 'com.example.noise'
minSdkVersion 14
targetSdkVersion 29
targetSdkVersion 31
}

buildTypes {
Expand All @@ -19,7 +19,7 @@ android {

externalNativeBuild {
cmake {
version '3.18.1'
version '3.22.1'
path 'src/main/cpp/CMakeLists.txt'
}
}
Expand Down
44 changes: 24 additions & 20 deletions tests/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.minifb.noise"
android:versionCode="1"
android:versionName="1.0">
<application
android:allowBackup="false"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:hasCode="false">
<activity android:name="android.app.NativeActivity"
android:label="@string/app_name">
<meta-data android:name="android.app.lib_name"
android:value="noise" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.minifb.noise"
android:versionCode="1"
android:versionName="1.0">
<application
android:allowBackup="false"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:hasCode="false">
<activity
android:name="android.app.NativeActivity"
android:label="@string/app_name"
android:exported="true">
<meta-data
android:name="android.app.lib_name"
android:value="noise" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
2 changes: 1 addition & 1 deletion tests/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.0.4'
}
}

Expand Down
11 changes: 6 additions & 5 deletions tests/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#Sun Dec 18 16:12:25 CET 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 8ad68b7

Please sign in to comment.