Skip to content

Commit 1ae2727

Browse files
committed
July 2015 Release
1 parent 857b3b3 commit 1ae2727

40 files changed

+2725
-250
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
## DevPro Game Snap
2-
Copyright © 2015 GarageGames LLC
1+
## DevPro Game Stack
2+
Copyright 2015 GarageGames LLC
33
Based on Scratch from the MIT Media Laboratory under the GPL 2 license.
44

55
### About
6-
Game Snap is the companion application to the DevPro Game Design & Programming Curriculum for High School and Higher Ed. You may get started for free at the [GG|Interactive web site](http://www.gginteractive.com/).
6+
Game Stack is the companion application to the DevPro Game Design & Programming Curriculum for High School and Higher Ed. You may get started for free at the [GG|Interactive web site](http://www.gginteractive.com/).
77

88
### Building
9-
To build Game Snap you will need the Apache Flex SDK 4.11, Flash Player 11.6, Adobe AIR 3.6, and Flash Builder 4.7. The Apache Foundation has an [installer](http://flex.apache.org/installer.html) that makes it easy to select the correct version of Flex to install. Flash Builder is available from Adobe.
9+
To build Game Stack you will need the Apache Flex SDK 4.11, Flash Player 11.6, Adobe AIR 3.6, and Flash Builder 4.7. The Apache Foundation has an [installer](http://flex.apache.org/installer.html) that makes it easy to select the correct version of Flex to install. Flash Builder is available from Adobe.
1010

src/Designer-app.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515

1616
<!-- A universally unique application identifier. Must be unique across all AIR applications.
1717
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
18-
<id>com.gginteractive.DevProGameSnap</id>
18+
<id>com.gginteractive.DevProGameStack</id>
1919

2020
<!-- Used as the filename for the application. Required. -->
21-
<filename>GameSnap</filename>
21+
<filename>GameStack</filename>
2222

2323
<!-- The name that is displayed in the AIR application installer.
2424
May have multiple values for each language. See samples or xsd schema file. Optional. -->
25-
<name>DevPro Game Snap</name>
25+
<name>DevPro Game Stack</name>
2626

2727
<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
2828
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
2929
An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->
30-
<versionNumber>0.0.3</versionNumber>
30+
<versionNumber>0.8.0</versionNumber>
3131

3232
<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
3333
<!-- <versionLabel></versionLabel> -->

src/Designer.as

+84-13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package {
1818

1919
import scratch.ScratchObj;
2020

21+
import ui.parts.DesignTabPart;
2122
import ui.parts.GlobalTabPart;
2223

2324
import uiwidgets.DialogBox;
@@ -31,6 +32,7 @@ public class Designer extends Scratch {
3132
protected var lastViewedObject:ScratchObj = null;
3233

3334
protected var globalTabPart:GlobalTabPart;
35+
public var designTabPart:DesignTabPart;
3436

3537
protected var displayFPSCounter:Boolean = false; // Tracks displaying the FPS counter
3638

@@ -69,7 +71,7 @@ public class Designer extends Scratch {
6971
debugTextBox.text = text;
7072
}
7173
}
72-
74+
7375
override protected function addFileMenuItems(b:*, m:Menu):void {
7476
m.addItem('Open', runtime.selectProjectFile);
7577
m.addItem('Save', exportProjectToFile);
@@ -110,13 +112,16 @@ public class Designer extends Scratch {
110112
m.addLine();
111113
m.addItem('Edit block colors', editBlockColors);
112114

115+
m.addLine();
116+
m.addItem('Toggle Template Sprites Tab', toggleTemplateSpritesTab);
117+
m.addItem('Toggle Global Tab', toggleGlobalTab);
118+
m.addItem('Toggle Access Data By Strings blocks', toggleAccessDataByStrings);
119+
113120
if (b.lastEvent.shiftKey) {
114121
m.addLine();
115122
m.addItem('Toggle FPS Counter', toggleFPSCounter);
116123

117124
m.addItem('Toggle Focus Area blocks', toggleFocusAreaBlocks);
118-
119-
m.addItem('Toggle Global Tab', toggleGlobalTab);
120125
}
121126
}
122127

@@ -140,14 +145,28 @@ public class Designer extends Scratch {
140145
Scratch.app.translationChanged();
141146
}
142147

148+
protected function toggleAccessDataByStrings():void {
149+
if (app.showDataByStringBlocks) {
150+
app.showDataByStringBlocks = false;
151+
} else {
152+
app.showDataByStringBlocks = true;
153+
}
154+
155+
Scratch.app.translationChanged();
156+
}
157+
143158
protected function toggleGlobalTab():void {
144159
tabsPart.toggleGlobalTab();
145160
}
161+
162+
protected function toggleTemplateSpritesTab():void {
163+
libraryPart.toggleSpriteTemplateTabs();
164+
}
146165

147166
override public function showAboutMenu(b:*):void {
148167
// Just display a dialog
149168
DialogBox.notify(
150-
'DevPro Game Snap v0.0.3',
169+
'DevPro Game Stack v0.8.0',
151170
'\nCopyright © 2015 GarageGames LLC' +
152171
'\n\nBased on Scratch from the MIT Media Laboratory' +
153172
'\nunder the GPL 2 license.', stage);
@@ -182,14 +201,48 @@ public class Designer extends Scratch {
182201

183202
override protected function exportProjectToFile(fromJS:Boolean = false):void {
184203
function squeakSoundsConverted():void {
204+
// For Game Snap
205+
function saveZipData(event:Event):void {
206+
var ext:String = '.stack';
207+
208+
//var newFile:File = event.target as File;
209+
var tempArray:Array = File(event.target).nativePath.split(File.separator);
210+
var fileName:String = tempArray.pop(); // Remove last array item, which should be the file name
211+
if(fileName.lastIndexOf(ext) == -1) {
212+
fileName += ext;
213+
}
214+
215+
// Add back the file name
216+
tempArray.push(fileName);
217+
218+
// Write!
219+
var fs:FileStream = new FileStream();
220+
var newFile:File = new File(tempArray.join(File.separator));
221+
fs.open(newFile, FileMode.WRITE);
222+
fs.writeBytes(zipData);
223+
fs.close();
224+
225+
if (!fromJS) setProjectName(fileName);
226+
227+
// Store the project's path
228+
setProjectPath(event.target.nativePath);
229+
230+
clearSaveNeeded();
231+
232+
if(postExportAction != null) {
233+
postExportAction();
234+
postExportAction = null;
235+
}
236+
}
237+
185238
// Make sure everything is saved
186239
scriptsPane.saveScripts(false);
187240

188241
// Make the default name
189242
var projName:String = projectName();
190243
projName = projName.replace(/^\s+|\s+$/g, ''); // Remove whitespace
191244
//var defaultName:String = (projName.length > 0) ? projName + '.sb2' : 'project.sb2';
192-
var defaultName:String = (projName.length > 0) ? projName + '.snap' : 'project.snap';
245+
var defaultName:String = (projName.length > 0) ? projName + '.stack' : 'project.stack';
193246

194247
// Get the project's binary file
195248
var zipData:ByteArray = projIO.encodeProjectAsZipFile(stagePane);
@@ -215,11 +268,15 @@ public class Designer extends Scratch {
215268
//showDebugDialog("exportProjectToFile", "Save File path: " + getProjectPath());
216269
} else {
217270
// Need to ask for a filename and path
218-
var file:File = new File();
219-
file.addEventListener(Event.COMPLETE, fileSaved);
220-
file.addEventListener(Event.CANCEL, fileError);
221-
file.addEventListener(flash.events.IOErrorEvent.IO_ERROR, fileError);
222-
file.save(zipData, fixFileName(defaultName));
271+
//var file:File = new File();
272+
//file.addEventListener(Event.COMPLETE, fileSaved);
273+
//file.addEventListener(Event.CANCEL, fileError);
274+
//file.addEventListener(flash.events.IOErrorEvent.IO_ERROR, fileError);
275+
//file.save(zipData, fixFileName(defaultName));
276+
var file:File = File.applicationStorageDirectory;
277+
file = file.resolvePath(fixFileName(defaultName));
278+
file.addEventListener(Event.SELECT, saveZipData);
279+
file.browseForSave("Save As");
223280
}
224281
}
225282
function fileSaved(e:Event):void {
@@ -282,6 +339,7 @@ public class Designer extends Scratch {
282339
super.addParts();
283340

284341
//globalTabPart = new GlobalTabPart(this);
342+
designTabPart = new DesignTabPart(this);
285343

286344
}
287345

@@ -327,6 +385,9 @@ public class Designer extends Scratch {
327385
} else if (tabName == 'sounds') {
328386
soundsPart.refresh();
329387
show(soundsPart);
388+
} else if (tabName == 'design') {
389+
//designTabPart.refresh();
390+
show(designTabPart);
330391
} else if (tabName == 'global') {
331392
scriptsPart.setGlobalTab(true);
332393

@@ -367,6 +428,14 @@ public class Designer extends Scratch {
367428
if (saveNeeded) setSaveNeeded(true); // save project when switching tabs, if needed (but NOT while loading!)
368429
}
369430

431+
432+
override protected function updateContentArea(contentX:int, contentY:int, contentW:int, contentH:int, fullH:int):void {
433+
super.updateContentArea(contentX, contentY, contentW, contentH, fullH);
434+
designTabPart.x = contentX;
435+
designTabPart.y = contentY;
436+
designTabPart.setWidthHeight(contentW, contentH);
437+
}
438+
370439
// Get the project's native file path (including file name)
371440
public function getProjectPath():String {
372441
return projectPath;
@@ -425,10 +494,12 @@ public class Designer extends Scratch {
425494
// arguments and the current application path.
426495
private function onAppInvoke( event:InvokeEvent ):void {
427496
var fileName:String, data:ByteArray;
428-
function projectLoadComplete(event:Event):void {
497+
var filePath:String;
498+
function projectLoadComplete(fevent:Event):void {
429499
// File has been loaded and we have the data
430500
data = invokedFile.data;
431-
runtime.installProjectFromFile(fileName, data);
501+
filePath = fevent.target.nativePath;
502+
runtime.installProjectFromFile(fileName, filePath, data);
432503
invokedFile = null;
433504
}
434505
function projectLoadError(event:Event):void {
@@ -447,7 +518,7 @@ public class Designer extends Scratch {
447518
invokedFile = dir.resolvePath(event.arguments[0]);
448519
var extension:String = invokedFile.extension;
449520

450-
if(extension == 'snap' || extension == 'sb2' || extension == 'sb') {
521+
if(extension == 'stack' || extension == 'snap' || extension == 'sb2' || extension == 'sb') {
451522
fileName = invokedFile.name;
452523

453524
// We need to load in the file to retrieve its data

0 commit comments

Comments
 (0)