Permalink
Browse files

Adding some demos

  • Loading branch information...
1 parent a129768 commit 7153584141cb63eb8ef25416732e6cfcd258807d @saikat committed Sep 2, 2010
Showing 711 changed files with 149,830 additions and 1 deletion.
View
@@ -0,0 +1,15 @@
+[submodule "example/socket.io"]
+ path = example/socket.io
+ url = git://github.com/LearnBoost/Socket.IO-node.git
+[submodule "example/client/Frameworks/SCSocket"]
+ path = example/client/Frameworks/SCSocket
+ url = git://github.com/saikat/SCSocket.git
+[submodule "example/client/Frameworks/LPKit"]
+ path = example/client/Frameworks/LPKit
+ url = git://github.com/luddep/LPKit.git
+[submodule "example/dashboard/Frameworks/LPKit"]
+ path = example/dashboard/Frameworks/LPKit
+ url = git://github.com/luddep/LPKit.git
+[submodule "example/dashboard/Frameworks/SCSocket"]
+ path = example/dashboard/Frameworks/SCSocket
+ url = git://github.com/saikat/SCSocket.git
View
@@ -21,6 +21,7 @@ You will need to install [Socket.IO-node](http://github.com/learnboost/socket.io
server = http.createServer(function(req, res){
});
+ server.listen(8080);
// socket.io, I choose you
var socket = io.listen(server);
var AUTH_TOKEN = 'my_secret_token_for_the_dashboard_client';
@@ -0,0 +1,68 @@
+/*
+ * AppController.j
+ * client
+ *
+ * Created by Saikat Chakrabarti on September 1, 2010.
+ * Copyright 2010, Saikat Chakrabarti All rights reserved.
+ */
+
+@import <Foundation/CPObject.j>
+@import <SCSocket/SCSocket.j>
+@import <LPKit/LPMultiLineTextField.j>
+
+@implementation SocketMultilineTextField : LPMultiLineTextField
+{
+ SCSocket theSocket @accessors;
+}
+
+// NOTE: I wouldn't recommend actually logging every single key press from an application.
+// This just makes for a cool demo.
+- (void)keyDown:(CPEvent)anEvent
+{
+ [super keyDown:anEvent];
+ [theSocket sendMessage:{'c' : [anEvent characters]}];
+}
+@end
+
+@implementation AppController : CPObject
+{
+ SCSocket theSocket;
+}
+
+- (void)applicationDidFinishLaunching:(CPNotification)aNotification
+{
+ theSocket = [[SCSocket alloc] initWithURL:[CPURL URLWithString:"http://localhost:8080"] delegate:self];
+ [theSocket connect];
+}
+
+- (void)socketDidConnect:(SCSocket)aSocket
+{
+ var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
+ contentView = [theWindow contentView],
+ label = [CPTextField labelWithTitle:"Type something:"];
+
+ [label setFont:[CPFont fontWithName:"Helvetica" size:48]];
+
+ [label setTextColor:[CPColor colorWithCalibratedRed:93.0 / 255.0 green:93.0 / 255.0 blue:93.0 / 255.0 alpha:1.0]];
+ [label setTextShadowColor:[CPColor colorWithCalibratedRed:225.0 / 255.0 green:255.0 / 255.0 blue:255.0 / 255.0 alpha:0.7]];
+ [label setTextShadowOffset:CGSizeMake(0.0, 1.0)];
+
+ [label sizeToFit];
+ var inputField = [[SocketMultilineTextField alloc] initWithFrame:CGRectMake(0, 0, 600, 400)];
+ [inputField setTextShadowColor:[CPColor colorWithCalibratedRed:225.0 / 255.0 green:255.0 / 255.0 blue:255.0 / 255.0 alpha:0.7]];
+ [inputField setTextShadowOffset:CGSizeMake(0.0, 1.0)];
+ [inputField setEditable:YES];
+ [inputField setBackgroundColor:[CPColor colorWithHexString:"D1D1D1"]];
+ [inputField setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
+ [inputField setCenter:[contentView center]];
+ [inputField setTheSocket:theSocket];
+ [contentView addSubview:inputField];
+ [contentView addSubview:label];
+ [contentView setBackgroundColor:[CPColor colorWithHexString:"E0E0E0"]];
+
+ [label setCenter:CGPointMake([contentView center].x, [inputField frame].origin.y - 50)];
+
+ [theWindow orderFront:self];
+}
+
+@end
Oops, something went wrong.

0 comments on commit 7153584

Please sign in to comment.