(4.1)くり返しで壁を描く
-- くり返しで壁を描く local w = platform.window.width() -- 画面の幅を取得して w に代入 local h = platform.window.height() -- 画面の高さを取得して h に代入 local sideLen = math.floor(h/25) -- 四角の 1 辺の長さを指定して sideLen に代入 local lineCount = 20 -- 四角の数を指定して lineCount に代入 local dansa = math.floor(h/lineCount) -- 段差を指定して dansa に代入 function on.paint(gc) for i = 0, (lineCount - 1) do gc:fillRect(0, -- 四角の左上隅の x 座標 i * dansa, -- 四角の左上隅の y 座標 sideLen, -- 四角の幅 sideLen) -- 四角の高さ end end
ハンドへルド・ビュー:
参考文献:
プログラムはこうして作られるプログラマの頭の中をのぞいてみよう
- 作者: 平山尚(株式会社セガ)
- 出版社/メーカー: 秀和システム
- 発売日: 2013/09/25
- メディア: 単行本
- この商品を含むブログ (5件) を見る