PPC external works fine in the demo stack, but crashes if I copy it to another stack
Kevin Calhoun's answer :
The problem is intrinsic to code fragments contained within resources, not just HyperCard externals. Here's what's happening:
- The code fragment is loaded into memory via GetResource (or equivalent)
- The fragment is prepared for execution by the Code Fragment Manager
- In preparing it for execution, pointers to its external links are written into its TOC; this accounts for the differences you're seeing
- The resource is then copied from in the form in which is currently exists in memory, containing pointers to addresses to its external links that are valid in the current context, but almost certainly invalid on any other machine
Note that anything that copies an xcmd or xfcn resource that has been loaded into memory and prepared for execution will exhibit this problem -- ResCopy, the resource externals that ship with HyperCard, the AddColor installer, the resource copying XCMD in the Dartmouth XCMDs, etc. The problem doesn't occur with ResEdit because in ResEdit you're copying the resource out of a stack that isn't open in HyperCard and therefore whose externals aren't currently in memory and prepared for execution by the CFM.
僕はゲームのメインループに次のようなコードを仕込んだものだ。
put the ticks into t
--処理1
add the ticks - t to item 1 of tt
put the ticks into t
--処理2
add the ticks - t to item 2 of tt
put the ticks into t
--処理3
add the ticks - t to item 3 of tt
put tt into msg
PgColorX2.31新機能(予定)
○suite機能(すいーと きのう)
PgColorX "SetSuite",3,1,cd fld "data"
PgColorX "DrawSuite","cd",3
cd fld "data"に書かれたデータを保存して、一発で描画できます。
データは以下のようなもの
「"Paint",,"#ffff00","0,0,64,64"
"CopyBits",1,,"0,0,32,32",rect of cd btn 1
"Cicn",,"cicn1","rect of cd btn 2"」
rect of cd btn 1だと、SetSuiteした時のrectになりますが、
"rect of cd btn 1"のようにすればDrawSuiteした時のrectになります。
これでボタンが移動してもばっちり追従するようにできます。
> 「HyperCard高速化」を読んでいで、中に
> 「send mouseUp to cd btn 〜より、send "mouseUp" to cd btn 〜とダブルクォートでくくったほうがほんの少し速い」
> とあったのですが、実験してみたところ特に違いはありませんでした。
> あと、ホームページの「中途半端ズ」や「FFN関西人化」など一部のファイルががこちらだとダウンロード出来ません。
on mouseUp
get the ticks
repeat 10000
send mouseDown to me
end repeat
put the ticks - it
end mouseUp