Skip to content

Commit f7db31b

Browse files
authoredAug 21, 2022
Merge pull request #152 from chrisws/12_25
12 25
2 parents 7634e03 + b4405dc commit f7db31b

File tree

17 files changed

+1458
-270
lines changed

17 files changed

+1458
-270
lines changed
 

‎configure.ac

+13-2
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,14 @@ function buildSDL() {
234234
}
235235

236236
function buildAndroid() {
237-
TARGET="Building for Android."
238-
239237
defaultConditionals
240238

239+
AC_MSG_CHECKING([if library mode is enabled])
240+
AC_ARG_WITH(library,
241+
[ --with-library Build the android as a library default=no],
242+
[with_library=$with_library],
243+
[with_library=no])
244+
AC_MSG_RESULT([$with_library])
241245
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
242246
AC_DEFINE(_ANDROID, 1, [Defined for Android build.])
243247
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
@@ -248,6 +252,13 @@ function buildAndroid() {
248252

249253
TEST_DIR="src/platform/android"
250254
AC_SUBST(TEST_DIR)
255+
if test $with_library = no; then
256+
(cd src/platform/android/webui && npm run build)
257+
TARGET="Building for Android."
258+
else
259+
TARGET="Building for Android library."
260+
AC_DEFINE(_ANDROID_LIBRARY, 1, [android library build enabled])
261+
fi
251262
}
252263

253264
function buildConsole() {

‎src/common/screen.c

+18
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,18 @@ void osd_line(int x1, int y1, int x2, int y2);
304304
//
305305
void dev_rect(int x1, int y1, int x2, int y2, int fill) {
306306
int c1, c2, in1, in2;
307+
308+
if (x2 < x1) {
309+
int x11 = x1;
310+
x1 = x2;
311+
x2 = x11;
312+
}
313+
if (y2 < y1) {
314+
int y11 = y1;
315+
y1 = y2;
316+
y2 = y11;
317+
}
318+
307319
int px1 = x1;
308320
int py1 = y1;
309321
int px2 = x2;
@@ -409,6 +421,9 @@ void dev_window(int x1, int y1, int x2, int y2) {
409421
}
410422
}
411423

424+
//
425+
// set screen width and height
426+
//
412427
void dev_resize(int width, int height) {
413428
if (dev_Vx2 == dev_Vdx && dev_Vx2 == os_graf_mx - 1) {
414429
// viewport width is full-screen
@@ -432,6 +447,9 @@ void dev_resize(int width, int height) {
432447
setsysvar_int(SYSVAR_YMAX, height - 1);
433448
}
434449

450+
//
451+
// remap x/y to world coordinates
452+
//
435453
void dev_map_point(int *x, int *y) {
436454
*x = W2X(*x);
437455
*y = W2Y(*y);

‎src/platform/android/Makefile.am

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,10 @@ ndk-build-release:
3131
(cd jni && ${NDK}/ndk-build NDK_DEBUG=0)
3232

3333
release:
34-
(./gradle assemble)
34+
(./gradlew clean assemble)
3535

36+
library:
37+
(./gradlew clean assemble)
38+
(mkdir -p dist)
39+
(cp -R app/build/intermediates/stripped_native_libs/release/out/lib/ dist)
40+
(cp app/build/intermediates/dex/release/minifyReleaseWithR8/classes.dex dist)

‎src/platform/android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
targetSdkVersion 30
1212
versionCode 50
1313
versionName "12.23"
14-
resConfigs "en"
14+
resConfigs 'en'
1515
}
1616

1717
signingConfigs {

‎src/platform/android/app/src/main/assets/main.bas

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ sub do_about()
114114
color colText
115115
print "Version "; sbver
116116
print
117-
print "Copyright (c) 2002-2021 Chris Warren-Smith"
117+
print "Copyright (c) 2002-2022 Chris Warren-Smith"
118118
print "Copyright (c) 1999-2006 Nicholas Christopoulos" + chr(10)
119119

120120
local bn_home

0 commit comments

Comments
 (0)