Upgrade to Pro — share decks privately, control downloads, hide ads and more …

xojoでコールバックとかスレッドとかアニメーションとかを
ゆるーく使える
「Nekonote...

yuki
March 12, 2016

 xojoでコールバックとかスレッドとかアニメーションとかを
ゆるーく使える
「Nekonote」
のおはなし

開発環境&言語のXojoでコールバックとかスレッドとかアニメーションとかを楽に扱えるライブラリ「Nekonote(ネコノテ)」の解説です。

yuki

March 12, 2016
Tweet

More Decks by yuki

Other Decks in Programming

Transcript

  1. ճ౴1ɿૉ௚ʹॻ͘ Sub MouseUp Window1.Rect1.FillColor = બ୒৭ ͜͜ͷ৭΋มΘΔ Dim Cp as

    New ColorPalette Cp.Show 汎用性?何それおいしいの?
  2. ճ౴2ɿίϯτϩʔϧΛ౉͢ Sub MouseUp TargetView.FillColor = બ୒৭ ౉ͨ͠Rectangleͷ FillColor͕มΘΔ Dim Cp

    as New ColorPalette Cp.ShowWithView(Self.Rect1) Rectangle以外は渡せないの?
  3. ճ౴3ɿ΍ͬͺRectҎ֎ͷ৭΋ม͍͑ͨΑͶ Sub MouseUp TargetView.ChangeColor બ୒৭ Dim Cp as New ColorPalette

    Cp.ShowWithView(Self.Rect1) Sub ChangeColor(C as Color) Self.BackColor = C できたけど、Rectangleいらなくない?
  4. ճ౴4ɿDelegateͯ͠ΈΔ ࢦఆ͞ΕͨϝιουʹॲཧΛҕৡ Sub MouseUp OnColorChange.Invoke(બ୒৭) DelegateʹϝιουΛࢦఆͯ͠ Dim Cp as New

    ColorPalette Cp.OnColorChanged = AddressOf ChangeColor Cp.Show ༧Ίϝιου͝ͱʹద੾ͳ DelegateΛఆ͓ٛͯ͘͠ Delegateʹ߹Θͤͨҕৡઌ ϝιουΛఆ͓ٛͯ͘͠ 正解っぽいけど、面倒かも 難しい><
  5. ύϥϝʔλΛࢦఆ͢Δ Variantܕ഑ྻ Dim CB as New NekoCallback(Me,"ChangeColor",ParamArray) Dim ParamArray(-1) as

    Variant ParamArray.Append 3 ParamArray.Append 2 Dim CB as New NekoCallback(Me,"AddNum",ParamArray) ྫ
  6. ݁ՌΛड͚औΔ Variantܕ Dim Result as Variant = CB.ReturnValue Dim ParamArray(-1)

    as Variant ParamArray.Append 3 ParamArray.Append 2 Dim CB as New NekoCallback(Me,”AddNum",ParamArray) Dim Ans as Integer = CB.ReturnValue.IntegerValue //ଟ෼5 ྫ
  7. ࢀরΛڧ੍͢Δ TrueʢσϑΥϧτʣ …ऑࢀর False …ڧ͍ʢ௨ৗͷʣࢀর Dim CB as New NekoCallback(Me,”ChangeColor",ParamArray,IsWeak)

    Dim CB as New NekoCallback(AnObj,”AddNum”,Nil) AnObj = Nil //΋͠ଞ͔Βͷࢀর͕ͳ͍ͳΒ CB.Execute() //Կ΋ݺ͹Εͳ͍ ྫ ͜ΕΛऑࢀরʹ͢Δ͔ڧ͍ ʢ௨ৗͷʣࢀরʹ͢Δ͔ Dim CB as New NekoCallback(AnObj,”AddNum”,Nil,False) AnObj = Nil CB.Execute() //ݺ͹ΕΔ ྫ
  8. ஋͕มΘͬͨͱ͖ʹԿ͔͢Δ Dim Tw as NekoTween = NekoTweenContainer.Default.TweenFor(Self,"Score") Tw.OnUpdate = New

    NekoCallback(Self,"ShowScore") Tw.StartTween(Score , Score + 1000 , 500) ஋͕มΘΔͨͼʹShowScore()Λ࣮ߦ