This repository has been archived by the owner on May 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
StageXL app generator. #381
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2014, Google Inc. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
import '../stagehand.dart'; | ||
import '../src/common.dart'; | ||
import 'web_stagexl_data.dart'; | ||
|
||
/** | ||
* A generator for a StageXL web application. | ||
*/ | ||
class WebStageXlGenerator extends DefaultGenerator { | ||
WebStageXlGenerator() | ||
: super('web-stagexl', 'Simple StageXL Application', | ||
'A basic 2D canvas app with StageXL.', | ||
categories: const ['dart', 'web']) { | ||
for (TemplateFile file in decodeConcatenatedData(data)) { | ||
addTemplateFile(file); | ||
} | ||
|
||
setEntrypoint(getFile('web/index.html')); | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Files and directories created by pub | ||
.packages | ||
.pub/ | ||
build/ | ||
# Remove the following pattern if you wish to check in your lock file | ||
pubspec.lock | ||
|
||
# Directory created by dartdoc | ||
doc/api/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## 0.0.1 | ||
|
||
- Initial version, created by Stagehand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Copyright (c) __year__, __author__. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
* Neither the name of the <organization> nor the | ||
names of its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# A simple StageXL app | ||
|
||
Generated by Stagehand. See LICENSE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This file allows you to configure the Dart analyzer. | ||
# | ||
# The commented part below is just for inspiration. Read the guide here: | ||
# https://www.dartlang.org/guides/language/analysis-options | ||
|
||
# analyzer: | ||
# strong-mode: true | ||
# exclude: | ||
# - path/to/excluded/files/** | ||
# linter: | ||
# rules: | ||
# # see catalog here: http://dart-lang.github.io/linter/lints/ | ||
# - hash_and_equals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: __projectName__ | ||
description: A simple StageXL web app. | ||
version: 0.0.1 | ||
#homepage: https://www.example.com | ||
#author: __author__ <email@example.com> | ||
|
||
environment: | ||
sdk: '>=1.20.1 <2.0.0' | ||
|
||
dependencies: | ||
stagexl: ^1.1.0 | ||
|
||
dev_dependencies: | ||
browser: ^0.10.0 | ||
dart_to_js_script_rewriter: ^1.0.1 | ||
|
||
transformers: | ||
- dart_to_js_script_rewriter |
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
|
||
<!-- | ||
Copyright (c) __year__, __author__. All rights reserved. Use of this source code | ||
is governed by a BSD-style license that can be found in the LICENSE file. | ||
--> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="scaffolded-by" content="https://github.com/google/stagehand"> | ||
<title>__projectName__</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
<script defer src="main.dart" type="application/dart"></script> | ||
<script defer src="packages/browser/dart.js"></script> | ||
</head> | ||
|
||
<body> | ||
|
||
<canvas id="stage" class="stage--fullscreen"></canvas> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) __year__, __author__. All rights reserved. Use of this source code | ||
// is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:async'; | ||
import 'dart:html' as html; | ||
import 'package:stagexl/stagexl.dart'; | ||
import 'dart:math'; | ||
|
||
Future<Null> main() async { | ||
StageOptions options = new StageOptions() | ||
..backgroundColor = Color.White | ||
..renderEngine = RenderEngine.WebGL; | ||
|
||
var canvas = html.querySelector('#stage'); | ||
var stage = new Stage(canvas, width: 1280, height: 800, options: options); | ||
|
||
var renderLoop = new RenderLoop(); | ||
renderLoop.addStage(stage); | ||
|
||
var resourceManager = new ResourceManager(); | ||
resourceManager.addBitmapData("dart", "images/dart@1x.png"); | ||
|
||
await resourceManager.load(); | ||
|
||
var logoData = resourceManager.getBitmapData("dart"); | ||
var logo = new Sprite(); | ||
logo.addChild(new Bitmap(logoData)); | ||
|
||
logo.pivotX = logoData.width / 2; | ||
logo.pivotY = logoData.height / 2; | ||
|
||
// Place it at top center. | ||
logo.x = 1280 / 2; | ||
logo.y = 0; | ||
|
||
stage.addChild(logo); | ||
|
||
// And let it fall. | ||
var tween = stage.juggler.addTween(logo, 3, Transition.easeOutBounce); | ||
tween.animate.y.to(800 / 2); | ||
|
||
// Add some interaction on mouse click. | ||
Tween rotation; | ||
logo.onMouseClick.listen((MouseEvent e) { | ||
// Don't run more rotations at the same time. | ||
if (rotation != null) return; | ||
rotation = stage.juggler.addTween(logo, 0.5, Transition.easeInOutCubic); | ||
rotation.animate.rotation.by(2 * PI); | ||
rotation.onComplete = () => rotation = null; | ||
}); | ||
logo.mouseCursor = MouseCursor.POINTER; | ||
|
||
// See more examples: | ||
// https://github.com/bp74/StageXL_Samples | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@import url(https://fonts.googleapis.com/css?family=Roboto); | ||
|
||
html, body, .stage--fullscreen { | ||
width: 100%; | ||
height: 100%; | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing newline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we set this up so that it dances on mouse-over...or reanimates when clicked?
Just something so it feel playful and shows a bit of event handling.