testsprite.boo

http://shinh.skr.jp/misc/dat_dir/testsprite.boo

Boo がなかなか良さそうだなあと思ったので触ってみることにします。目指せ負け組脱出。とりあえず C の 55% くらいの速度は出てる感じ。

Events.KeyboardDown += def (sender, e as KeyboardEventArgs):
    if e.Key == Key.Escape:
        quit = true
Events.Quit += def (sender, e):
    quit = true

基本的に普通のコードだけど、このへんがハイライトだろうか。くろーじゃ。

  • おーおー
  • くろーじゃ
  • じぇねれーた
  • くろすぷらっと
  • かたしょうりゃく
  • ねいてぃぶばいなり

ゲームを作れと言わんばかり。 マクロ もなんか面白そう。

以下は作業記録とか。この Boo というタグを見なくなったら飽きたということです。

hello.boo

i@u ~/test/boo> cat hello.boo
print "hello world"
print 'hello world'
i@u ~/test/boo> booi hello.boo
hello world
hello world

文字列リテラルはどっちでもいいのかなというかこれで改行入った。

i@u ~/test/boo> booc hello.boo
i@u ~/test/boo> mono ./hello.exe
hello world
hello world

コンパイルもできるな。

conditions

i@u ~/test/boo> cat cond.boo
x = 0
if x == 1:
    print "x == 1"
else:
    print "x != 1"
i@u ~/test/boo> booi cond.boo
x != 1
i@u ~/test/boo> cat cond.boo
if x == 1:
    print "x == 1"
else:
    print "x != 1"
i@u ~/test/boo> booi cond.boo
cond.boo(1,4): BCE0005: Boo.Lang.Compiler.CompilerError: Unknown identifier: 'x'.

普通。

i@u ~/test/boo> cat cond.boo
x = 0
if x == 1 or x == 0:
    print "x == 1 or 0"
else:
    print "other"
i@u ~/test/boo> booi cond.boo
x == 1 or 0
i@u ~/test/boo> cat cond.boo
x = 0
if x == 1 || x == 0:
    print "x == 1 or 0"
else:
    print "other"
i@u ~/test/boo> booi cond.boo
cond.boo(2,12): BCE0043: Boo.Lang.Compiler.CompilerError: Unexpected token: |. ---> cond.boo:2:12: unexpected token: ["|",<91>,line=2,col=12]--- End of inner exception stack trace ---

なんか and とか or とか not なのね。

loop

あと for と while と continue と break があるらしい。そういう普通なのはいいや。

pass ってのが異様。

i@u ~/test/boo> cat pass.boo
while false:
print "end"
i@u ~/test/boo> booi pass.boo
pass.boo(2,1): BCE0044: Boo.Lang.Compiler.CompilerError: 'expecting "INDENT", found '<EOS>''. ---> pass.boo:2:1: expecting "INDENT", found '<EOS>'--- End of inner exception stack trace ---


i@u ~/test/boo> cat pass.boo
while false:
    pass
print "end"
i@u ~/test/boo> booi pass.boo
end

要は nop だ。カラの文が無いとかまぁそんなこんなな話か。

compiling...

nant-0.85-rc3 を make 。途中で止まったが bootstrap とやらができれば十分ぽいので気にしない。

i@u ~/bin> cat nant
#!/bin/sh
exec mono ~/src/nant-0.85-rc3/bootstrap/NAnt.exe $@

boo-0.7.5.2013 を nant 。 default.build をいじって optimize を true に。んで nant すると途中で止まったけど Boo.Lang.dll はできたから気にしない。

sdldotnet-4.0.3-1 を nant buildrelease 。なんかこれはちゃんとできたぽい。 SdlDotNet.dll と Tao.Sdl.dll ができればオッケイ。 Tao.Sdl.dll の方が単純な SDL ラッパ。 API 覚えるのめんどいからこっちだけでいいかも。

あと SDL.dll とか SDL_image.dll が無いって怒られたから適当に /usr/local/lib/libSDL.so とかを libSDL.dll.so にシンボリックリンクでゴマかす。

なにかあれば下記メールアドレスへ。
shinichiro.hamaji _at_ gmail.com
shinichiro.h