revisions

This commit is contained in:
pls.153 2024-10-26 12:58:15 +02:00
parent dc29ac9084
commit e8866954c0
9 changed files with 120 additions and 44 deletions

View file

@ -1,8 +1,8 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import ".ext/" as Ext // for single file auto reload (development)
//import "ext/" as Ext // release version
import ".ext/" as Ext // for single file auto reload (development)
//import "ext/" as Ext // release version
Rectangle {
id: main

View file

@ -47,12 +47,18 @@ win32 {
}
android {
QT += androidextras
DEFINES -= DESKTOP_APP
INCLUDEPATH = $$ECL/include
LIBS = -L$$ECL/lib -lecl
LIBS += -L../../../platforms/android/lib
equals(QT_MAJOR_VERSION, 6) {
QT += core-private
}
lessThan(QT_MAJOR_VERSION, 6) {
QT += androidextras
}
ANDROID_EXTRA_LIBS += $$ECL/lib/libecl.so
#ANDROID_PACKAGE_SOURCE_DIR = ../platforms/android
@ -72,9 +78,31 @@ ios {
}
32bit {
LIBS += -llqml32 -llisp32
android {
equals(QT_MAJOR_VERSION, 6) {
LIBS += -llqml32_armeabi-v7a
}
lessThan(QT_MAJOR_VERSION, 6) {
LIBS += -llqml32
}
}
!android {
LIBS += -llqml32
}
LIBS += -llisp32
} else {
LIBS += -llqml -llisp
android {
equals(QT_MAJOR_VERSION, 6) {
LIBS += -llqml_arm64-v8a
}
lessThan(QT_MAJOR_VERSION, 6) {
LIBS += -llqml
}
}
!android {
LIBS += -llqml
}
LIBS += -llisp
}
LIBS += -Ltmp -lapp

View file

@ -1,3 +1,6 @@
# install/update (keeps app data)
adb install -r android-build/*.apk
# try both
adb shell am start -n org.qtproject.example.app/org.qtproject.qt5.android.bindings.QtActivity # Qt5
adb shell am start -n org.qtproject.example.app/org.qtproject.qt.android.bindings.QtActivity # Qt6

View file

@ -54,7 +54,6 @@ win32 {
}
android {
QT += androidextras
DEFINES += NO_TEXT_HANDLES NO_USB
DEFINES -= DESKTOP_APP
INCLUDEPATH = $$ECL/include
@ -65,6 +64,13 @@ android {
LIBS += -lasdf -lecl-help -ldeflate -lecl-cdb -lecl-curl -lql-minitar -lsockets
LIBS += -L../../../platforms/android/lib
equals(QT_MAJOR_VERSION, 6) {
QT += core-private
}
lessThan(QT_MAJOR_VERSION, 6) {
QT += androidextras
}
ANDROID_MIN_SDK_VERSION = 21
ANDROID_TARGET_SDK_VERSION = 34
ANDROID_EXTRA_LIBS += $$ECL/lib/libecl.so
@ -108,9 +114,31 @@ ios {
}
32bit {
LIBS += -llqml32 -llisp32
android {
equals(QT_MAJOR_VERSION, 6) {
LIBS += -llqml32_armeabi-v7a
}
lessThan(QT_MAJOR_VERSION, 6) {
LIBS += -llqml32
}
}
!android {
LIBS += -llqml32
}
LIBS += -llisp32
} else {
LIBS += -llqml -llisp
android {
equals(QT_MAJOR_VERSION, 6) {
LIBS += -llqml_arm64-v8a
}
lessThan(QT_MAJOR_VERSION, 6) {
LIBS += -llqml
}
}
!android {
LIBS += -llqml
}
LIBS += -llisp
}
LIBS += -Ltmp -lapp

View file

@ -8,36 +8,37 @@
(defvar *max-x* (* (1- *width*) +w+))
(defun move (x-rotation y-rotation) ; called from QML
(labels ((add (x)
(truncate (signum x)))
(to-pos (x)
(truncate (/ (+ x (/ +w+ 2))
+w+)))
(normalize (x)
(* (to-pos x) +w+)))
;; x axis rotation changes y
;; y axis rotation changes x
(let* ((dx (min (* 0.2 y-rotation) (1- +w+)))
(dy (min (* 0.2 x-rotation) (1- +w+)))
(add-x (add dx))
(add-y (add dy)))
(setf *x* (min *x* *max-x*)) ; don't lose ball (initial x)
(if (aref *maze*
(+ add-x (to-pos *x*))
(to-pos *y*))
(setf *x* (normalize *x*))
(incf *x* dx))
(if (aref *maze*
(to-pos *x*)
(+ add-y (to-pos *y*)))
(setf *y* (normalize *y*))
(incf *y* dy))))
(move-ball)
(when *ready*
(labels ((add (x)
(truncate (signum x)))
(to-pos (x)
(truncate (/ (+ x (/ +w+ 2))
+w+)))
(normalize (x)
(* (to-pos x) +w+)))
;; x axis rotation changes y
;; y axis rotation changes x
(let* ((dx (min (* 0.2 y-rotation) (1- +w+)))
(dy (min (* 0.2 x-rotation) (1- +w+)))
(add-x (add dx))
(add-y (add dy)))
(setf *x* (min *x* *max-x*)) ; don't lose ball (initial x)
(if (aref *maze*
(min (1- *width*) (+ add-x (to-pos *x*)))
(max 0 (to-pos *y*)))
(setf *x* (normalize *x*))
(incf *x* dx))
(if (aref *maze*
(min (1- *width*) (to-pos *x*))
(max 0 (+ add-y (to-pos *y*))))
(setf *y* (normalize *y*))
(incf *y* dy))))
(move-ball))
(values)) ; no return value to QML
(defun move-ball ()
(if (and (= *x* +w+)
(= *y* 0))
(<= *y* 0))
(new-game)
(let ((ball (find-quick-item ui:*ball*)))
;; 'qset' is faster than 'q>', but can't trigger animations

View file

@ -8,7 +8,8 @@
(defconstant *width* 25)
(defconstant *height* 39)
(defvar *maze*)
(defvar *maze* nil)
(defvar *ready* t)
(defun carve-maze (x y)
(let ((d (random 4)))
@ -33,10 +34,11 @@
(carve-maze x2 y2))))))
(defun generate-maze ()
(set-visible 1 1 nil)
(carve-maze 1 1)
(set-visible 1 0 nil)
(set-visible (- *width* 1) (- *height* 2) nil))
(let ((*ready* nil))
(set-visible 1 1 nil)
(carve-maze 1 1)
(set-visible 1 0 nil)
(set-visible (- *width* 1) (- *height* 2) nil)))
(defun set-visible (x y visible)
(setf (aref *maze* x y) visible)