Build DirectX 9.0c samples

[Last updated: 12/09/2021]

This page describes how to compile the DirectX 9.0c sample project included in the Live2D Cubism SDK for Native with Visual Studio in a Windows environment.

* The content of this article is based on the Cubism 4 SDK for Native R1.
The method and procedure may differ depending on the version of Cubism SDK. 

 

What to download

Live2D Cubism SDK for Native

The main body of the SDK. Download from the official download page.

Visual Studio

This is the development environment that will be used in this project. The language will be C++.

CMake

Used to generate project files.

DirectX SDK

DirectX 9.0c development kit.

For CMake and libraries,
check the instructions and version in 'README.md' located in “[root]Samples/D3D9” in sample SDK in the Zip.

 

Installation process

Visual Studio

Install the integrated development environment.
Set up the system so that C++ can compile.
Also, please use Visual Studio 2013 or later.

 

CMake

Install CMake.
CMake work is used from a batch file, so the CMake path setting should be set so that it can be referenced by the user who will use it.

* Images may differ from the actual screen. 

 

DirectX SDK

Install DirectX SDK.

If you encounter S1023 error during installation, please refer to the official Microsoft support technical information for installation.

 

 

Execution of CMake

CMake can also be used from the GUI, but this time we will use the batch file included in the sample.
The batch file can be found in “Samples/D3D9/Demo/proj.d3d9.cmake/scripts”.
This batch file selects from several combinations of settings.

• NMake or Project

NMake builds from the command prompt and generates an executable file; use a batch file starting with nmake_.
Use batch files starting with proj_ when editing code, etc. from Visual Studio.

• Version of Visual Studio

Please select the version of Visual Studio you have installed.

 

In our example, we will run “proj_msvc2015.bat” to select the project containing the Visual Studio 2015 solution file.

When executed, choices will be displayed as shown in the image below, so enter the corresponding number in single-byte numbers.

• Selecting an Architecture

Select x86(Win32) or x64(Win64).
Select as appropriate depending on the environment in which it is used.

• Module Selection for Cubism Core

Select the Cubism Core runtime library to be used.
Please refer to the official Microsoft documentation for the meanings of MD, MT, etc.

• Selection of project content

Select the contents of the project to be generated.
If you select Full Demo: A sample project will be generated that utilizes all the features of Cubism SDK for Native.
If you select Minimum Demo: A minimally configured project is generated that displays a model that repeats a single motion. The following features are used in this project.

  • Load and display Cubism models
  • Ability to loop a single motion
  • Eye tracking by mouse dragging
  • Physics
  • Breath
  • Pose

If the input is successful, CMake generation will begin.
* If an error occurs after the generation starts, please check the version of CMake and the version of Visual Studio you are specifying.

 

Build

When CMake generation is finished, open the solution file from the generated files.
In this example, execute
• proj_msvc2015.bat

and select
• x64(Win64)
• use the multithread-specific and DLL-specific version of the run-time library (MD)

and then
open the output “Demo.sln” in “[root]/Samples/D3D9/Demo/proj.d3d9.cmake/build/proj_msvc2015_x64_md” in Visual Studio and execute build.

If the build is successful, let's run it through debugging.

If a large screen appears, you have succeeded.
* In the smallest sample, UI such as the background and the gear icon for switching models are not displayed.

 

To adjust the window size, please refer to “/Sample/OpenGL/Demo/proj.win.cmake/src/LAppDelegate.cpp”.
Change the values of the 4th and 5th arguments of SetRect() used in LAppDelegate::Initialize().

* Actual values for RenderTargetWidth and RenderTargetHeight are defined in “/Sample/OpenGL/Demo/proj.win.cmake/src/LAppDefine.cpp”.

 

Destination where the executable file will be output

This project created from CMake differs from a normal project in that
the output destination of the file will be under “bin” created in the same hierarchy as the project folder.

Specifically, when the project folder is “[root]/Samples/D3D9/Demo/proj.d3d9.cmake/build/proj_msvc2015_x64_md”,
the executable file will be output to “[root]/Samples/D3D9/Demo/proj.d3d9.cmake/build/proj_msvc2015_x64_md/bin/[Configurations]/”.

Example: “[root]/Samples/D3D9/Demo/proj.d3d9.cmake/build/proj_msvc2015_x64_md/bin/Release/

© 2010 - 2022 Live2D Inc.