- 전체
- C/C++ 일반
- C/C++ 수학
- C/C++ 그래픽
- C/C++ 자료구조
- C/C++ 인공지능
- C/C++ 인터넷
- wxWidget
- GTK+
- UNIX or LINUX programming
- 리눅스 마스터 - 국가공인자격
- VC++/ MFC
- C#/CLI/.NET
- QT/기타UI
- Boost lib
- 오픈소스 C 분석자료
- MSA (마이크로서비스), Docker, kubernetes
- WSL(windows subsystem linux)
C/C++ 일반 Kigs Framework Introduction (1/8)
2020.02.27 21:37
Kigs Framework Introduction (1/8)

Table of Contents
- Introduction
- Why Use the Kigs Framework?
- General Architecture
- Core Features
- Getting Started
- What's Next
- Already Published in this Series
- History
Introduction
Today, it is possible to develop 3D mobile applications, multi platform games ... quite simply thanks to commercial (Unreal, Unity ...) or open source (OpenSceneGraph, Ogre3D ...) 3D engines.
These engines obviously have all their advantages, but also their disadvantages:
- Some are not free.
- Some are black boxes and you only have access to exposed functionality.
- Some are very scene graph / rendering oriented and not really multi purpose.
We developed the Kigs framework because we wanted a lightweight, fast, scalable framework that we could port to different platforms (that's why we used C++, available on almost all platforms), and we could use as a base to build all our projects from Nintendo DSi games:

to industrial robots simulator (have a look here: https://kigs-framework.org/Projects). We also wanted to remain totally independent, and keep full control over all our projects code.
Kigs framework gives access to high level architecture and functionalities while maintaining low level control (optimizations, platform specific customization, easy C/C++ extern libraries usage ...).
We decided some weeks ago to open source (MIT licence) the main modules of our framework for Windows (x86, x64, for openGL and D3D, WUP D3D), and HTML5/Web Assembly (Emscripten) platforms. Here is the GitHub repository:
Why Use the Kigs Framework?
- You are a C++ developer and want to have access to high level functionality such as serialization, instance factory, signals / slots management, scenegraph / rendering, lua scripting ...
- You want to learn game development using C++ and lua scripting.
- You want to experiment with new ideas without starting from scratch.
- You are curious to see how we implemented this or that feature and perhaps want to help improve the framework.
We would be happy if others take over our framework, improve it and adapt it to their desires and their needs.
General Architecture
The Kigs framework is divided into different modules, each grouping functionalities in a particular domain (Input, Rendering, GUI...). There are two main module types: Generic and Specific.
Generic Modules
A generic module defines API/SDK/System independent classes, and/or base classes (interface) for API/SDK/System dependent classes.
Specific Modules
Of course, specific modules do the exact opposite: they define API/SDK/System dependent classes, often inheriting from generic classes.
Base Modules
The main modules are Core, FileManager, Timer, XML. Then Input (with specific InputWindows, InputWUP...), GUI (GuiWindows, GUIWUP...), SceneGraph, Renderer (RendererOpenGL3, RendererDirectX11)...
Core Features
Core features are mainly supported by KigsCore and CoreModifiable classes.
Instance Factory
Classes with CoreModifiable inheritance can be registered to instance factory. Ask KigsCore to create a new instance of the wanted class is then easy:
// Ask for an instance of class Timer called "localtimer"
CMSP localtimer = KigsCore::GetInstanceOf("localtimer", "Timer");
CoreModifiable Trees
CoreModifiable instances can be organized in parent/sons trees like this:
// add localtimer instance to this (this must inherit CoreModifiable too of course)
addItem(localtimer);
addItem adds a reference to the reference count of the instance. localtimer instance will be destroyed when its references count reach 0, so in our case when parent class is destroyed.
CoreModifiable should be initialized before use:
// init localtimer (timer is started)
localtimer->Init();
Then localtimer can then be retrieved in another part of the code with different kind of research functions:
// search son with given name
Timer* localtimer=GetFirstSonByName("Timer", "localtimer")->as<Timer>();
or:
// search first instance found with given name
CoreModifiable* localtimer = GetFirstInstanceByName("Timer", "localtimer");
All instances of a given type can also be retrieved in one call:
// search all instances of Timer
std::set<CoreModifiable*> alltimers;
GetInstances("Timer", alltimers);
CoreModifiable Attributes
CoreModifiable can have "compile time" attributes that can be get or set by their names:
// retrieve "Sample1Value" value on this
int _value;
testInstance->getValue("Sample1Value", _value);
_value = 4 * _value - 12;
// change "Sample1Value" value with _value
testInstance->setValue("Sample1Value", _value);
Attributes can also be added or removed at runtime:
// add a dynamic attribute on instance of localtimer
localtimer->AddDynamicAttribute(ATTRIBUTE_TYPE::FLOAT, "floatValue", 12.0f);
// retrieve dynamic attribute value on localtimer
float timervalue=localtimer->getValue<float>("floatValue");
// set dynamic float attribute with string
localtimer->setValue("floatValue","24");
Serialization
CoreModifiable trees with all their attributes can be exported in XML files:
// export this and its sons in "Sample1.xml" file
CoreModifiable::Export("Sample1.xml", this, true);
And of course, import CoreModifiable trees from an XML file is also possible:
// import instances from file "Sample1.xml"
CMSP imported=CoreModifiable::Import("Sample1.xml");
CoreModifiable Methods
Methods can be added to CoreModifiable and then accessed at runtime only by their names (without knowing the exact type of the instance the method is called on).
The easy way to call such a method is:
// call SimpleSampleClass AddValue method directly on CoreModifiable
float result = simpleclass->SimpleCall<float>("AddValue", 10, 12.0f);
printf("result of calling AddValue = %f\n", result);
Find all the sample code from this introduction in the "Sample1" project on GitHub (browse the code).
Getting Started
Prerequisites
We will focus on the main development platform we have used: Windows.
Our scripts need Visual Studio C++ 2019 (Community edition is OK).
A recent version of CMake (3.15.5 is setup in our case).
Creating a New Project
After cloning the repository, go to the kigs\projects folder.
Launch one of the two present scripts: CreateNewConsoleProject.vbs (for a command line type project) or CreateNewDDProject.vbs (for a graphical data driven project).
Enter a name for the project: a new folder with this name will be created. For example "SimpleTest" and press OK.
Now open "kigs\projects\CMakeLists.txt" file in a text editor and add the line:
add_subdirectory(MyProjectName)
replacing "MyProjectName" by the name of the project (SimpleTest in our example).
Save and close "CMakeLists.txt" file.
Then go to kigs\scripts folder and launch one of the following scripts:
- generateWinCMake.bat for a win32 (opengl) application
- generateWinCMake64.bat for a win64 (opengl) application
- generateWinD3DCMake.bat for a win32 (D3D) application
- generateWinD3DCMake64.bat for a win64 (D3D) application
- generateWUPD3DCMake.bat for a Universal Windows Platform D3D application (only for graphical data driven project)
A new Build\[solutionType] folder is created at the same level as kigs folder.
Build and Run the New Project
Browse in this folder to reach Build\[solutionType]\kigs\projects\"MyProjectName" and choose "MyProjectName".sln to open it in Visual Studio.
Once the solution is loaded in Visual Studio, set "MyProjectName" as your startup project, choose the build configuration you want: StaticDebug (for a compilation with full debug info), StaticReleaseTools (for a compilation with optimization, but keeping all the export functionalities), StaticRelease (for full optimization but no export functionality).
Build, launch. That's it!
What's Next
In the next articles of this series, we will explore the advanced features of the framework:
- CoreModifiable class details
CoreModifiableattributesCoreModifiablemethodsCoreItem- Signal / slot / notification
- Lua binding
- Data driven application
- ...
Already Published in this Series
- Kigs Framework Introduction (1/8) - Overview
- Kigs Framework Introduction (2/8) - CoreModifiable
- Kigs Framework Introduction (3/8) - Attributes
- Kigs Framework Introduction (4/8) - Methods
- Kigs Framework Introduction (5/8) - CoreItem
History
- 24th January, 2020: Initial version
- 29th January, 2020: Added Table of Contents
- 1st February, 2020: Added Already Published in this Series
- 7th February, 2020: Article (3/8) added to the series
- 8th February, 2020: Added screenshot from Rollway Puzzle and fixed link to Projects page
- 14th February, 2020: Article (4/8) added to the series
- 21st February, 2020: Article (5/8) added to the series and small bug fix in code
License
This article, along with any associated source code and files, is licensed under The MIT License
[출처] https://www.codeproject.com/Articles/5253209/Kigs-Framework-Introduction-1-8
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.



