1 $:.unshift(File.join(File.dirname(__FILE__), '..'))
4 require 'themes/loader'
5 require 'games/chess/chess'
8 require 'ics/connection'
12 require 'board/notify'
13 require 'ics/match_handler'
15 protocol = ICS::Protocol.new(:debug)
16 c = ICS::Connection.new('freechess.org', 23)
18 protocol.add_observer ICS::AuthModule.new(c, 'ujjajja', '')
19 protocol.add_observer ICS::StartupModule.new(c)
22 description = "KDE Board Game Suite"
24 about = KDE::AboutData.new("kaya", "Kaya", KDE.ki18n("Kaya"),
25 version, KDE.ki18n(description),KDE::AboutData::License_GPL,KDE.ki18n("(C) 2009 Paolo Capriotti"))
27 KDE::CmdLineArgs.init(ARGV, about)
29 app = KDE::Application.new
31 class Scene < Qt::GraphicsScene
37 theme_loader = ThemeLoader.new
38 theme = Struct.new(:pieces, :background).new
39 theme.pieces = theme_loader.get('Celtic')
40 theme.background = theme_loader.get('Default', Point.new(8, 8))
42 chess = Game.get(:chess)
44 scene = Qt::GraphicsScene.new
46 state = chess.state.new
49 board = Board.new(scene, theme, chess, state)
52 table = Table.new(scene, board)
53 table.size = Qt::Size.new(500, 500)
55 history = History.new(state)
56 controller = Controller.new(board, history)
60 console = Console.new(nil)
63 protocol.observe :text do |text|
67 console.observe :input do |text|
71 # board.observe :new_move do |data|
73 # m = ('a'[0] + move.src.x).chr +
74 # (8 - move.src.y).to_s +
75 # ('a'[0] + move.dst.x).chr +
76 # (8 - move.dst.y).to_s
81 notify = Notify.new(table)
82 user = User.new(:white, board, notify)
83 handler = ICS::MatchHandler.new(user, protocol)
85 protocol.observe :creating_game do |data|
86 puts "CREATING GAME: #{data.inspect}"