Article #1027

既に発行済みのブログであっても適宜修正・追加することがあります。
We may make changes and additions to blogs already published.

GameFSMの改良 (7)

posted by sakurai on September 23, 2025 #1027

最後にcopyArea()等の従来関数を引数等の順番や個数を変えずに薄いラッパーで定義します。

   // 同名ラッパは _BLIT を呼ぶだけに
  function Stmt copyArea(U8 sx,U8 sy,U8 dx,U8 dy,U8 w,U8 h);
    return _BLIT(Blit{op:BLIT_COPY, sx:sx, sy:sy, dx:dx, dy:dy, w:w, h:h});
  endfunction
  function Stmt orArea(U8 sx,U8 sy,U8 dx,U8 dy,U8 w,U8 h);
    return _BLIT(Blit{op:BLIT_OR, sx:sx, sy:sy, dx:dx, dy:dy, w:w, h:h});
  endfunction
  function Stmt eraseArea(U8 dx,U8 dy,U8 w,U8 h);
    return _BLIT(Blit{op:BLIT_ERASE, sx:0, sy:0, dx:dx, dy:dy, w:w, h:h});
  endfunction
  function Stmt eraseAreaSP(U8 sx,U8 sy,U8 dx,U8 dy,U8 w,U8 h);
    return _BLIT(Blit{op:BLIT_ANDN, sx:sx, sy:sy, dx:dx, dy:dy, w:w, h:h});
  endfunction
  function Stmt getVdots(U8 x, U8 y);
      return _BLIT(Blit{ op:BLIT_VDOTS, sx:0, sy:0, dx:x, dy:y, w:0, h:0});
  endfunction
  function Stmt getHdots(U8 x, U8 y);
      return _BLIT(Blit{ op:BLIT_HDOTS, sx:0, sy:0, dx:x, dy:y, w:0, h:0});
  endfunction

以上のように、copyArea()等の6種のVRAMアクセス関数は全てFSMを起動し、終了を待つだけの関数に書き換えます。


左矢前のブログ 次のブログ右矢

Leave a Comment

Your email address will not be published.

You may use Markdown syntax. If you include an ad such as http://, it will be invalidated by our AI system.

Please enter the numbers as they are shown in the image above.