This file contains hidden or 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
Mobile.Class(function WifiP2PPing(_id, _parent) { | |
var _this = this; | |
var _results = []; | |
var _messages = {}; | |
//*** Constructor | |
(function () { | |
setTimeout(send, 500); | |
})(); |
This file contains hidden or 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
Mobile.Class(function WifiP2P() { | |
Inherit(this, Mobile.BaseModule); | |
var _this = this; | |
var _connected = false; | |
var _message = {fn: 'message'}; | |
var _id = Utils.timestamp(); | |
var _connections = [_id]; | |
var _ping = {}; |
This file contains hidden or 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
private void setup() { | |
AsyncServer.getDefault().connectSocket(_host, new ConnectCallback() { | |
@Override | |
public void onConnectCompleted(Exception ex, final AsyncSocket socket) { | |
handleConnectCompleted(ex, socket); | |
} | |
}); | |
} |
This file contains hidden or 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
private void initialize(JSONObject data) throws JSONException { | |
if (_active) { | |
return; | |
} | |
_active = true; | |
Activity activity = Modules.ACTIVITY; | |
_intentFilter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION); | |
_intentFilter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION); |
This file contains hidden or 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
function initParticles() { | |
_particles = _this.initClass(ParticlePhysics, new VerletIntegrator()); | |
_particles.addBehavior(new EdgeBehavior(false, true)); | |
_gravity = new Force(new Vector2(0, 200)); | |
_particles.addBehavior(_gravity); | |
_collision = new Collision(); | |
_particles.addBehavior(_collision); | |
_emitter = _this.initClass(Emitter, new Vector2(Stage.width/2, Stage.height/2), 0); |
This file contains hidden or 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
float levelChannel(float inPixel, float inBlack, float inGamma, float inWhite, float outBlack, float outWhite) { | |
return (pow(((inPixel * 255.0) - inBlack) / (inWhite - inBlack), inGamma) * (outWhite - outBlack) + outBlack) / 255.0; | |
} | |
vec3 levels(vec3 inPixel, float inBlack, float inGamma, float inWhite, float outBlack, float outWhite) { | |
vec3 o = vec3(1.0); | |
o.r = levelChannel(inPixel.r, inBlack, inGamma, inWhite, outBlack, outWhite); | |
o.g = levelChannel(inPixel.g, inBlack, inGamma, inWhite, outBlack, outWhite); | |
o.b = levelChannel(inPixel.b, inBlack, inGamma, inWhite, outBlack, outWhite); | |
return o; |