From e1a97b438e6088dc27c28037b32e9fe1d6de6a52 Mon Sep 17 00:00:00 2001 From: lloyd <754415+llince@user.noreply.gitee.com> Date: Sun, 15 Sep 2024 16:45:01 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90OpenGL=E4=B8=89=E6=A3=B1=E6=A4=8E?= =?UTF-8?q?=E3=80=91=E9=80=82=E9=85=8D=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/build-profile.json5 | 4 +- entry/src/main/ets/pages/Index.ets | 40 +++++++++++++------ .../main/resources/base/element/string.json | 10 +++-- .../main/resources/en_US/element/string.json | 6 +-- 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 index 9cba5d3..e9507fe 100644 --- a/entry/build-profile.json5 +++ b/entry/build-profile.json5 @@ -20,14 +20,12 @@ "path": "./src/main/cpp/CMakeLists.txt", "arguments": "", "cppFlags": "", + "abiFilters": ["arm64-v8a", "x86_64"] } }, "targets": [ { "name": "default" - }, - { - "name": "ohosTest", } ] } \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 8ae60d6..6e92c82 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -47,8 +47,8 @@ struct Index { .textAlign(TextAlign.Start) .margin({ top: $r('app.float.wh_value_13'), bottom: $r('app.float.wh_value_15') }) - Text('X ' + this.shaftRotation + ':' + this.angleArray[0].toString() - + '°\nY ' + this.shaftRotation + ':' + this.angleArray[1].toString() + '°') + Text('X ' + this.shaftRotation + ':' + this.angleArray[0].toString() + + '°\nY ' + this.shaftRotation + ':' + this.angleArray[1].toString() + '°') .fontSize($r('app.float.head_font_24')) .lineHeight($r('app.float.wh_value_33')) .fontFamily('HarmonyHeiTi-Bold') @@ -59,7 +59,11 @@ struct Index { .margin({ top: $r('app.float.wh_value_13'), bottom: $r('app.float.wh_value_15') }) Column() { - XComponent({ id: this.xComponentId, type: 'surface', libraryname: 'tetrahedron_napi' }) + XComponent({ + id: this.xComponentId, + type: XComponentType.SURFACE, + libraryname: 'tetrahedron_napi' + }) .onLoad(() => { Logger.info('onLoad'); }) @@ -79,31 +83,40 @@ struct Index { .backgroundColor(Color.White) .borderRadius(24) - Row() { - Button(this.enableRotate ? $r('app.string.btn_stop_rotation') : $r('app.string.btn_auto_rotation'), { type: ButtonType.Capsule, stateEffect: true }) + Row({ space: 12 }) { + Button(this.enableRotate ? $r('app.string.btn_stop_rotation') : $r('app.string.btn_auto_rotation'), + { type: ButtonType.Capsule, stateEffect: true }) .fontSize($r('app.float.head_font_24')) - .margin({ top: $r('app.float.wh_value_13'), bottom: $r('app.float.wh_value_15'), - left: $r('app.float.wh_value_13'), right: $r('app.float.wh_value_13') }) + .margin({ + top: $r('app.float.wh_value_13'), + bottom: $r('app.float.wh_value_15'), + left: $r('app.float.wh_value_13'), + right: $r('app.float.wh_value_13') + }) .onClick(() => { if (this.enableRotate) { tetrahedron_napi.setRotate(RotationType.STOP); this.enableRotate = false; - } - else { + } else { tetrahedron_napi.setRotate(RotationType.AUTO); this.enableRotate = true; } - }) + .layoutWeight(1) Button($r('app.string.btn_damping_rotation'), { type: ButtonType.Capsule, stateEffect: true }) .fontSize($r('app.float.head_font_24')) - .margin({ top: $r('app.float.wh_value_13'), bottom: $r('app.float.wh_value_15'), - left: $r('app.float.wh_value_13'), right: $r('app.float.wh_value_13') }) + .margin({ + top: $r('app.float.wh_value_13'), + bottom: $r('app.float.wh_value_15'), + left: $r('app.float.wh_value_13'), + right: $r('app.float.wh_value_13') + }) .onClick(() => { this.enableRotate = false; tetrahedron_napi.setRotate(RotationType.DAMPING); }) + .layoutWeight(1) } } .gesture( @@ -122,7 +135,8 @@ struct Index { }) ) .padding(12) - .backgroundColor('#f1f3f5') + .backgroundColor($r('sys.color.comp_background_focus')) .height('100%') + .justifyContent(FlexAlign.SpaceBetween) } } diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 183408f..3b41e68 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -12,17 +12,21 @@ "name": "EntryAbility_label", "value": "Tetrahedron" }, + { + "name": "shaftRotation", + "value": "Shaft Rotation" + }, { "name": "btn_auto_rotation", - "value": "Auto Rotation" + "value": "Start" }, { "name": "btn_stop_rotation", - "value": "Stop Rotation" + "value": "Stop" }, { "name": "btn_damping_rotation", - "value": "Damping Rotation" + "value": "Damping" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index b942bbb..48b10e5 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -18,15 +18,15 @@ }, { "name": "btn_auto_rotation", - "value": "Auto Rotation" + "value": "Start" }, { "name": "btn_stop_rotation", - "value": "Stop Rotation" + "value": "Stop" }, { "name": "btn_damping_rotation", - "value": "Damping Rotation" + "value": "Damping" } ] } \ No newline at end of file -- Gitee