「pygletでフルスクリーン表示等をするサンプル」の編集履歴(バックアップ)一覧に戻る

pygletでフルスクリーン表示等をするサンプル - (2013/05/13 (月) 21:00:17) のソース

2013/05/13更新。

[[fullscrpyglet.pyソースコード表示]]

[[fullscrpyglet.py用のsetup.py]]

[[fullscrpyglet.py用のmkexe.bat]]


** 概要
fullscrpyglet.py ... フルスクリーン表示のテスト

- BG2枚を描画
- 64x64ドット x 512枚のスプライトを描画
- oggをループ再生
- ウインドウ/フルスクリーン表示の切り替え

*** 受け付けるキー
- F2 : ウインドウ/フルスクリーン表示の切り替え
- F3 : スプライト表示のON/OFF
- F4 : FPS表示(大)のON/OFF
- F5 : バッチ描画のON/OFF
- F6 : vsyncの有効/無効
- カーソルキー : スプライトの移動
- マウスクリック : スプライトの移動
- マウスドラッグ : スプライトの移動
- ジョイスティック : スプライトの移動・表示の拡大等(ボタン0-3を反映)

** 実行の仕方
dist/fullscrpyglet.exe を実行

** 問題点
ビデオカード・ビデオチップに ATI (AMD) Radeon を使っている環境では、正常な描画が行われない。Radeon HD4200 (AMD 785G)では異常な描画になった。

** 動作確認環境
- Windows7 x64 (+ GeForce 9800GTGE)
- Python 2.6.6
- pyglet 1.2 alpha 1

** exe化手順
mkexe.bat 内の各種パスを自分の環境に合わせて修正した上で、mkexe.bat を実行。

*** exe化の際の注意事項。
- avbin.dll が必要。C:/Python26/Lib/site-packages/pyglet/media/avbin.dll あたりからコピーしてくる。
- pyglet/lib.py の修正が必要。C:/Python26/Lib/site-packages/pyglet/lib.py を修正。

#highlight(txt){{
--- lib.py.old	Mon Jun 18 17:38:02 2012
+++ lib.py.new	Mon May 13 08:34:50 2013
@@ -115,9 +115,12 @@
                     lib = _TraceLibrary(lib)
                 return lib
             except OSError, o:
-                if ((self.linux_not_found_error not in o.message) and
-                    (self.darwin_not_found_error not in o.message)):
-                    print "Unexpected error loading library %s: %s" % (name, o.message)
+                if ((self.platform == "win32" and o.winerror != 126) or
+                    (self.platform.startswith("linux") and
+                     self.linux_not_found_error not in o.args[0]) or
+                    (self.platform == "darwin" and
+                     self.darwin_not_found_error not in o.args[0])):
+                    print "Unexpected error loading library %s: %s" % (name, str(o))
                     raise
                 path = self.find_library(name)
                 if path:
}}