東方算程譚

Oriental Code Talk ── επιστημηが与太をこく、弾幕とは無縁のシロモノ。

目次

Blog 利用状況

ニュース

著作とお薦めの品々は

著作とお薦めの品々は
東方熱帯林へ。

あわせて読みたい

わんくま

  1. 東京勉強会#2
    C++/CLI カクテル・レシピ
  2. 東京勉強会#3
    template vs. generics
  3. 大阪勉強会#6
    C++むかしばなし
  4. 東京勉強会#7
    C++むかしばなし
  5. 東京勉強会#8
    STL/CLRによるGeneric Programming
  6. TechEd 2007 @YOKOHAMA
    C++・C++/CLI・C# 適材適所
  7. 東京勉強会#14
    Making of BOF
  8. 東京勉強会#15
    状態遷移
  9. 名古屋勉強会#2
    WinUnit - お気楽お手軽UnitTest

CodeZine

  1. Cで実現する「ぷちオブジェクト指向」
  2. CUnitによるテスト駆動開発
  3. SQLiteで組み込みDB体験(2007年版)
  4. C++/CLIによるCライブラリの.NET化
  5. C# 1.1からC# 3.0まで~言語仕様の進化
  6. BoostでC++0xのライブラリ「TR1」を先取りしよう (1)
  7. BoostでC++0xのライブラリ「TR1」を先取りしよう (2)
  8. BoostでC++0xのライブラリ「TR1」を先取りしよう (3)
  9. BoostでC++0xのライブラリ「TR1」を先取りしよう (4)
  10. BoostでC++0xのライブラリ「TR1」を先取りしよう (5)
  11. C/C++に対応した、もうひとつのUnitTestFramework ─ WinUnit
  12. SQLiteで"おこづかいちょう"
  13. STL/CLRツアーガイド
  14. マージ・ソート : 巨大データのソート法
  15. ヒープソートのアルゴリズム
  16. C++0xの新機能「ラムダ式」を次期Visual Studioでいち早く試す
  17. .NETでマンデルブロ集合を描く
  18. .NETでマンデルブロ集合を描く(後日談)
  19. C++/CLI : とある文字列の相互変換(コンバージョン)
  20. インテルTBBによる選択ソートの高速化
  21. インテルTBB3.0 によるパイプライン処理
  22. Visual C++ 2010に追加されたSTLアルゴリズム
  23. Visual C++ 2010に追加されたSTLコンテナ「forward_list」
  24. shared_ptrによるObserverパターンの実装
  25. .NETでマンデルブロ集合を描く(番外編) ── OpenCLで超並列コンピューティング
  26. StateパターンでCSVを読む
  27. 状態遷移表からStateパターンを自動生成する
  28. 「ソートも、サーチも、あるんだよ」~標準C++ライブラリにみるアルゴリズムの面白さ
  29. インテルTBBの同期メカニズム
  30. なぜsetを使っちゃいけないの?
  31. WPFアプリケーションで腕試し ~C++でもWPFアプリを
  32. C++11 : スレッド・ライブラリひとめぐり
  33. Google製のC++ Unit Test Framework「Google Test」を使ってみる
  34. メールでデータベースを更新するココロミ
  35. Visitorパターンで遊んでみたよ
  36. Collection 2題:「WPFにバインドできる辞書」と「重複を許す検索set」
  37. Visual C++ 2012:stateless-lambdaとSQLiteのぷち拡張
  38. 「Visual C++ Compiler November 2012 CTP」で追加された6つの新機能

@IT

  1. Vista時代のVisual C++の流儀(前編)Vista到来。既存C/C++資産の.NET化を始めよう!
  2. Vista時代のVisual C++の流儀(中編)MFCから.NETへの実践的移行計画
  3. Vista時代のVisual C++の流儀(後編) STL/CLRによるDocument/Viewアーキテクチャ
  4. C++開発者のための単体テスト入門 第1回 C++開発者の皆さん。テスト、ちゃんとしていますか?
  5. C++開発者のための単体テスト入門 第2回 C++アプリケーションの効率的なテスト手法(CppUnit編)
  6. C++開発者のための単体テスト入門 第3回 C++アプリケーションの効率的なテスト手法(NUnit編)

AWARDS


Microsoft MVP
for Visual Developer - Visual C++


Wankuma MVP
for いぢわる C++


Nyantora MVP
for こくまろ中国茶

Xbox

Links

記事カテゴリ

書庫

日記カテゴリ

パックマンの描き方

ちょっと解説。

僕のTimeTimerでは残り秒数remainを1秒毎の
タイマ・ティックでデクリメントしてます。

パックマンを描くのは Graphics.FillPieで。
Graphics.FillPie(ブラシ, 描く範囲のX,Y,幅,高さ, 開始角度, 扇の角度)
でして、扇の角度はremain一回りで3600[秒]ですからremain/10で丁度
一回りの360[度]。なので扇の角度はremain/10となります。

扇の開始角度は、X軸方向(→)を起点に時計回りに指定します。
表示上の起点は-Y軸方向(↑)ですから270度ズレてます。
さらに、remainが小さくなるほど時計回りに回すのですから符号がひっくり返ります。
そんなわけで 扇の開始角度は (270 - remain/10)[度] となるです。
扇の中心を Point center, 半径を int radius (このふたつはフォームresizeのたびに再計算)と
してますから、パックマンを描くコードは:

  // 描け! イベント
  private void pnlClock_Paint(object sender, PaintEventArgs e)
  {
      Brush brush = new SolidBrush(Color.Red); // 赤いブラシ
      Graphics g = e.Graphics; // Graphicsオブジェクト
      int theta;
      theta = 270 - (remain / 10); // 扇の開始角度
      g.FillPie(brush, // ブラシ
                center.X - radius,  center.Y - radius, // X,Y 
                radius + radius, radius + radius, // 幅, 高さ
                theta,      // 開始角度
                remain/10); // 扇の角度
      brush.Dispose();
  }

となるわけすね。
円く並んだボタンの位置決めも同様のコードで行ってます。

投稿日時 : 2008年5月15日 0:06

コメントを追加

# re: パックマンの描き方 2008/05/15 10:21 うつせみ(虚蝉)

うっ。非常に助かります。
(コードを少し拝見しましたが…。)
後で試してみたいと思います。

# mlrAcaWeXQeWs 2014/08/04 5:16 http://crorkz.com/

XWIPFN Really informative blog post.Much thanks again. Will read on...

# bDmHxxNIEcg 2014/09/06 22:56 http://superandroides.com/2014/06/tubemate-v-2-2-3

Great info and straight to the point. I am not sure if this is really the best place to ask but do you guys have any thoughts on where to employ some professional writers? Thanks in advance :)

# OgqnyoCGsB 2014/09/14 8:55 http://www.needpeep.com/

I have read a few good stuff here. Definitely value bookmarking for revisiting. I wonder how so much attempt you set to make one of these magnificent informative website.

# IRmUsofgtCpZ 2014/09/17 18:39 https://local.amazon.com/deals/B00NF3NXH6

Would you be serious about exchanging links?

# I am genuinely glad to read this web site posts which includes lots of useful information, thanks for providing these data. 2019/04/23 3:43 I am genuinely glad to read this web site posts wh

I am genuinely glad to read this web site posts which
includes lots of useful information, thanks for providing these
data.

# You really make it seem so easy with your presentation but I find this matter to be actually something which I think I would never understand. It seems too complicated and very broad for me. I'm looking forward for your next post, I'll try to get the ha 2019/06/22 9:48 You really make it seem so easy with your presenta

You really make it seem so easy with your presentation but I
find this matter to be actually something which I think I would never understand.

It seems too complicated and very broad for me. I'm looking forward for your next post, I'll try to get the hang
of it!

# Hello mates, how is all, and what you wish for to say concerning this post, in my view its actually awesome in favor of me. 2019/07/19 23:47 Hello mates, how is all, and what you wish for to

Hello mates, how is all, and what you wish for
to say concerning this post, in my view its actually awesome in favor
of me.

# Hello mates, how is all, and what you wish for to say concerning this post, in my view its actually awesome in favor of me. 2019/07/19 23:48 Hello mates, how is all, and what you wish for to

Hello mates, how is all, and what you wish for
to say concerning this post, in my view its actually awesome in favor
of me.

# Hello mates, how is all, and what you wish for to say concerning this post, in my view its actually awesome in favor of me. 2019/07/19 23:49 Hello mates, how is all, and what you wish for to

Hello mates, how is all, and what you wish for
to say concerning this post, in my view its actually awesome in favor
of me.

# Hello mates, how is all, and what you wish for to say concerning this post, in my view its actually awesome in favor of me. 2019/07/19 23:50 Hello mates, how is all, and what you wish for to

Hello mates, how is all, and what you wish for
to say concerning this post, in my view its actually awesome in favor
of me.

タイトル
名前
URL
コメント