pygletでフルスクリーン表示等をするサンプル

編集履歴

  • 2013/05/13更新


概要

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

  • BG2枚を描画

  • 64x64ドット x 512枚のスプライトを描画

  • oggをループ再生

  • ウインドウ/フルスクリーン表示の切り替え

  • ジョイスティックの読み取り


Screenshot

動作確認環境

  • Windows7 x64 (+ GeForce 9800GTGE)

  • Python 2.6.6 32bit

  • pyglet 1.2 alpha 1


受け付けるキー

  • 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)では変な描画になった。


ソース・画像一式

fullscrpyglet_20130513.zip


exe化手順

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


exe化の際の注意事項。


--- 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: