Windows での,cocos2d, pygame, pyglet のインストール手順をスクリーンショット等で説明する. cocos2d は、 2次元のゲーム,グラフィックス,対話型のアプリケーションを作ることができるフレームワーク. Windows, OS X, Linux で動く.
Python の URL: http://www.python.org/
インストール手順の詳細は: 別ページで説明している.
コマンドプロンプトを管理者として実行し,次のコマンドを実行.
python -m pip install -U pip setuptools python -m pip install -U jupyterlab jupyter jupyter-console jupytext spyder
参考Webページ: http://python.cocos2d.org/doc/programming_guide/installation.html の手順で行う.
python --version
python -m pip install -U pip setuptools
python -m pip install -U six msgpack pyglet pygame cocos2d
エラーメッセージが出ていないことを確認する
python -m pip show pyglet python -m pip show six python -m pip show pygame python -m pip show cocos2d
Python プログラムを動かす.
Python プログラムを動かす
※ 開発環境や Python コンソール(Jupyter Qt Console,spyder,PyCharm,PyScripter など)が便利.
import cocos
from cocos.text import Label
from cocos import scene
from cocos.layer import Layer
from cocos.director import director
class HelloWorld(Layer):
def __init__(self):
super(HelloWorld, self).__init__()
hello_world_label = Label(
"Hello World!",
font_name = "Times New Roman",
font_size = 32,
anchor_x = 'center',
anchor_y = 'center'
)
hello_world_label.position = 320, 240
self.add(hello_world_label)
director.init()
director.run(
scene.Scene(
HelloWorld()
)
)
確認したら,右上の「x」をクリックして消す.
本サイトは金子邦彦研究室のWebページです.サイトマップは,サイトマップのページをご覧下さい. 本サイト内の検索は,サイト内検索のページをご利用下さい.
問い合わせ先: 金子邦彦(かねこ くにひこ) ![]()