Skip to content

Commit

Permalink
removed 'web' demo, added VSCode projects, added launch screens, upda…
Browse files Browse the repository at this point in the history
…ted README files of samples, added icon to 'demo' project
  • Loading branch information
PrimaryFeather committed Jul 24, 2021
1 parent 4c87713 commit 37ee17b
Show file tree
Hide file tree
Showing 113 changed files with 305 additions and 594 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ out/
**/.idea/tasks.xml
**/.idea/dictionaries

# Visual Studio Code
**/.vscode/settings.json

# Gradle CI
.gradle/
build/
Expand All @@ -45,3 +48,6 @@ FlexUnitCompilerApplication.as

# Release package
starling/bin/starling-*.zip

# ANE dir
samples/scaffold_mobile/lib/
1 change: 0 additions & 1 deletion samples/demo/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions samples/demo/demo-shared.iml

This file was deleted.

Binary file removed samples/demo/system/Default-Portrait.png
Binary file not shown.
Binary file removed samples/demo/system/Default.png
Binary file not shown.
Binary file removed samples/demo/system/[email protected]
Binary file not shown.
20 changes: 0 additions & 20 deletions samples/demo/system/README.md

This file was deleted.

Binary file removed samples/demo/system/icon114.png
Binary file not shown.
Binary file removed samples/demo/system/icon144.png
Binary file not shown.
Binary file removed samples/demo/system/icon57.png
Binary file not shown.
Binary file removed samples/demo/system/icon72.png
Binary file not shown.
41 changes: 41 additions & 0 deletions samples/demo_mobile/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug (Android device)",
"type": "swf",
"request": "attach",
"platform": "android",
"connect": true,
"preLaunchTask": "Adobe AIR: package Android debug - asconfig.json"
},
{
"name": "Debug (iOS device)",
"type": "swf",
"request": "attach",
"platform": "ios",
"connect": true,
"preLaunchTask": "Adobe AIR: package iOS debug - asconfig.json"
},
{
"name": "Debug (AIR Simulator)",
"type": "swf",
"request": "launch",
"profile": "mobileDevice",
"screensize": "640x960:640x960", // iPhone 4S, a modern classic! ;)
"screenDPI": 326,
"versionPlatform": "IOS",
"preLaunchTask": "ActionScript: compile debug - asconfig.json"
},
{
"name": "Debug (iOS Simulator)",
"type": "swf",
"request": "attach",
"platform": "ios_simulator",
"preLaunchTask": "Adobe AIR: package iOS simulator debug - asconfig.json"
}
]
}
26 changes: 12 additions & 14 deletions samples/demo_mobile/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
How to build this Sample
========================
About this Demo
===============

The mobile demo shows some of the features of Starling. It runs on both iOS and Android devices.
The mobile demo showcases some of the features of Starling. It runs on both iOS and Android devices.

This folder contains just the Startup-code and AIR settings. The rest of the code, as well as the assets, are found in the "demo" folder, and needs to be referenced in your project.
## Building the project

If you are working with Flash Builder, you can import the project using "File - Import Flash Builder Project". However, the project requires you to set up an Eclipse workspace path pointing to Starling. To do that, enter "Preferences - General - Workspace - Linked Resources" and add a new path variable called STARLING_FRAMEWORK that points to the root of the Starling-Framework directory.
Users of "IntelliJ IDEA" can open the project that's stored in `starling/build/idea`.
It has everything set up.

If you are using another IDE, it might unfortunately be a little more complicated. You have to create a project that is based in this folder and add the following source paths to your project:
Users of "Visual Studio Code" can run this demo like this:

* '../demo/src' -> the actual code of the demo
* '../demo/media' -> the assets of the demo
* '../demo/system' -> the system graphics (icons, launch images) of the demo
1. Install the "ActionScript & MXML" extension from Josh Tynjala and point it to the latest AIR SDK.
2. Open the project folder in Visual Studio Code.
3. (Optional) To run on an actual device, adapt the "signingOptions" in `asconfig.json` so that they point to your local development keys from Apple and Google.
4. Enter the "Run and Debug" menu in the sidebar and start of one of the available configurations.

Starling itself can either be linked via a source path, or by referencing its swc file.

If your IDE doesn't allow adding source paths outside the project root, I recommend you create a new folder where you manually merge the "demo" and "demo_web" folders together. Then add just the "media" and "system" folders to your source paths (that's required so that their contents is added to the compiled application package).

**Note:** You need at least AIR 3.2 to deploy AIR applications on a mobile device. Furthermore, you need the development certificates and profiles (provided by Apple or Google).
All others, please refer to the documentation of their respective IDE.
52 changes: 52 additions & 0 deletions samples/demo_mobile/asconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"config": "airmobile",
"compilerOptions": {
"output": "out/demo.swf",
"source-path": [
"src",
"../../starling/src"
]
},
"mainClass": "Demo",
"application": "src/Demo-app.xml",
"airOptions": {
"android": {
"output": "out/demo.apk",
"listen": true,
"signingOptions": {
"storetype": "JKS",
"keystore": "../../../library/android/dev-key.keystore"
},
"resdir": "system/res"
},
"ios": {
"output": "out/demo.ipa",
"listen": true,
"signingOptions": {
"storetype": "pkcs12",
"keystore": "../../../library/ios/daniel_dev_certificate.p12",
"provisioning-profile": "../../../library/ios/ios_dev_profile.mobileprovision"
}
},
"ios_simulator": {
"output": "out/demo-simulator.ipa",
"platformsdk": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk",
"target": "ipa-debug-interpreter-simulator",
"signingOptions": {
"storetype": "pkcs12",
"keystore": "../../../library/ios/daniel_dev_certificate.p12",
"provisioning-profile": "../../../library/ios/ios_dev_profile.mobileprovision"
}
},
"files": [
{
"file": "assets",
"path": "assets"
},
{
"file": "system",
"path": ""
}
]
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion samples/demo_mobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ type = 'mobile'
mainClass = 'Demo_Mobile.as'
air {
storepass = 'gradlefx'
applicationDescriptor = 'src/Demo_Mobile-app.xml'
applicationDescriptor = 'src/Demo-app.xml'
}
22 changes: 9 additions & 13 deletions samples/demo_mobile/demo-mobile.iml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,31 @@
<module type="Flex" version="4">
<component name="FlexBuildConfigurationManager" active="demo-mobile">
<configurations>
<configuration name="demo-mobile" target-platform="Mobile" pure-as="true" main-class="Demo_Mobile" output-file="demo_mobile.swf" output-folder="$MODULE_DIR$/out">
<configuration name="demo-mobile" target-platform="Mobile" pure-as="true" main-class="Demo" output-file="demo.swf" output-folder="$MODULE_DIR$/out">
<dependencies>
<entries>
<entry module-name="demo-shared" build-configuration-name="demo-shared">
<dependency linkage="Merged" />
</entry>
<entry module-name="starling" build-configuration-name="starling">
<dependency linkage="Merged" />
</entry>
</entries>
<sdk name="air-32" />
<sdk name="air-33" />
</dependencies>
<compiler-options>
<map>
<entry key="compiler.locale" value="en_US" />
</map>
</compiler-options>
<packaging-air-desktop />
<packaging-android enabled="true" use-generated-descriptor="false" custom-descriptor-path="$MODULE_DIR$/src/Demo_Mobile-app.xml" package-file-name="Demo_Mobile">
<packaging-android enabled="true" use-generated-descriptor="false" custom-descriptor-path="$MODULE_DIR$/src/Demo-app.xml" package-file-name="Demo_Mobile">
<files-to-package>
<FilePathAndPathInPackage file-path="$MODULE_DIR$/../demo/assets" path-in-package="." />
<FilePathAndPathInPackage file-path="$MODULE_DIR$/../demo/system" path-in-package="." />
<FilePathAndPathInPackage file-path="$MODULE_DIR$/assets" path-in-package="assets" />
<FilePathAndPathInPackage file-path="$MODULE_DIR$/system" path-in-package="." />
</files-to-package>
</packaging-android>
<packaging-ios enabled="true" use-generated-descriptor="false" custom-descriptor-path="$MODULE_DIR$/src/Demo_Mobile-app.xml" package-file-name="Demo_Mobile">
<packaging-ios enabled="true" use-generated-descriptor="false" custom-descriptor-path="$MODULE_DIR$/src/Demo-app.xml" package-file-name="Demo_Mobile">
<files-to-package>
<FilePathAndPathInPackage file-path="$MODULE_DIR$/../demo/assets" path-in-package="." />
<FilePathAndPathInPackage file-path="$MODULE_DIR$/../demo/system" path-in-package="." />
<FilePathAndPathInPackage file-path="$MODULE_DIR$/assets" path-in-package="assets" />
<FilePathAndPathInPackage file-path="$MODULE_DIR$/system" path-in-package="." />
</files-to-package>
<AirSigningOptions keystore-path="$MODULE_DIR$/../../../library/ios/daniel_dev_certificate.p12" provisioning-profile-path="$MODULE_DIR$/../../../library/ios/ios_dev_profile.mobileprovision" />
</packaging-ios>
Expand All @@ -44,9 +41,8 @@
<excludeFolder url="file://$MODULE_DIR$/bin-debug" />
<excludeFolder url="file://$MODULE_DIR$/bin-release" />
</content>
<orderEntry type="jdk" jdkName="air-32" jdkType="Flex SDK Type (new)" />
<orderEntry type="jdk" jdkName="air-33" jdkType="Flex SDK Type (new)" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="starling" exported="" />
<orderEntry type="module" module-name="demo-shared" exported="" />
</component>
</module>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<application xmlns="http://ns.adobe.com/air/application/32.0">
<application xmlns="http://ns.adobe.com/air/application/33.1">

<id>com.gamua.starling.demo</id> <!-- Bundle Identifier. Required. -->
<filename>Starling-Demo</filename> <!-- Used as the filename for the application. Required. -->
Expand Down Expand Up @@ -46,15 +46,23 @@

<!-- iOS specific capabilities -->
<iPhone>
<!-- A list of plist key/value pairs to be added to the application Info.plist -->
<!-- UIDeviceFamily: 1 - iPhone/iPod Touch; 2 - iPad; both: universal app -->

<InfoAdditions><![CDATA[
<InfoAdditions><![CDATA[
<!-- A list of plist key/value pairs to be added to the application Info.plist -->
<!-- UIDeviceFamily: 1 - iPhone/iPod Touch; 2 - iPad; both: universal app -->
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<!-- Only required when using a licensed AIR version.
Otherwise, the AIR splash screen is used. -->
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<!-- The minimum version of iOS you want to support. -->
<key>MinimumOSVersion</key>
<string>11.0</string>
]]></InfoAdditions>

<!-- Display Resolution for the app ("standard" or "high"). Optional. Default "standard" -->
Expand All @@ -81,6 +89,12 @@
</manifest>
]]>
</manifestAdditions>
</android>
</android>

<!-- This points to the Android resource directory, which contains the app icon. -->
<!-- The path is relative to the SWF file that's being packaged. -->
<!-- Find out how to set up the icon files here:
https://docs.airnativeextensions.com/docs/tutorials/android-adaptive-icons -->
<resdir>../system/res</resdir>

</application>
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ package

import utils.ProgressBar;

// This project requires the sources of the "demo" project. Add them either by
// referencing the "demo/src" directory as a "source path", or by copying the files.
// The "media" folder of this project has to be added to its "source paths" as well,
// to make sure the icon and startup images are added to the compiled mobile app.

[SWF(width="320", height="480", frameRate="30", backgroundColor="#000000")]
public class Demo_Mobile extends Sprite
public class Demo extends Sprite
{
private const StageWidth:int = 320;
private const StageHeight:int = 480;
Expand All @@ -39,11 +34,11 @@ package
private var _background:Loader;
private var _progressBar:ProgressBar;

public function Demo_Mobile()
public function Demo()
{
// We develop the game in a *fixed* coordinate system of 320x480. The game might
// then run on a device with a different resolution; for that case, we zoom the
// viewPort to the optimal size for any display and load the optimal textures.
// This demo still uses a fixed coordinate sytem of 320x480, just like the original
// iPhone and iPhone 4/4S. The contents is then centered on the screen. Nowadays,
// you'd use a different approach, of course. See the "Scaffold" project for a sample.

var iOS:Boolean = SystemUtil.platform == "IOS";
var stageSize:Rectangle = new Rectangle(0, 0, StageWidth, StageHeight);
Expand Down Expand Up @@ -89,9 +84,9 @@ package

assets.verbose = Capabilities.isDebugger;
assets.enqueue(
appDir.resolvePath("audio"),
appDir.resolvePath(StringUtil.format("fonts/{0}x", scaleFactor)),
appDir.resolvePath(StringUtil.format("textures/{0}x", scaleFactor))
appDir.resolvePath("assets/audio"),
appDir.resolvePath(StringUtil.format("assets/fonts/{0}x", scaleFactor)),
appDir.resolvePath(StringUtil.format("assets/textures/{0}x", scaleFactor))
);

// Now, while the AssetManager now contains pointers to all the assets, it actually
Expand Down Expand Up @@ -131,7 +126,7 @@ package
{
// Add background image. By using "loadBytes", we can avoid any flickering.

var bgPath:String = StringUtil.format("textures/{0}x/background.jpg", scaleFactor);
var bgPath:String = StringUtil.format("assets/textures/{0}x/background.jpg", scaleFactor);
var bgFile:File = File.applicationDirectory.resolvePath(bgPath);
var bytes:ByteArray = new ByteArray();
var stream:FileStream = new FileStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package
public class Game extends Sprite
{
// Embed the Ubuntu Font. Beware: the 'embedAsCFF'-part IS REQUIRED!!!
[Embed(source="../../demo/assets/fonts/Ubuntu-R.ttf", embedAsCFF="false", fontFamily="Ubuntu")]
[Embed(source="../assets/fonts/Ubuntu-R.ttf", embedAsCFF="false", fontFamily="Ubuntu")]
private static const UbuntuRegular:Class;

private var _mainMenu:MainMenu;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added samples/demo_mobile/system/Assets.car
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added samples/demo_mobile/system/icon114.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/demo_mobile/system/icon144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/demo_mobile/system/icon57.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/demo_mobile/system/icon72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions samples/demo_mobile/system/res/mipmap-anydpi-v26/icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/icon_background"/>
<foreground android:drawable="@mipmap/icon_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/icon_background"/>
<foreground android:drawable="@mipmap/icon_foreground"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 37ee17b

Please sign in to comment.