-
Notifications
You must be signed in to change notification settings - Fork 0
haxe wrappers for node.js/gtk-server
blackdog66/bdog-gtk
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Below is my working example, it doesn't actually use the port specfied as I've altered the server to run gtk-server as a child process. ----------------------------------------------------------------------- package test; import gtk.Model; import gtk.Gtk; import ui.Ui; import ui.MessageDialog; import ui.Window; import ui.Button; import ui.Text; import ui.Combo; import ui.Label; import ui.TextView; import ui.TextBuffer; import js.Node; import bdog.bingo.Common; import bdog.bingo.client.Controller; import bdog.extra.Locator; class BClient { public static function main() { Ui.init(50001,start); } static var entry1:Text; static var cmbRooms:Combo; static var lblState:Label; static var lblSecs:Label; static var lblNCards:Label; static var lblStatus:Label; static var window:Window; static var wndCards:Window; static var viewRaw:TextView; static var textBuffer:TextBuffer; public static function appWindow() { return window; } public static function start() { Ui.fromFile("bingo.glade",function(g:GladeXml) { Button.fromGlade(g,"btnCards",function(b) { b.onClick(function(w,e) { room().requestCards(); }); }); Text.fromGlade(g,"entry1",function(t:Text) { entry1 = t; entry1.set("woot"); }); Button.fromGlade(g,"btnSLogin",function(b) { b.onClick(function(w,e) { sLogin(); }); }); Label.fromGlade(g,"lblSecs",function(l) { lblSecs = l; }); Label.fromGlade(g,"lblState",function(l) { lblState = l; }); Label.fromGlade(g,"lblNCards",function(l) { lblNCards = l; }); Label.fromGlade(g,"lblStatus",function(l) { lblStatus = l; }); Combo.fromGlade(g,"cmbRooms",function(c:Combo) { cmbRooms = c; cmbRooms.onChange(function(w,e) { trace("room changed "+w+" with event "+e); }); }); TextView.fromGlade(g,"viewRaw",function(tv:TextView) { viewRaw = tv; tv.getBuffer(function(tb){ textBuffer = tb; textBuffer.setText("woot"); }); }); Window.fromGlade(g,"window1",function(w) { window = w; window.title("bingo"); window.onDestroy(function(w,e) { Gtk.mainQuit(); Node.process.exit(0); }); Ui.poll(window); pLogin(); }); Window.fromGlade(g,"wndCards",function(w) { wndCards = w; wndCards.onDestroy(function(w,e) { wndCards.hide(); }); Button.fromGlade(g,"btnShowCards",function(b) { b.onClick(function(w,e) { wndCards.show(); }); }); }); }); } static function pLogin() { var l:Location = {host:'localhost',port:8084}; Controller.login(l,'[email protected]','pass','site',function(err,u) { entry1.set(u.sessID); }); } public static function room() { return Controller.getRoom(); } static function sLogin() { cmbRooms.selected(function(roomID) { trace("roomID = "+roomID); if (roomID == "") { MessageDialog.info("Select a room first",appWindow()); return; } Controller.roomLogin(Controller.sessID,roomID,function(room) { room.event.onLogin.addHandler(function(login) { }); room.event.onGame.addHandler(function(g) { }); room.event.onCards.addHandler(function(c) { lblNCards.label(Std.string(c.cards.length)); }); room.event.onSync.addHandler(function(s:SyncPkt) { lblState.label(s.event); lblSecs.label(Std.string(s.curSec)); }); room.event.onDebug.addHandler(function(d:Dynamic) { trace("displaying raw "); textBuffer.setText(Std.string(d)); }); room.event.onCannotBuy.addHandler(function() { lblStatus.label("you cannot buy right now"); }); }); }); } }
About
haxe wrappers for node.js/gtk-server
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published