Skip to content

Commit

Permalink
Merge branch 'main' into githubactions
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Sep 7, 2024
2 parents d6edf00 + f9c2b1b commit dd1cdc2
Show file tree
Hide file tree
Showing 245 changed files with 277,678 additions and 2,259 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python package prepare_assets

on: [push]

jobs:
build:

runs-on: windows-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v4
- name: Setup Python # Set Python version
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip pipenv
pipenv install -d
pipenv install pywin32-ctypes pefile
- name: Build
run: pipenv run pyinstaller --onefile .\prepare_assets.py
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: prepare_assets.exe
path: dist\prepare_assets.exe
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -411,3 +411,4 @@ MigrationBackup/

# End of https://www.toptal.com/developers/gitignore/api/vs
lua-docs/site/*
data-src/scripts/ALPACA.lua
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ web:

android:
stage: build
image: registry.gitlab.com/jhasse/android-ndk-docker:r25
image: registry.gitlab.com/jhasse/android-ndk-docker:r26b
script:
- cd android
- chmod +x gradlew
Expand Down Expand Up @@ -202,7 +202,7 @@ docs:
script:
- microdnf install -y python3-devel
- pip install pipenv
- pipenv install -d --python 3.11
- pipenv install -d --python 3.12
- cd lua-docs
- pipenv run mkdocs build
artifacts:
Expand Down
15 changes: 7 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ if (NOT CMAKE_BUILD_TYPE MATCHES "Release" AND NOT ANDROID AND NOT ${CMAKE_SYSTE
endif()

if(ANDROID)
add_library(native_app_glue STATIC
${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)

add_library(pac SHARED ${SOURCES})
# Export ANativeActivity_onCreate(),
# Refer to: https://github.com/android-ndk/ndk/issues/381.
set_property(TARGET pac APPEND_STRING PROPERTY LINK_FLAGS " -u ANativeActivity_onCreate")
target_link_libraries(pac PRIVATE
android
native_app_glue
Expand All @@ -76,13 +82,6 @@ target_link_libraries(pac PRIVATE
jngl spine-c schnacker
)

if(MSVC)
add_custom_command(TARGET pac COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_SOURCE_DIR}/subprojects/jngl/lib/msvc/x86_64/epoxy-0.dll
"$<TARGET_FILE_DIR:pac>")
endif()


# Add Tests
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND NOT IOS AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
add_subdirectory(test)
Expand Down Expand Up @@ -130,7 +129,7 @@ if (NOT CMAKE_BUILD_TYPE MATCHES "Release" AND NOT ANDROID AND NOT ${CMAKE_SYSTE
endif()

if(WIN32)
target_compile_definitions(pac PRIVATE _USE_MATH_DEFINES)
target_compile_definitions(pac PRIVATE _USE_MATH_DEFINES UNICODE)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Release")
Expand Down
4 changes: 4 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ name = "pypi"
[packages]
watchdog = "*"
termcolor = "*"
requests = "*"
google-cloud-texttospeech = "*"

[dev-packages]
mypy = "*"
flake8 = "*"
autopep8 = "*"
types-termcolor = "*"
types-requests = "*"
mkdocs = "*"
mkdocstrings = "*"
mkdocstrings-python = "*"
mkdocstrings-pac = "*"
mkdocs-video = "*"
pyinstaller = "*"

[requires]
Expand Down
1,095 changes: 807 additions & 288 deletions Pipfile.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ It's written in C++ and can easily be scripted in Lua.

[📚 Documentation](https://alpaca-engine.de/)
[🎮 Example Game](https://hobbyspieleentwicklerpodcast.de/2080-Demo/)
[🪟 Windows Build](https://brain-connected.itch.io/alpaca)

[![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/zWdnq6UJ79)

Expand Down Expand Up @@ -86,7 +87,7 @@ Visual Studio will automatically run CMake and you can choose pac.exe as target

If you need help setting up your first project or want to talk about your game.
Book a time slot with the developers of ALPACA at [calendly](https://calendly.com/pinguin999/pac-indie-game-development) 🇩🇪🇬🇧
or mail me at [[email protected]]([email protected]) 🇩🇪🇬🇧
or mail me at [[email protected]](mailto:[email protected]) 🇩🇪🇬🇧

## Contributing

Expand Down
21 changes: 15 additions & 6 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,29 @@ apply plugin: 'com.android.application'
android {
sourceSets {
main {
assets.srcDirs = ["../../data"]
assets.srcDirs = ["../../../../data"]
}
}
signingConfigs {
release {
storePassword 'password'
keyPassword 'password'
keyAlias = 'key0'
storeFile file('../../certs/android/android.jks')
storeFile file('../../../../certs/android/android.jks')
}
}
defaultConfig {
applicationId = 'com.alpaca.game'
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared"
}
}
}
buildFeatures {
prefab true
}
buildTypes {
release {
Expand All @@ -30,16 +38,17 @@ android {
externalNativeBuild {
cmake {
version '3.18.0+'
path 'src/main/cpp/CMakeLists.txt'
path '../../CMakeLists.txt'
}
}
compileSdkVersion 31
compileSdkVersion 33
productFlavors {
}
ndkVersion "25.0.8775105"
ndkVersion '26.1.10909125'
namespace 'com.alpaca.game'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.oboe:oboe:1.7.0'
}
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!-- Tell NativeActivity the name of our .so -->
<meta-data
android:name="android.app.lib_name"
android:value="bootstrap" />
android:value="pac" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
44 changes: 0 additions & 44 deletions android/app/src/main/cpp/CMakeLists.txt

This file was deleted.

51 changes: 0 additions & 51 deletions android/app/src/main/cpp/bootstrap.cpp

This file was deleted.

31 changes: 30 additions & 1 deletion android/app/src/main/java/com/alpaca/game/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.alpaca.game;

import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.NativeActivity;
import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;

Expand All @@ -22,11 +25,31 @@

public class MainActivity extends NativeActivity {
private HideHandler hideHandler;
private boolean nativeCodeReady = false;

@TargetApi(Build.VERSION_CODES.P)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// https://developer.android.com/develop/ui/views/launch/splash-screen#java
final View content = findViewById(android.R.id.content);
content.getViewTreeObserver().addOnPreDrawListener(
new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
if (nativeCodeReady) {
content.getViewTreeObserver().removeOnPreDrawListener(this);
return true;
}
return false;
}
});

if (Build.VERSION.SDK_INT > 27) { // added in Android 9 (API level 28)
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
}

// create a handler to set immersive mode on a delay
hideHandler = new HideHandler(this);

Expand Down Expand Up @@ -111,9 +134,10 @@ public int showAlert(final String message, boolean model) {
final Semaphore semaphore = model ? new Semaphore(0, true) : null;
// The button that was clicked (ex. BUTTON_POSITIVE) or the position of the item clicked
final AtomicInteger buttonId = new AtomicInteger();
markNativeCodeReady();
this.runOnUiThread(new Runnable() {
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, android.R.style.Theme_Material_Light_Dialog_Alert);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, AlertDialog.THEME_HOLO_DARK);
builder.setTitle(appName);
builder.setMessage(message);
DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
Expand Down Expand Up @@ -157,4 +181,9 @@ protected void showDialog() {

dialog.show();
}

protected void markNativeCodeReady() {
assert(!nativeCodeReady);
nativeCodeReady = true;
}
}
2 changes: 1 addition & 1 deletion 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:7.3.1'
classpath 'com.android.tools.build:gradle:8.2.2'
}
}

Expand Down
6 changes: 5 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Sat Jan 04 17:40:52 CET 2020
org.gradle.jvmargs=-Xmx2048M
android.nonFinalResIds=true
android.nonTransitiveRClass=false
org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g
android.enableJetifier=false
org.gradle.configuration-cache=true
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
Empty file modified android/gradlew
100644 → 100755
Empty file.
Loading

0 comments on commit dd1cdc2

Please sign in to comment.