Creating a project¶
You can create a Kanzi Studio project either using the Kanzi Studio Quick Start window or the File menu.
Creating a project using the Quick Start window¶
To create a project using the Quick Start window:
In Kanzi Studio in the Quick Start window, click New Project.
The Quick Start window is available when you open Kanzi Studio or close a project. If the Quick Start window is not visible, to open it, in the main menu select File > Show Quick Start.
In the New Project window, define where and what type of project you want to create by setting:
Name to the name that you want to use for your project.
Location to the directory where you want to create your project.
If you do not want Kanzi Studio to create a new directory for your project, deselect Create folder.
Set Template:
Application template creates a Kanzi Studio project with a Kanzi Engine application.
Application
directory contains the structure and template source code for the application of your project.Tool_project
directory contains the Kanzi Studio project.
Use this template to create a Kanzi application for which you can create application logic using the Kanzi Engine API. See Tutorial: Hello world!
Kanzi Studio project template creates only a Kanzi Studio project.
Use this template to create a Kanzi application without using the Kanzi Engine API.
See Combining Kanzi Studio projects into a Kanzi application.
Application with Kanzi Engine plugin template creates a Kanzi Studio project with a Kanzi Engine application that contains a Kanzi Engine plugin.
Application
directory contains the structure and template source code for the application of your project and for a Kanzi Engine plugin.Tool_project
directory contains the Kanzi Studio project.
Use Kanzi Engine plugins to extend functionality of Kanzi for your application. See Creating Kanzi Engine plugins.
Application with data source plugin template creates a project with a Kanzi Engine application that contains a data source plugin template.
Application
directory contains the structure and template source code for the application of your project and for a Kanzi Engine data source plugin.Tool_project
directory contains the Kanzi Studio project.
Use Kanzi Engine data source plugins to define data sources for your Kanzi application. See Tutorial: Get application data from a data source and Defining a data source.
Android application template creates a Kanzi Studio project with a Kanzi Android framework-based application.
Application
directory contains the structure and template source code for the application of your project.Application/configs/platforms/Android_gradle
directory contains the source code of the Android application project.Tool_project
directory contains the Kanzi Studio project.
Android application with Java plugin template creates a Kanzi Studio project with a Kanzi Android framework-based application that contains a Kanzi Engine Java plugin.
Application
directory contains the structure and template source code for the application of your project and for a Java plugin.Application/configs/platforms/Android_gradle
directory contains the source code of the Android application project.Tool_project
directory contains the Kanzi Studio project.
Use Kanzi Engine Java plugins to split your re-usable application logic.
When you use the Android application or Android application with Java plugin template, in the Android Package Name, set the name of the Android package for the project.
Select the Materials to set the starting template for your project:
To start with a template that does not contain any predefined material types, select Import material types manually. You can add material types from the Kanzi Studio material library to the project when you need them, or create your own material types. See Adding a material type to your project.
High performance vertex shaders template is intended for low precision and high performance OpenGL ES2 applications. It contains vertex-based shaders optimized for use with OpenGL ES2. Most of the GPU specific computation, including applying lights using the Phong reflection model, is done in the vertex shader. This is a good starting point for most devices.
High quality fragment shaders template is intended for high precision OpenGL ES2 applications. It contains pixel-shader based materials for use with OpenGL ES2. Most of the GPU specific computation, including applying lights using the Phong reflection model, is done in the fragment shader. This offers better image quality often at the cost of performance.
Physically based rendering template is intended for OpenGL ES3 applications. It contains materials based on shaders that implement physically-based rendering (PBR) principles. The properties of these materials represent physical properties, such as metalness, and are therefore intuitive to control. Most of the GPU specific computation, including applying lights using a physically-based lighting model, is done in the fragment shader. This offers a more realistic rendering result in many lighting conditions.
High performance vertex shaders, High quality fragment shaders, and Physically based rendering project templates define a set of material types that are available in the project materials library, each with fragment and vertex shaders. See Shaders.
If you are not sure which project template you should choose, select Import material types manually, and add the materials as you need them.
Click Create.
Kanzi Studio creates a project. You can see the structure of the project in the Kanzi Studio Node Tree and in the project directory that you set in Location in the New Project window.
After you create a project, you can import 2D and 3D content that you created outside of Kanzi Studio and start building your Kanzi application. See Tutorials.
You can configure your project in Kanzi Studio. See Configuring Kanzi Studio projects.
Developing the application logic in Visual Studio¶
When you create a project using the Application, Application with data source plugin, or Application with Kanzi Engine plugin template, Kanzi creates in the Application
directory the structure and template source code for the application of your project. To use Visual Studio to develop the application logic, you must generate a Visual Studio solution with CMake.
To develop the application logic in Visual Studio:
In Kanzi Studio create a project using one of these templates:
Application
Application with data source plugin
Application with Kanzi Engine plugin
Kanzi creates a Kanzi Studio project in the
<ProjectName>/Tool_project
directory and the structure for the application code of your project in the<ProjectName>/Application
directory:bin
directory contains the kzb and configuration files of your project.configs
directory contains the configuration files for different platforms. By default Kanzi creates configuration files for several different platforms. The recommended platform for developing Kanzi applications is Microsoft Visual Studio. See Deploying Kanzi applications.src
contains the source code for your application.CMakeLists.txt
file contains the instructions for CMake to generate the Visual Studio solution for the Kanzi application.generate_cmake_vs<Version>_solution.bat
is a script that you can use to generate a Visual Studio solution for the Kanzi application. The script generates the Visual Studio solution in the<ProjectName>/Application/build_vs<Version>
directory.
In Kanzi Studio, select File > Open Kanzi Command Prompt.
The Kanzi Command Prompt opens the Windows Command Prompt with the Kanzi environment variables set for the version of Kanzi for which you open a Kanzi Command Prompt.
Use the Kanzi Command Prompt to access Kanzi utilities and build tools, such as Gradle, SCons, and CMake, without using absolute paths or setting environment variables.
Tip
You can find the Kanzi Command Prompt in the Windows Start Menu in the Rightware directory.
When you have more than one version of Kanzi installed, make sure that you launch a Kanzi Command Prompt for the version of Kanzi with which you want to work in that command prompt.
In the Kanzi Command Prompt in the
<ProjectName>/Application
directory run the script that generates a Visual Studio solution for the application.For example, if you use Visual Studio 2019, run
generate_cmake_vs2019_solution.bat
This script generates a Visual Studio solution for the application in the directory
<ProjectName>/Application/build_vs2019
.In Visual Studio open the
<ProjectName>/Application/build_vs<Version>/<ProjectName>.sln
Visual Studio solution.For example, if you used the Application with data source plugin or Application with Kanzi Engine plugin template, the Visual Studio solution contains:
The project for the Kanzi Engine plugin named
<ProjectName>
. Define your Kanzi Engine plugin in this project.The project for the C++ application named <ProjectName>_executable. Define the logic of your Kanzi application in this project.
In Visual Studio create the logic for your Kanzi application and your Kanzi Engine plugin, and configure the custom components in your Kanzi Engine plugin for Kanzi Studio. See Application development, Creating Kanzi Engine plugins, Defining a data source, and Extending the functionality of Kanzi Engine.
When you add or remove files that your Kanzi application or Kanzi Engine plugin use, update in the
CMakeLists.txt
the list of files in theset
command and run thegenerate_cmake_vs<Version>_solution.bat
script:When you change the files that you use in your Kanzi application, update
<ProjectName>/Application/src/executable/CMakeLists.txt
When you change the files that you use in your Kanzi Engine plugin, update
<ProjectName>/Application/src/plugin/CMakeLists.txt
For example, to add the
tinyxml2.cpp
andtinyxml2.h
files to your Kanzi Engine plugin, update<ProjectName>/Application/src/plugin/CMakeLists.txt
to include these filesset(sources_plugin src/tinyxml2.cpp src/tinyxml2.h src/mykanziengineplugin.cpp src/mykanziengineplugin.hpp src/mykanziengineplugin.rc src/mykanziengineplugin_module.cpp src/mykanziengineplugin_module.hpp)
Select the solution configuration that you want to use.
During development select the Debug configuration. When you are ready to create a version for production, select the Release configuration.
Build your application:
To build only the Kanzi Engine plugin DLL, right-click the
<ProjectName>
project and select Build.To build the Kanzi Engine plugin DLL and your Kanzi application, right-click the <ProjectName>_executable project and select Build.
Visual Studio builds:
Plugin DLL in the
<ProjectName>/Application/lib/<PlatformName>/<ConfigurationName>
and the<ProjectName>/Application/build_vs<Version>/runtime/<ConfigurationName>
directoriesKanzi Studio uses the plugin DLL in the
<ProjectName>/Application/lib
directory.Application executable in the
<ProjectName>/Application/build_vs<Version>/runtime/<ConfigurationName>
directory.
Run your application:
In Kanzi Studio select File > Export > Export KZB.
Kanzi Studio exports the project kzb and configuration files to the
<ProjectName>/Application/bin
directory.Place these files to the same directory:
From the
<ProjectName>/Application/build_vs<Version>/runtime/<ConfigurationName>
the exe and DLL files.From the
<ProjectName>/Application/bin
directory copy the kzb and cfg files.From the
<KanziWorkspace>/Engine/lib/<PlatformName>/<ConfigurationName>
copy all DLL files.
For example, place these files to the
<ProjectName>/Application/bin
directory.Run your application by executing the exe file that Visual Studio built.
Tip
To build and run your application from Visual Studio:
In Kanzi Studio export the kzb file.
In Visual Studio right-click the <ProjectName>_executable and select Set as StartUp Project.
Select the solution configuration that you want to use and run the application.
See also¶
Configuring Kanzi Studio projects