-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init commit
- Loading branch information
Showing
113 changed files
with
10,381 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,6 @@ $RECYCLE.BIN/ | |
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
src.zip | ||
Version.hx | ||
Main.hx |
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,7 @@ | ||
Copyright (C) 2015 Hoothin Wang | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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": "tinyaxe", | ||
"url": "https://github.com/hoothin/tinyaxe", | ||
"license": "MIT", | ||
"tags": [ "Toolkit"], | ||
"description": "Cross-Platform Toolkit", | ||
"version": "0.1.0", | ||
"releasenote": "Initial version.", | ||
"contributors": [ "Hoothin" ], | ||
"dependencies": { | ||
"stablexui":"", | ||
"spinehaxe":"", | ||
"openfl-tiled":"", | ||
"swf":"", | ||
"unifill":"", | ||
"asparticles":"" | ||
} | ||
} |
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,37 @@ | ||
/* | ||
PureMVC haXe Port by Marco Secchi <[email protected]> | ||
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved. | ||
Your reuse is governed by the Creative Commons Attribution 3.0 License | ||
*/ | ||
package org.puremvc.haxe; | ||
|
||
// core | ||
import org.puremvc.haxe.core.Controller; | ||
import org.puremvc.haxe.core.Model; | ||
import org.puremvc.haxe.core.View; | ||
|
||
// interfaces | ||
import org.puremvc.haxe.interfaces.ICommand; | ||
import org.puremvc.haxe.interfaces.IController; | ||
import org.puremvc.haxe.interfaces.IFacade; | ||
import org.puremvc.haxe.interfaces.IMediator; | ||
import org.puremvc.haxe.interfaces.IModel; | ||
import org.puremvc.haxe.interfaces.INotification; | ||
import org.puremvc.haxe.interfaces.INotifier; | ||
import org.puremvc.haxe.interfaces.IObserver; | ||
import org.puremvc.haxe.interfaces.ICommand; | ||
import org.puremvc.haxe.interfaces.IProxy; | ||
import org.puremvc.haxe.interfaces.IView; | ||
|
||
// patterns | ||
import org.puremvc.haxe.patterns.command.MacroCommand; | ||
import org.puremvc.haxe.patterns.command.SimpleCommand; | ||
import org.puremvc.haxe.patterns.facade.Facade; | ||
import org.puremvc.haxe.patterns.mediator.Mediator; | ||
import org.puremvc.haxe.patterns.observer.Notification; | ||
import org.puremvc.haxe.patterns.observer.Notifier; | ||
import org.puremvc.haxe.patterns.observer.Observer; | ||
import org.puremvc.haxe.patterns.proxy.Proxy; | ||
|
||
|
||
|
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,141 @@ | ||
/* | ||
PureMVC haXe Port by Marco Secchi <[email protected]> | ||
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved. | ||
Your reuse is governed by the Creative Commons Attribution 3.0 License | ||
*/ | ||
package org.puremvc.haxe.core; | ||
|
||
import org.puremvc.haxe.core.View; | ||
import org.puremvc.haxe.interfaces.ICommand; | ||
import org.puremvc.haxe.interfaces.IView; | ||
import org.puremvc.haxe.interfaces.IController; | ||
import org.puremvc.haxe.interfaces.INotification; | ||
import org.puremvc.haxe.patterns.observer.Observer; | ||
|
||
#if haxe3 | ||
import haxe.ds.StringMap; | ||
#else | ||
private typedef StringMap<T> = Hash<T>; | ||
#end | ||
|
||
/** | ||
* A Singleton [IController] implementation. | ||
* | ||
* <p>In PureMVC, the [Controller] class follows the | ||
* 'Command and Controller' strategy, and assumes these responsibilities:</p> | ||
* <ul> | ||
* <li> Remembering which [ICommand]s are intended to handle which [INotifications].</li> | ||
* <li> Registering itself as an [IObserver] with the [View] for each [INotification] | ||
* that it has an [ICommand] mapping for.</li> | ||
* <li> Creating a new instance of the proper [ICommand] to handle a given [INotification] | ||
* when notified by the [View].</li> | ||
* <li> Calling the [ICommand]'s [execute] method, passing in the [INotification].</li> | ||
* </ul> | ||
* | ||
* <p>Your application must register [ICommands] with the Controller. | ||
* The simplest way is to subclass [Facade], | ||
* and use its [initializeController] method to add your registrations.</p> | ||
*/ | ||
class Controller implements IController | ||
{ | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* <p>This [IController] implementation is a Singleton, so you cannot | ||
* call the constructor directly, but instead call the static Singleton | ||
* Factory method [Controller.getInstance()]</p> | ||
*/ | ||
private function new() | ||
{ | ||
instance = this; | ||
commandMap = new StringMap(); | ||
initializeController(); | ||
} | ||
|
||
/** | ||
* Initialize the Singleton [Controller] instance. | ||
* | ||
* <p>Called automatically by the constructor.</p> | ||
* | ||
* <p>Note that if you are using a subclass of [View] | ||
* in your application, you should <em>also</em> subclass [Controller] | ||
* and override the [initializeController] method. | ||
*/ | ||
private function initializeController(): Void | ||
{ | ||
view = View.getInstance(); | ||
} | ||
|
||
/** | ||
* [Controller] Singleton Factory method. | ||
*/ | ||
public static function getInstance(): IController | ||
{ | ||
if ( instance == null ) instance = new Controller(); | ||
return instance; | ||
} | ||
|
||
/** | ||
* If an [ICommand] has previously been registered | ||
* to handle a the given [INotification], then it is executed. | ||
*/ | ||
public function executeCommand( note: INotification ): Void | ||
{ | ||
var commandClassRef: Class<ICommand> = commandMap.get( note.getName() ); | ||
if ( commandClassRef == null ) return; | ||
|
||
var commandInstance: ICommand = Type.createInstance( commandClassRef, [] ); | ||
commandInstance.execute( note ); | ||
} | ||
|
||
/** | ||
* Register a particular [ICommand] class as the handler for a particular [INotification]. | ||
* | ||
* <p>If an [ICommand] has already been registered to | ||
* handle [INotification]s with this name, it is no longer | ||
* used, the new [ICommand] is used instead.</p> | ||
* | ||
* <p>The Observer for the new ICommand is only created if this the | ||
* first time an ICommand has been regisered for this Notification name.</p> | ||
*/ | ||
public function registerCommand( notificationName: String, commandClassRef: Class<ICommand> ): Void | ||
{ | ||
if ( !commandMap.exists( notificationName ) ) | ||
view.registerObserver( notificationName, new Observer( executeCommand, this ) ); | ||
commandMap.set( notificationName, commandClassRef ); | ||
} | ||
|
||
/** | ||
* Check if a Command is registered for a given Notification | ||
*/ | ||
public function hasCommand( notificationName: String ): Bool | ||
{ | ||
return commandMap.exists( notificationName ); | ||
} | ||
|
||
/** | ||
* Remove a previously registered [ICommand] to [INotification] mapping. | ||
*/ | ||
public function removeCommand( notificationName: String ): Void | ||
{ | ||
// if the Command is registered... | ||
if ( hasCommand( notificationName ) ) | ||
{ | ||
// remove the observer | ||
view.removeObserver( notificationName, this ); | ||
|
||
commandMap.remove( notificationName ); | ||
} | ||
} | ||
|
||
// Local reference to View | ||
private var view: IView; | ||
|
||
// Mapping of Notification names to Command Class references | ||
private var commandMap: StringMap<Class<ICommand>>; | ||
|
||
// Singleton instance | ||
private static var instance: IController; | ||
|
||
} |
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,111 @@ | ||
/* | ||
PureMVC haXe Port by Marco Secchi <[email protected]> | ||
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved. | ||
Your reuse is governed by the Creative Commons Attribution 3.0 License | ||
*/ | ||
package org.puremvc.haxe.core; | ||
|
||
import org.puremvc.haxe.interfaces.IModel; | ||
import org.puremvc.haxe.interfaces.IProxy; | ||
|
||
#if haxe3 | ||
import haxe.ds.StringMap; | ||
#else | ||
private typedef StringMap<T> = Hash<T>; | ||
#end | ||
|
||
/** | ||
* A Singleton [IModel] implementation. | ||
* | ||
* <p>In PureMVC, the [Model] class provides access to model objects (Proxies) by named lookup.</p> | ||
* | ||
* <p>The [Model] assumes these responsibilities:</p> | ||
* <ul> | ||
* <li>Maintain a cache of [IProxy] instances.</li> | ||
* <li>Provide methods for registering, retrieving, and removing [IProxy] instances.</li> | ||
* </ul> | ||
* | ||
* <p>Your application must register [IProxy] instances with the [Model]. Typically, you use an | ||
* [ICommand] to create and register [IProxy] instances once the [Facade] has initialized the Core | ||
* actors.</p> | ||
*/ | ||
class Model implements IModel | ||
{ | ||
/** | ||
* Constructor. | ||
* | ||
* <p>This [IModel] implementation is a Singleton, so you should not call the constructor | ||
* directly, but instead call the static Singleton Factory method [Model.getInstance()]</p> | ||
*/ | ||
private function new() | ||
{ | ||
instance = this; | ||
proxyMap = new StringMap(); | ||
initializeModel(); | ||
} | ||
|
||
/** | ||
* Initialize the Singleton [Model] instance. | ||
* | ||
* <p>Called automatically by the constructor, this is your opportunity to initialize the Singleton | ||
* instance in your subclass without overriding the constructor.</p> | ||
*/ | ||
private function initializeModel(): Void | ||
{ | ||
} | ||
|
||
/** | ||
* [Model] Singleton Factory method. | ||
*/ | ||
public static function getInstance(): IModel | ||
{ | ||
if ( instance == null ) instance = new Model(); | ||
return instance; | ||
} | ||
|
||
/** | ||
* Register an [IProxy] with the [Model]. | ||
*/ | ||
public function registerProxy( proxy: IProxy ): Void | ||
{ | ||
proxyMap.set( proxy.getProxyName(), proxy ); | ||
proxy.onRegister(); | ||
} | ||
|
||
/** | ||
* Retrieve an [IProxy] from the [Model]. | ||
*/ | ||
public function retrieveProxy( proxyName: String ): IProxy | ||
{ | ||
return proxyMap.get( proxyName ); | ||
} | ||
|
||
/** | ||
* Check if a [Proxy] is registered | ||
*/ | ||
public function hasProxy( proxyName:String ) : Bool | ||
{ | ||
return proxyMap.exists( proxyName ); | ||
} | ||
|
||
/** | ||
* Remove an [IProxy] from the [Model]. | ||
*/ | ||
public function removeProxy( proxyName: String ): IProxy | ||
{ | ||
var proxy: IProxy = proxyMap.get( proxyName ); | ||
if ( proxy != null ) | ||
{ | ||
proxyMap.remove( proxyName ); | ||
proxy.onRemove(); | ||
} | ||
return proxy; | ||
} | ||
|
||
// Mapping of proxyNames to [IProxy] instances | ||
private var proxyMap: StringMap<IProxy>; | ||
|
||
// Singleton instance | ||
private static var instance: IModel; | ||
|
||
} |
Oops, something went wrong.