feat(phaser): use phaser

This commit is contained in:
tiennm99 authored and Tien Nguyen Minh committed 2025-02-19 19:57:49 +07:00
1 parent 7d5181d5ec
commit 4d4b76870a
32 files changed
+247958 -1068

No files matched your search

-18
View File
@@ -1,18 +0,0 @@
# https://editorconfig.org
root = true
[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{java,scala,groovy,kt,kts}]
indent_size = 4
[*.gradle]
indent_size = 2
[*.md]
trim_trailing_whitespace = false
-2
View File
@@ -1,2 +0,0 @@
* text=auto eol=lf
*.bat text=auto eol=crlf
-49
View File
@@ -1,49 +0,0 @@
name: Deploy to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
deployments: write
id-token: write
pages: write
concurrency:
group: "pages"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
name: Build LibGDX Website
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build HTML Version
run: ./gradlew html:dist
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./html/build/dist
deploy:
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
-165
View File
@@ -1,165 +0,0 @@
## Gradle:
.gradle/
gradle-app.setting
/gradle/gradle-daemon-jvm.properties
/build/
/android/build/
/core/build/
/lwjgl2/build/
/lwjgl3/build/
/html/build/
/teavm/build/
/ios/build/
/ios-moe/build/
/headless/build/
/server/build/
/shared/build/
## Java:
*.class
*.war
*.ear
hs_err_pid*
.attach_pid*
## Android:
/android/libs/armeabi-v7a/
/android/libs/arm64-v8a/
/android/libs/x86/
/android/libs/x86_64/
/android/gen/
/android/out/
local.properties
com_crashlytics_export_strings.xml
## Robovm:
/ios/robovm-build/
## iOS:
/ios/xcode/*.xcodeproj/*
!/ios/xcode/*.xcodeproj/xcshareddata
!/ios/xcode/*.xcodeproj/project.pbxproj
/ios/xcode/native/
/ios/IOSLauncher.app
/ios/IOSLauncher.app.dSYM
## GWT:
/html/war/
/html/gwt-unitCache/
.apt_generated/
/html/war/WEB-INF/deploy/
/html/war/WEB-INF/classes/
.gwt/
gwt-unitCache/
www-test/
.gwt-tmp/
## TeaVM:
# Not sure yet...
## IntelliJ, Android Studio:
.idea/
*.ipr
*.iws
*.iml
## Eclipse:
.classpath
.project
.metadata/
/android/bin/
/core/bin/
/lwjgl2/bin/
/lwjgl3/bin/
/html/bin/
/teavm/bin/
/ios/bin/
/ios-moe/bin/
/headless/bin/
/server/bin/
/shared/bin/
*.tmp
*.bak
*.swp
*~.nib
.settings/
.loadpath
.externalToolBuilders/
*.launch
## NetBeans:
/nbproject/private/
/android/nbproject/private/
/core/nbproject/private/
/lwjgl2/nbproject/private/
/lwjgl3/nbproject/private/
/html/nbproject/private/
/teavm/nbproject/private/
/ios/nbproject/private/
/ios-moe/nbproject/private/
/headless/nbproject/private/
/server/nbproject/private/
/shared/nbproject/private/
/nbbuild/
/android/nbbuild/
/core/nbbuild/
/lwjgl2/nbbuild/
/lwjgl3/nbbuild/
/html/nbbuild/
/teavm/nbbuild/
/ios/nbbuild/
/ios-moe/nbbuild/
/headless/nbbuild/
/server/nbbuild/
/shared/nbbuild/
/dist/
/android/dist/
/core/dist/
/lwjgl2/dist/
/lwjgl3/dist/
/html/dist/
/teavm/dist/
/ios/dist/
/ios-moe/dist/
/headless/dist/
/server/dist/
/shared/dist/
/nbdist/
/android/nbdist/
/core/nbdist/
/lwjgl2/nbdist/
/lwjgl3/nbdist/
/html/nbdist/
/teavm/nbdist/
/ios/nbdist/
/ios-moe/nbdist/
/headless/nbdist/
/server/nbdist/
/shared/nbdist/
nbactions.xml
nb-configuration.xml
## OS-Specific:
.DS_Store
Thumbs.db
## Miscellaneous:
*~
*.*#
*#*#
/.kotlin/
/assets/assets.txt
## Special cases:
## There is a resource-config.json file generated by nativeimage.gradle if you use Graal Native Image.
## Some usage may need extra resource configuration in a different file with the same name.
## You could also add that configuration to the text in nativeimage.gradle .
## You should delete or comment out the next line if you have configuration in a different resource-config.json .
**/resource-config.json
-33
View File
@@ -1,33 +0,0 @@
# YourProjectName
A [libGDX](https://libgdx.com/) project generated with [gdx-liftoff](https://github.com/libgdx/gdx-liftoff).
This project was generated with a template including simple application launchers and an `ApplicationAdapter` extension that draws libGDX logo.
## Platforms
- `core`: Main module with the application logic shared by all platforms.
- `html`: Web platform using GWT and WebGL. Supports only Java projects.
## Gradle
This project uses [Gradle](https://gradle.org/) to manage dependencies.
The Gradle wrapper was included, so you can run Gradle tasks using `gradlew.bat` or `./gradlew` commands.
Useful Gradle tasks and flags:
- `--continue`: when using this flag, errors will not stop the tasks from running.
- `--daemon`: thanks to this flag, Gradle daemon will be used to run chosen tasks.
- `--offline`: when using this flag, cached dependency archives will be used.
- `--refresh-dependencies`: this flag forces validation of all dependencies. Useful for snapshot versions.
- `build`: builds sources and archives of every project.
- `cleanEclipse`: removes Eclipse project data.
- `cleanIdea`: removes IntelliJ project data.
- `clean`: removes `build` folders, which store compiled classes and built archives.
- `eclipse`: generates Eclipse project data.
- `html:dist`: compiles GWT sources. The compiled application can be found at `html/build/dist`: you can use any HTTP server to deploy it.
- `html:superDev`: compiles GWT sources and runs the application in SuperDev mode. It will be available at [localhost:8080/html](http://localhost:8080/html). Use only during development.
- `idea`: generates IntelliJ project data.
- `test`: runs unit tests (if any).
Note that most tasks that are not specific to a single project can be run with `name:` prefix, where the `name` should be replaced with the ID of a specific project.
For example, `core:clean` removes `build` folder only from the `core` project.
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

-73
View File
@@ -1,73 +0,0 @@
buildscript {
repositories {
mavenCentral()
maven { url 'https://s01.oss.sonatype.org' }
gradlePluginPortal()
mavenLocal()
google()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
}
}
allprojects {
apply plugin: 'eclipse'
apply plugin: 'idea'
// This allows you to "Build and run using IntelliJ IDEA", an option in IDEA's Settings.
idea {
module {
outputDir file('build/classes/java/main')
testOutputDir file('build/classes/java/test')
}
}
}
configure(subprojects) {
apply plugin: 'java-library'
sourceCompatibility = 11
// From https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/
// The article can be helpful when using assets.txt in your project.
tasks.register('generateAssetList') {
inputs.dir("${project.rootDir}/assets/")
// projectFolder/assets
File assetsFolder = new File("${project.rootDir}/assets/")
// projectFolder/assets/assets.txt
File assetsFile = new File(assetsFolder, "assets.txt")
// delete that file in case we've already created it
assetsFile.delete()
// iterate through all files inside that folder
// convert it to a relative path
// and append it to the file assets.txt
fileTree(assetsFolder).collect { assetsFolder.relativePath(it) }.sort().each {
assetsFile.append(it + "\n")
}
}
processResources.dependsOn 'generateAssetList'
compileJava {
options.incremental = true
}
}
subprojects {
version = "$projectVersion"
ext.appName = 'YourProjectName'
repositories {
mavenCentral()
maven { url 'https://s01.oss.sonatype.org' }
// You may want to remove the following line if you have errors downloading dependencies.
mavenLocal()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://jitpack.io' }
}
}
eclipse.project.name = 'YourProjectName' + '-parent'
-10
View File
@@ -1,10 +0,0 @@
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
eclipse.project.name = appName + '-core'
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
if(enableGraalNative == 'true') {
implementation "io.github.berstanio:gdx-svmhelper-annotations:$graalHelperVersion"
}
}
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.11.0//EN" "https://www.gwtproject.org/doctype/2.11.0/gwt-module.dtd">
<module>
<!-- Paths to source are relative to this file and separated by slashes ('/'). -->
<source path="" />
<!-- Reflection includes may be needed for your code or library code. Each value is separated by periods ('.'). -->
<!-- You can include a full package by not including the name of a type at the end. -->
</module>
@@ -1,34 +0,0 @@
package io.github.some_example_name;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;
/** {@link com.badlogic.gdx.ApplicationListener} implementation shared by all platforms. */
public class Main extends ApplicationAdapter {
private SpriteBatch batch;
private Texture image;
@Override
public void create() {
batch = new SpriteBatch();
image = new Texture("libgdx.png");
}
@Override
public void render() {
ScreenUtils.clear(0.15f, 0.15f, 0.2f, 1f);
batch.begin();
batch.draw(image, 140, 210);
batch.end();
}
@Override
public void dispose() {
batch.dispose();
image.dispose();
}
}
-8
View File
@@ -1,8 +0,0 @@
org.gradle.daemon=false
org.gradle.jvmargs=-Xms512M -Xmx1G -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8
org.gradle.configureondemand=false
gwtFrameworkVersion=2.11.0
gwtPluginVersion=1.1.29
enableGraalNative=false
gdxVersion=1.13.1
projectVersion=1.0.0
Binary file not shown.
-7
View File
@@ -1,7 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
-251
View File
@@ -1,251 +0,0 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
-94
View File
@@ -1,94 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
-156
View File
@@ -1,156 +0,0 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gretty:gretty:3.1.0'
classpath "org.docstr:gwt-gradle-plugin:$gwtPluginVersion"
}
}
apply plugin: "gwt"
apply plugin: "war"
apply plugin: "org.gretty"
gwt {
gwtVersion = "$gwtFrameworkVersion" // Should match the version used for building the GWT backend. See gradle.properties.
maxHeapSize = '1G' // Default 256m is not enough for the GWT compiler. GWT is HUNGRY.
minHeapSize = '1G'
src = files(file('src/main/java')) // Needs to be in front of "modules" below.
modules 'io.github.some_example_name.GdxDefinition'
devModules 'io.github.some_example_name.GdxDefinitionSuperdev'
project.webAppDirName = 'webapp'
compiler.strict = true
compiler.disableCastChecking = true
//// The next line can be useful to uncomment if you want output that hasn't been obfuscated.
// compiler.style = org.docstr.gradle.plugins.gwt.Style.DETAILED
sourceLevel = 1.11
}
dependencies {
implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
implementation "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
implementation project(':core')
}
import org.akhikhl.gretty.AppBeforeIntegrationTestTask
import org.docstr.gradle.plugins.gwt.GwtSuperDev
gretty.httpPort = 8080
// The line below will need to be changed only if you change the build directory to something other than "build".
gretty.resourceBase = "${project.layout.buildDirectory.asFile.get().absolutePath}/gwt/draftOut"
gretty.contextPath = "/"
gretty.portPropertiesFileName = "TEMP_PORTS.properties"
task startHttpServer (dependsOn: [draftCompileGwt]) {
doFirst {
copy {
from "webapp"
into gretty.resourceBase
}
copy {
from "war"
into gretty.resourceBase
}
}
}
task beforeRun(type: AppBeforeIntegrationTestTask, dependsOn: startHttpServer) {
// The next line allows ports to be reused instead of
// needing a process to be manually terminated.
file("build/TEMP_PORTS.properties").delete()
// Somewhat of a hack; uses Gretty's support for wrapping a task in
// a start and then stop of a Jetty server that serves files while
// also running the SuperDev code server.
integrationTestTask 'superDev'
interactive false
}
task superDev(type: GwtSuperDev) {
doFirst {
gwt.modules = gwt.devModules
}
}
//// We delete the (temporary) war/ folder because if any extra files get into it, problems occur.
//// The war/ folder shouldn't be committed to version control.
clean.delete += [file("war")]
// This next line can be changed if you want to, for instance, always build into the
// docs/ folder of a Git repo, which can be set to automatically publish on GitHub Pages.
// This is relative to the html/ folder.
var outputPath = "build/dist/"
task dist(dependsOn: [clean, compileGwt]) {
doLast {
// Uncomment the next line if you have changed outputPath and know that its contents
// should be replaced by a new dist build. Some large JS files are not cleaned up by
// default unless the outputPath is inside build/ (then the clean task removes them).
// Do not uncomment the next line if you changed outputPath to a folder that has
// non-generated files that you want to keep!
//delete(file(outputPath))
file(outputPath).mkdirs()
copy {
from("build/gwt/out"){
exclude '**/*.symbolMap' // Not used by a dist, and these can be large.
}
into outputPath
}
copy {
from("webapp") {
exclude 'index.html' // We edit this HTML file later.
exclude 'refresh.png' // We don't need this button; this saves some bytes.
}
into outputPath
}
copy {
from("webapp") {
// These next two lines take the index.html page and remove the superdev refresh button.
include 'index.html'
filter { String line -> line.replaceAll('<a class="superdev" .+', '') }
// This does not modify the original index.html, only the copy in the dist.
// If you decide to manually remove or comment out the superdev button from index.html, you should also
// either remove or comment out only the "filter" line above this.
}
into outputPath
}
copy {
from "war"
into outputPath
}
}
}
task addSource {
doLast {
sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
sourceSets.main.compileClasspath += files("../core/build/generated/sources/annotationProcessor/java/main")
}
}
task distZip(type: Zip, dependsOn: dist){
//// This uses the output of the dist task, which removes the superdev button from index.html .
from(outputPath)
archiveVersion = projectVersion
archiveBaseName.set("${appName}-dist")
//// The result will be in html/build/ with a name containing "-dist".
destinationDirectory.set(file("build"))
}
tasks.compileGwt.dependsOn(addSource)
tasks.draftCompileGwt.dependsOn(addSource)
tasks.checkGwt.dependsOn(addSource)
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11
sourceSets.main.java.srcDirs = [ "src/main/java/" ]
eclipse.project.name = appName + "-html"
@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.11.0//EN" "https://www.gwtproject.org/doctype/2.11.0/gwt-module.dtd">
<module rename-to="html">
<!-- Paths to source are relative to this file and separated by slashes ('/'). -->
<source path="" />
<!-- "Inherits" lines are how GWT knows where to look for code and configuration in other projects or libraries. -->
<inherits name="com.badlogic.gdx.backends.gdx_backends_gwt" />
<inherits name="io.github.some_example_name.Main" />
<!-- You must change this if you rename packages later, or rename GwtLauncher. -->
<entry-point class="io.github.some_example_name.gwt.GwtLauncher" />
<!-- Reflection includes may be needed for your code or library code. Each value is separated by periods ('.'). -->
<!-- You can include a full package by not including the name of a type at the end. -->
<!-- This is a feature of libGDX, so these lines go after the above "inherits" that brings in libGDX. -->
<!-- <extend-configuration-property name="gdx.reflect.include" value="fully.qualified.TypeName" /> -->
<!-- Rarely, projects may need to include files but do not have access to the complete assets. -->
<!-- This happens for libraries and shared projects, typically, and the configuration goes in that project. -->
<!-- The value is a path, separated by forward slashes, where the root is your html project's resources root. -->
<!-- You can include individual files like this, and access them with Gdx.files.classpath("path/to/file.png") : -->
<!-- This is also a feature of libGDX, so these lines go after the above "inherits" that brings in libGDX. -->
<!-- <extend-configuration-property name="gdx.files.classpath" value="path/to/file.png" /> -->
<!-- You usually won't need to make changes to the rest of this. -->
<set-configuration-property name="gdx.assetpath" value="../assets" />
<set-configuration-property name="xsiframe.failIfScriptTag" value="FALSE"/>
<!-- These two lines reduce the work GWT has to do during compilation and also shrink output size. -->
<set-property name="user.agent" value="gecko1_8, safari"/>
<collapse-property name="user.agent" values="*" />
<!-- Remove the "user.agent" lines above if you encounter issues with Safari or other Gecko browsers. -->
</module>
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.11.0//EN" "https://www.gwtproject.org/doctype/2.11.0/gwt-module.dtd">
<module rename-to="html">
<inherits name="io.github.some_example_name.GdxDefinition" />
<collapse-all-properties />
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-configuration-property name="xsiframe.failIfScriptTag" value="FALSE"/>
</module>
@@ -1,26 +0,0 @@
package io.github.some_example_name.gwt;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import io.github.some_example_name.Main;
/** Launches the GWT application. */
public class GwtLauncher extends GwtApplication {
@Override
public GwtApplicationConfiguration getConfig () {
// Resizable application, uses available space in browser with no padding:
GwtApplicationConfiguration cfg = new GwtApplicationConfiguration(true);
cfg.padVertical = 0;
cfg.padHorizontal = 0;
return cfg;
// If you want a fixed size application, comment out the above resizable section,
// and uncomment below:
//return new GwtApplicationConfiguration(640, 480);
}
@Override
public ApplicationListener createApplicationListener () {
return new Main();
}
}
-3
View File
@@ -1,3 +0,0 @@
<?xml version="1.0" ?>
<web-app>
</web-app>
-31
View File
@@ -1,31 +0,0 @@
<!doctype html>
<html>
<head>
<title>YourProjectName</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta id="gameViewport" name="viewport" content="width=device-width initial-scale=1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<a class="superdev" href="javascript:%7B%20window.__gwt_bookmarklet_params%20%3D%20%7B'server_url'%3A'http%3A%2F%2Flocalhost%3A9876%2F'%7D%3B%20var%20s%20%3D%20document.createElement('script')%3B%20s.src%20%3D%20'http%3A%2F%2Flocalhost%3A9876%2Fdev_mode_on.js'%3B%20void(document.getElementsByTagName('head')%5B0%5D.appendChild(s))%3B%7D">&#8635;</a>
<div align="center" id="embed-html"></div>
<script type="text/javascript" src="html/html.nocache.js"></script>
</body>
<script>
function handleMouseDown(evt) {
evt.preventDefault();
evt.stopPropagation();
window.focus();
}
function handleMouseUp(evt) {
evt.preventDefault();
evt.stopPropagation();
}
document.addEventListener('contextmenu', event => event.preventDefault());
document.getElementById('embed-html').addEventListener('mousedown', handleMouseDown, false);
document.getElementById('embed-html').addEventListener('mouseup', handleMouseUp, false);
</script>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

-53
View File
@@ -1,53 +0,0 @@
canvas {
cursor: default;
outline: none;
}
body {
background-color: #222222;
}
p {
text-align: center;
color: #eeeeee;
}
a {
text-align: center;
color: #bbbbff;
}
.superdev {
color: rgb(37,37,37);
text-shadow: 0px 1px 1px rgba(250,250,250,0.1);
font-size: 50pt;
display: block;
position: relative;
text-decoration: none;
background-color: rgb(83,87,93);
box-shadow: 0px 3px 0px 0px rgb(34,34,34),
0px 7px 10px 0px rgb(17,17,17),
inset 0px 1px 1px 0px rgba(250, 250, 250, .2),
inset 0px -12px 35px 0px rgba(0, 0, 0, .5);
width: 70px;
height: 70px;
border: 0;
border-radius: 35px;
text-align: center;
line-height: 68px;
}
.superdev:active {
box-shadow: 0px 0px 0px 0px rgb(34,34,34),
0px 3px 7px 0px rgb(17,17,17),
inset 0px 1px 1px 0px rgba(250, 250, 250, .2),
inset 0px -10px 35px 5px rgba(0, 0, 0, .5);
background-color: rgb(83,87,93);
top: 3px;
color: #fff;
text-shadow: 0px 0px 3px rgb(250,250,250);
}
.superdev:hover {
background-color: rgb(100,100,100);
}
+51
View File
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nntv</title>
<style>
/* Reset CSS: Please avoid making changes here unless you know what you're doing :) */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
}
body {
line-height: 1;
font-family: Arial, sans-serif;
background-color: #040218;
}
ol, ul {
list-style: none;
}
img, video {
max-width: 100%;
height: auto;
display: block;
}
a {
text-decoration: none;
color: inherit;
}
</style>
</head>
<body>
<div id="game-container"></div>
<script src="./phaser.js"></script>
<script type="module" src="./src/main.js"></script>
</body>
</html>
+247825
View File
File diff suppressed because it is too large. Load diff
+13
View File
@@ -0,0 +1,13 @@
[game]
title = "nntv"
width = 1280
height = 720
pixel_art = false
[user]
id = "d071bee3-5337-46ed-970a-9622a6fc0d72"
[editor]
editor_version = "1.0.0"
phaser_version = "3.88.0"
creation_at = 1739969384981
-4
View File
@@ -1,4 +0,0 @@
// A list of which subprojects to load as part of the same larger project.
// You can remove Strings from the list and reload the Gradle project
// if you want to temporarily disable a subproject.
include 'html', 'core'
+20
View File
@@ -0,0 +1,20 @@
import { Start } from './scenes/Start.js';
const config = {
type: Phaser.AUTO,
title: 'nntv',
description: 'Night Ninja: Twilight Voyage',
parent: 'game-container',
width: 1280,
height: 720,
pixelArt: false,
scene: [
Start
],
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH
},
}
new Phaser.Game(config);
+49
View File
@@ -0,0 +1,49 @@
export class Start extends Phaser.Scene
{
constructor()
{
super('Start');
}
preload()
{
this.load.image('background', 'assets/space.png');
this.load.image('logo', 'assets/phaser.png');
// The ship sprite is CC0 from https://ansimuz.itch.io - check out his other work!
this.load.spritesheet('ship', 'assets/spaceship.png', { frameWidth: 176, frameHeight: 96 });
}
create()
{
this.background = this.add.tileSprite(640, 360, 1280, 720, 'background');
const logo = this.add.image(640, 200, 'logo');
const ship = this.add.sprite(640, 360, 'ship');
ship.anims.create({
key: 'fly',
frames: this.anims.generateFrameNumbers('ship', { start: 0, end: 2 }),
frameRate: 15,
repeat: -1
});
ship.play('fly');
this.tweens.add({
targets: logo,
y: 400,
duration: 1500,
ease: 'Sine.inOut',
yoyo: true,
loop: -1
});
}
update()
{
this.background.tilePositionX += 2;
}
}