- 追加された行はこの色です。
- 削除された行はこの色です。
*Windowsのコンパイル環境の作成 [#k73ee87c]
サンプルのシューティング(バイザライザー)を動かして動作確認をします。
その後、ガンハウンドのソースのコンパイルと実行の手順を説明します。
#author("2019-04-14T01:22:51+00:00","","")
*コンパイル環境の作成 [#k73ee87c]
gxLib2019の環境設定を行います
付属のサンプルのシューティング(Visoriser)を使って動作確認をします
・インストール方法
・トラブル対応
・その他
・DirectX11、OpenGLの動作するWindows10マシンが必要です
・メモリ8GB、Core-i7以上が推奨です
・vc2019での動作確認を行っています
・x64環境に対応しています
※ ソースコードはUTF-8で記述します
ライブラリの調査、研究報告など
http://dragon.suplex.net/
**Visual Studioをインストールする [#z34a7445]
VC2019を用意します。
[[Microsftのサイトよりダウンロード>https://visualstudio.microsoft.com/ja/downloads/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=button+cta&utm_content=download+vs2019&rr=https%3A%2F%2Fdocs.microsoft.com%2Fja-jp%2Fvisualstudio%2Fide%2Fwhats-new-visual-studio-2019%3Fview%3Dvs-2019]]
・vc2013 / vc2015 / vc2017での動作確認を行っています。
・freeglutが必要なくなりました(2017.05.30)
*手順1.インストール [#z34a7445]
VC2015を用意します。VC2013を使用する場合は「トラブル」の項目を参考にvcxprojファイルの一部を書き換えると動作させることができます。
gitリポジトリよりソース一式をダウンロード
[[https://bitbucket.org/garuruLabs/gxlib/downloads>https://bitbucket.org/garuruLabs/gxlib/downloads]]
gitLabのリポジトリからソース一式をダウンロードします
[[https://gitlab.com/garuru.software/gxlib2019]]
-ダウンロード > 「リポジトリをダウンロードする」をクリック
ダウンロードしてきたZIPファイルを都合のいいディレクトリに展開します
ダウンロードしてきたZIPファイルを都合のいいディレクトリに展開してください
**各種ライブラリをインストールする [#p801f767]
**VisualStudio2019を設定する [#u18585e6]
++platform/WindowsDesktop/gxLibWin.slnを開く
++gxLib2019のプロパティを参照
***DirectX SDKを用意する [#o3f7d637]
Windows環境ではOpenGL環境とDirectX環境を選択できます。DirectX版を使用する際はDirectX9のSDKを用意してください。
既に環境がある場合には「手順.2」に進んでください。
#ref("./01_vc2019_config.jpg",50%);
確認ポイントは以下です。すでに設定されていますが、環境と異なる場合は再設定してください
-全般 > マルチバイト文字セットを使用する
-全般 > WindowsSDK 10.0 (動作確認済みは10.0.177633.0)
-全般 > プラットフォームツールセット > ( Visual Studio2019 v142)
-デバッグ > 作業ディレクトリ > $(ProjectDir)\..\..\
-VC++ディレクトリ >
-- ..\..\;inc\;
-- ..\..\game\;
-C/C++ > コマンドライン > 追加のオプション > /source-charset:utf-8
-- ソースコードはUTF-8で記述します
[手順]
[[DirectXSDK(Microsoft DirectX SDK (August 2009))のダウンロード>https://www.microsoft.com/en-us/download/details.aspx?id=23549]]
*フォルダ構成 [#g7320922]
[[gxLib2019のフォルダ構成]]を参照ください
ダウンロード後、インストールを行いインストールしたSDKのincludeとLibフォルダにパスを設定するか
もしくは、インストール後のファイルをgxLibの以下のフォルダへコピーします。
Microsoft DirectX SDK (August 2009)/Include/*.*
↓ ここにコピーする
gxLib/platform/Windows/Include/directx9/*.*
Microsoft DirectX SDK (August 2009)/Lib/*.*
↓ ここにコピーする
gxLib/platform/Windows/lib/directx9/*.*
※上記のフォルダにはgxLibのプロジェクト設定(*.vcxproj)で最初からパスを通しています。
*コンパイル [#t3994782]
ビルド > ソリューションのリビルド から全コンパイルを行います
#ref("./02_vc2019_config.jpg",100%);
- プラットフォームはx64に設定します
- Debug / Release で動作確認しています
フォルダ構成はこうなります。
gxLib/platform/Windows/include/directx9/audiodefs.h
~
gxLib/platform/Windows/include/directx9/xnamathvector.inl
**コンパイルエラーが起きたとき [#b6b4fd62]
「ツール > ツールと機能を取得」から以下を取得してください
#ref("./03_vc2019_config.jpg",100%);
-ユニバーサルWindowsプラットフォーム開発
-C++によるゲーム開発
gxLib/platform/Windows/lib/directx9/x64
gxLib/platform/Windows/lib/directx9/x86
*** プラットフォームツールセット VisualStudio2019 v142が見つからない場合 [#he4e5364]
VisualStudio2017をインストールしていると「ツール>ツールと機能を取得」で開かれる「インストールの詳細」画面がVisualStudio2017用の画面が開いてしまうようです。ですので、インストールの詳細画面を閉じてVisualStudioのバージョン選択画面にもどってVisualStudio2019を選択してください。
***OpenCV [#n9585f73]
http://opencv.org/wp-content/themes/opencv/images/logo.png
Windows環境で動画の再生に「OpenCV」を利用します。以下よりver3.1以降を取得してください。(2.4.x系は未検証)
#ref("./vcSelecter.jpg",100%);
[[http://opencv.org/>http://opencv.org/]]
※DOWNLOADS > VERSION 3.1 > OpenCV for Windows
正しく選択できるとVisualStudio2019用の追加機能の選択ができるようになります。
#ref("./vc142.jpg",100%);
openCVのヘッダーファイル群を以下に配置します
※platform/windows/include/フォルダも作成してください
platform/windows/include/openCV/opencv
platform/windows/include/openCV/opencv2
**Visoriserを有効にします [#t96b241e]
game/gameMain.cppを編集してVisorizerのコメントを外してください
visoriserはCの標準関数のみで構成されており、ファイル読み込み、描画、サウンドはgxLibで機能する3つの関数でラップされたポータブルなプログラムとなっており、マルチプラットフォームにおけるプログラムの書き方の参考になるでしょう。
runフォルダに以下の3つのDLLを配置してください。
run/opencv_ffmpeg310_64.dll
run/opencv_world310.dll
run/opencv_world310d.dll
***oggVorbis [#a3437411]
http://xiph.org/images/logos/fish_xiph_org.png
Windows環境で圧縮音楽の再生に「ogg Vorvis」を使用します
[[http://xiph.org/downloads/>http://xiph.org/downloads/]]から以下のファイルをダウンロードして下さい。
libogg(1.3.2) libogg-1.3.2.zip
libvorbis(1.3.5) libvorbis-1.3.5.zip
oggVorbisのヘッダーファイル群を以下に配置します
platform/Windows/include/vorbis
platform/Windows/include/ogg
LibOgg / LibVorbis / LibVorbisFileについてそれぞれstaticLibraryを生成します。
libvorbis-1.3.5/win32/VS2010/vorbis_static.slnを起ち上げて
libvorbis_staticプロジェクトをビルドします。
&ref("./libVorbisStatic.PNG",50%);
ここで生成されたlibファイルはdebug/Release、x86/x64環境に併せて適宜ファイル名を付け替え、下記に配置してください。
・x86/x64コンパイルに応じて末尾に「_x86」「_64」を付加します。
・Release/Debugに応じて、頭に「d_」「r_」を付加。
・debugコンパイル版は「debug」フォルダに格納する。
正しい配置は以下となります。
platfor/Windows/lib
├─oggVorbis
│ │ r_libogg_static_x64.lib
│ │ r_libogg_static_x86.lib
│ │ r_libvorbisfile_static_x64.lib
│ │ r_libvorbisfile_static_x86.lib
│ │ r_libvorbis_static_x64.lib
│ │ r_libvorbis_static_x86.lib
│ │
│ └─debug
│ ├─x64
│ │ d_libogg_static_x64.lib
│ │ d_libvorbisfile_static_x64.lib
│ │ d_libvorbis_static_x64.lib
│ │
│ └─x86
│ d_libogg_static_x86.lib
│ d_libvorbisfile_static_x86.lib
│ d_libvorbis_static_x86.lib
***DLLの配置 [#x38aa909]
実行時に必要になるopenCVのDLLをexeファイルと同じ階層に格納します
run/opencv_ffmpeg310_64.dll
run/opencv_world310.dll
run/opencv_world310d.dll
run/opencv_ffmpeg310_64.dll
run/opencv_world310.dll
run/opencv_world310d.dll
***ライブラリファイルの配置 [#f05719b2]
各種ライブラリファイルそれぞれパスの通った場所へインストールを
行いますが、gxLibフォルダの以下の配置でも自動的に認識可能です。
platform/windows/lib
│
├─directx9
│ ├─x64
│ │ d2d1.lib
│ │ d3d10.lib
│ │ d3d10_1.lib
│ │ d3d11.lib
│ │ d3d9.lib
│ │ d3dcompiler.lib
│ │ D3DCSX.lib
│ │ D3DCSXd.lib
│ │ d3dx10.lib
│ │ d3dx10d.lib
│ │ d3dx11.lib
│ │ d3dx11d.lib
│ │ d3dx9.lib
│ │ d3dx9d.lib
│ │ d3dxof.lib
│ │ dinput8.lib
│ │ dsound.lib
│ │ dwrite.lib
│ │ DxErr.lib
│ │ dxgi.lib
│ │ dxguid.lib
│ │ X3DAudio.lib
│ │ xapobase.lib
│ │ xapobased.lib
│ │ XAPOFX.lib
│ │ XInput.lib
│ │
│ └─x86
│ d2d1.lib
│ d3d10.lib
│ d3d10_1.lib
│ d3d11.lib
│ d3d9.lib
│ d3dcompiler.lib
│ D3DCSX.lib
│ D3DCSXd.lib
│ d3dx10.lib
│ d3dx10d.lib
│ d3dx11.lib
│ d3dx11d.lib
│ d3dx9.lib
│ d3dx9d.lib
│ d3dxof.lib
│ dinput8.lib
│ dsetup.lib
│ dsound.lib
│ dwrite.lib
│ DxErr.lib
│ dxgi.lib
│ dxguid.lib
│ X3DAudio.lib
│ xapobase.lib
│ xapobased.lib
│ XAPOFX.lib
│ XInput.lib
│
├─oggVorbis
│ │ r_libogg_static_x64.lib
│ │ r_libogg_static_x86.lib
│ │ r_libvorbisfile_static_x64.lib
│ │ r_libvorbisfile_static_x86.lib
│ │ r_libvorbis_static_x64.lib
│ │ r_libvorbis_static_x86.lib
│ │
│ └─debug
│ ├─x64
│ │ d_libogg_static_x64.lib
│ │ d_libvorbisfile_static_x64.lib
│ │ d_libvorbis_static_x64.lib
│ │
│ └─x86
│ d_libogg_static_x86.lib
│ d_libvorbisfile_static_x86.lib
│ d_libvorbis_static_x86.lib
│
└─openCV
opencv_world310.lib
opencv_world310d.lib
**手順2.コンパイルして実行する [#u9f691b0]
gxLib.slnファイルからプロジェクトを起動する
F5キーで実行し、VISORISERが起動することを確認してください
&ref("./visor.png",100%");
**手順3.ガンハウンドのソースをコンパイルして実行する [#u9f691b0]
-ガンハウンドのソースをダウンロード
ダウンロードしてきたgunhoundフォルダを配置します
src/gunhound
src/gunvalken.h
-プロジェクトへ追加
src/gunhound、src/gunvalken.hをVCのソリューションエクスプローラーのSource Filesにドラッグ&ドロップして登録してください
#ref("./vc01.png",50%);
-ライブラリにhitManagerの機能を追加します
ファイルをソリューションエクスプローラーに追加してください
gxLib/util/hitManager/CCollisionManager.h
gxLib/util/hitManager/CCollisionManager.cpp
#ref("./vc02.png",50%);
-ゲームプログラムの呼び出し
src/gameMain.cpp
gxBool GameMain()
{
gxBool GunHoundMain(gxBool bReset);
GunHoundMain( gxFalse );
//対戦格闘 / p2p /
//gameSikaku(gxFalse);
//Primitive Test
//BenchMark();
//Sprite Test
Visorizer( gxFalse );
return gxTrue;
}
#ref("./visor.png",100%);
gxLib.h 29行目
#define WINDOW_W (480)
#define WINDOW_H (272)
*VisualStudio2019で気をつけること [#ycb11c30]
***includeパスが通らない。VisualStudio2017では通っていたのに。。。 [#j4eb9b0f]
設定が厳密になっているようです。いままでデフォルトでプロジェクト相対で設定できていた(vcxprojがあるフォルダを起点とできていた)ものがちゃんと$(ProjectDir)を記述する必要があるようです。
*トラブル対応 [#h7dd7e0f]
***OpenGLに切り替えるには? [#q6970f24]
以下の定義を切り替えます。
gxLib.h
#define PLATFORM_WIN32_DIRECTX9
//#define PLATFORM_WIN32_OPENGL
↓
//#define PLATFORM_WIN32_DIRECTX9
#define PLATFORM_WIN32_OPENGL
***vorbis/vorbisfile.h No such file or directry [#hb3286bb]
ogg vorbisのヘッダーファイルが見つかっていません。ヘッダーファイルを格納した場所へのパス設定を見なおしてみてください。gxLibのデフォルトでは下記の2箇所に格納されれば自動的に認識します
platform/windows/include/ogg/
platform/windows/include/vorbis/
***opencv/opencv.hpp No such file or directry [#y081ccd0]
同じくopencvのヘッダーが見つかっていません。「platform/windows/include/openCV/」に以下の2つのフォルダを配置してください。
platform/windows/include/openCV/opencv
platform/windows/include/openCV/opencv2
*** 構文エラー : 識別子 'D3DMULTISAMPLE_TYPE [#u32e131d]
DirectXのSDKが入っていないか、SDKのフォルダへパスが通ってない可能性があります
gxLibでは以下に配置すると自動的にコンパイル対象に追加されます
platform/windows/include/openCV/directx9
***VC2013を使ってコンパイルする [#fece13c9]
SDKのバージョン番号が異なる場合コンパイル時にエラーが出力されるので適切なバージョン番号に設定してください。
platform/Windows/DirectX.vcxproj
platform/Windows/OpenGL.vcxproj
<PlatformToolset>v140</PlatformToolset>
<IncludePath>include</IncludePath>
↓
<PlatformToolset>v120</PlatformToolset>
<IncludePath>$(ProjectDir)\include</IncludePath>
*その他 [#sd67a4eb]
***includeファイルの構成 [#dc33a262]
platform/windows/include
│
├─directx9
│ audiodefs.h
│ comdecl.h
│ D2D1.h
│ D2D1Helper.h
│ D2DBaseTypes.h
│ D2Derr.h
│ D3D10.h
│ D3D10effect.h
│ d3d10misc.h
│ d3d10sdklayers.h
│ D3D10shader.h
│ D3D10_1.h
│ D3D10_1shader.h
│ D3D11.h
│ D3D11SDKLayers.h
│ D3D11Shader.h
│ d3d9.h
│ d3d9caps.h
│ d3d9types.h
│ D3Dcommon.h
│ D3Dcompiler.h
│ D3DCSX.h
│ D3DX10.h
│ d3dx10async.h
│ D3DX10core.h
│ D3DX10math.h
│ D3DX10math.inl
│ D3DX10mesh.h
│ D3DX10tex.h
│ D3DX11.h
│ D3DX11async.h
│ D3DX11core.h
│ D3DX11tex.h
│ d3dx9.h
│ d3dx9anim.h
│ d3dx9core.h
│ d3dx9effect.h
│ d3dx9math.h
│ d3dx9math.inl
│ d3dx9mesh.h
│ d3dx9shader.h
│ d3dx9shape.h
│ d3dx9tex.h
│ d3dx9xof.h
│ D3DX_DXGIFormatConvert.inl
│ Dcommon.h
│ dinput.h
│ dinputd.h
│ dsconf.h
│ dsetup.h
│ dsound.h
│ DWrite.h
│ dxdiag.h
│ DxErr.h
│ dxfile.h
│ DXGI.h
│ DXGIFormat.h
│ DXGIType.h
│ dxsdkver.h
│ gameux.h
│ PIXPlugin.h
│ rmxfguid.h
│ rmxftmpl.h
│ rpcsal.h
│ X3DAudio.h
│ xact3.h
│ xact3d3.h
│ xact3wb.h
│ XAPO.h
│ XAPOBase.h
│ XAPOFX.h
│ XAudio2.h
│ XAudio2fx.h
│ XDSP.h
│ XInput.h
│ xma2defs.h
│ xnamath.h
│ xnamathconvert.inl
│ xnamathmatrix.inl
│ xnamathmisc.inl
│ xnamathvector.inl
│
├─ogg
│ ogg.h
│ os_types.h
│
├─openCV
│ ├─opencv
│ │ cv.h
│ │ cv.hpp
│ │ cvaux.h
│ │ cvaux.hpp
│ │ cvwimage.h
│ │ cxcore.h
│ │ cxcore.hpp
│ │ cxeigen.hpp
│ │ cxmisc.h
│ │ highgui.h
│ │ ml.h
│ │
│ └─opencv2
│ │ calib3d.hpp
│ │ core.hpp
│ │ cvconfig.h
│ │ features2d.hpp
│ │ flann.hpp
│ │ highgui.hpp
│ │ imgcodecs.hpp
│ │ imgproc.hpp
│ │ ml.hpp
│ │ objdetect.hpp
│ │ opencv.hpp
│ │ opencv_modules.hpp
│ │ photo.hpp
│ │ shape.hpp
│ │ stitching.hpp
│ │ superres.hpp
│ │ video.hpp
│ │ videoio.hpp
│ │ videostab.hpp
│ │ world.hpp
│ │
│ ├─calib3d
│ │ calib3d.hpp
│ │ calib3d_c.h
│ │
│ ├─core
│ │ │ affine.hpp
│ │ │ base.hpp
│ │ │ bufferpool.hpp
│ │ │ core.hpp
│ │ │ core_c.h
│ │ │ cuda.hpp
│ │ │ cuda.inl.hpp
│ │ │ cuda_stream_accessor.hpp
│ │ │ cuda_types.hpp
│ │ │ cvdef.h
│ │ │ cvstd.hpp
│ │ │ cvstd.inl.hpp
│ │ │ directx.hpp
│ │ │ eigen.hpp
│ │ │ fast_math.hpp
│ │ │ ippasync.hpp
│ │ │ mat.hpp
│ │ │ mat.inl.hpp
│ │ │ matx.hpp
│ │ │ neon_utils.hpp
│ │ │ ocl.hpp
│ │ │ ocl_genbase.hpp
│ │ │ opengl.hpp
│ │ │ operations.hpp
│ │ │ optim.hpp
│ │ │ persistence.hpp
│ │ │ private.cuda.hpp
│ │ │ private.hpp
│ │ │ ptr.inl.hpp
│ │ │ saturate.hpp
│ │ │ sse_utils.hpp
│ │ │ traits.hpp
│ │ │ types.hpp
│ │ │ types_c.h
│ │ │ utility.hpp
│ │ │ va_intel.hpp
│ │ │ version.hpp
│ │ │ wimage.hpp
│ │ │
│ │ └─hal
│ │ hal.hpp
│ │ interface.h
│ │ intrin.hpp
│ │ intrin_cpp.hpp
│ │ intrin_neon.hpp
│ │ intrin_sse.hpp
│ │
│ ├─features2d
│ │ features2d.hpp
│ │
│ ├─flann
│ │ allocator.h
│ │ all_indices.h
│ │ any.h
│ │ autotuned_index.h
│ │ composite_index.h
│ │ config.h
│ │ defines.h
│ │ dist.h
│ │ dummy.h
│ │ dynamic_bitset.h
│ │ flann.hpp
│ │ flann_base.hpp
│ │ general.h
│ │ ground_truth.h
│ │ hdf5.h
│ │ heap.h
│ │ hierarchical_clustering_index.h
│ │ index_testing.h
│ │ kdtree_index.h
│ │ kdtree_single_index.h
│ │ kmeans_index.h
│ │ linear_index.h
│ │ logger.h
│ │ lsh_index.h
│ │ lsh_table.h
│ │ matrix.h
│ │ miniflann.hpp
│ │ nn_index.h
│ │ object_factory.h
│ │ params.h
│ │ random.h
│ │ result_set.h
│ │ sampling.h
│ │ saving.h
│ │ simplex_downhill.h
│ │ timer.h
│ │
│ ├─highgui
│ │ highgui.hpp
│ │ highgui_c.h
│ │
│ ├─imgcodecs
│ │ imgcodecs.hpp
│ │ imgcodecs_c.h
│ │ ios.h
│ │
│ ├─imgproc
│ │ │ imgproc.hpp
│ │ │ imgproc_c.h
│ │ │ types_c.h
│ │ │
│ │ └─detail
│ │ distortion_model.hpp
│ │
│ ├─ml
│ │ ml.hpp
│ │
│ ├─objdetect
│ │ detection_based_tracker.hpp
│ │ objdetect.hpp
│ │ objdetect_c.h
│ │
│ ├─photo
│ │ cuda.hpp
│ │ photo.hpp
│ │ photo_c.h
│ │
│ ├─shape
│ │ emdL1.hpp
│ │ hist_cost.hpp
│ │ shape.hpp
│ │ shape_distance.hpp
│ │ shape_transformer.hpp
│ │
│ ├─stitching
│ │ │ warpers.hpp
│ │ │
│ │ └─detail
│ │ autocalib.hpp
│ │ blenders.hpp
│ │ camera.hpp
│ │ exposure_compensate.hpp
│ │ matchers.hpp
│ │ motion_estimators.hpp
│ │ seam_finders.hpp
│ │ timelapsers.hpp
│ │ util.hpp
│ │ util_inl.hpp
│ │ warpers.hpp
│ │ warpers_inl.hpp
│ │
│ ├─superres
│ │ optical_flow.hpp
│ │
│ ├─video
│ │ background_segm.hpp
│ │ tracking.hpp
│ │ tracking_c.h
│ │ video.hpp
│ │
│ ├─videoio
│ │ cap_ios.h
│ │ videoio.hpp
│ │ videoio_c.h
│ │
│ └─videostab
│ deblurring.hpp
│ fast_marching.hpp
│ fast_marching_inl.hpp
│ frame_source.hpp
│ global_motion.hpp
│ inpainting.hpp
│ log.hpp
│ motion_core.hpp
│ motion_stabilizing.hpp
│ optical_flow.hpp
│ outlier_rejection.hpp
│ ring_buffer.hpp
│ stabilizer.hpp
│ wobble_suppression.hpp
│
└─vorbis
codec.h
vorbisenc.h
vorbisfile.h
**Android Studioでコンパイル [#he6e360b]
- Android端末をWindowsPCと接続する
- AndroidStudioを起動する
- Open an Existing Android Studio Projectを選択
- Platform/Androidを選択してプロジェクトを立ち上げる
***LUAを利用する [#z7a9dba5]
**コンパイル [#vfdf67e1]
- 起動後自動的にMakeが始まる
- 自分でMakeするときはBuild > MakeProjectからMakeする
- プログラムのコンパイルは Buile > Rebuild Projectから行う
- 実行は Run > Debug Appから行う
***Cocos2Dxを利用する [#o2b27621]
***zLibを利用したpngファイルの使用 [#u2f40b6f]