Comments (4)
Namespaces
I'll take a look at fixing this at some point, but for now there is a workaround:
// in a .cpp file:
using namespace K;
REGISTERCLASS(Component);
Constructing
You cannot construct RuntimeCompiledCPlusPlus objects using new
this way.
To construct an IObject
derived class you need to use the constructor:
IObject* pObj = 0;
IObjectConstructor* pConstructor =
PerModuleInterface::g_pRuntimeObjectSystem->GetObjectFactorySystem()->GetConstructor( "Sprite" ); // name is not namepaced due to above issue
pObj = pConstructor->Construct();
K::Sprite* pSprite = 0;
pObj->GetInterface( &pSprite );
See the ConsoleExample.cpp for a simple example.
You can make the above into a template class. There are also ways to make it a static member of the interface for the class. If you want to improve the performance of construction by storing the constructor for each type then remember you will need to reacquire them when the Runtime Compiler runs, again see the ConsoleExample and the OnConstructorsAdded
callback.
A proposal which would be a larger change to your codebase is to consider using an Entity Component System approach where each entity is just an identifier value, and the components are singletons which own an array of their children indexed by the entity identifier. Components usually have a map of entityids to components in some way so the array of components is not the size of all entities for all components.
There is a relatively short overview of this technique in the following posts:
Building a Data-Oriented Entity System (part 1)
Building a Data-Oriented Entity System (part 2)
This is very similar to what I use in Avoyd.
Note that it is better to submit each issue separately on Github rather than together like this as then it will be easier to track resolution of them.
from runtimecompiledcplusplus.
@dougbinks I'm getting this error now instead, any idea why it's happening?
from runtimecompiledcplusplus.
It looks like the constructor for "Sprite" was not registered.
You can use the following code after initializing RCC++ to check which constructors you have registered:
AUDynArray<IObjectConstructor*> constructors;
PerModuleInteraface::g_pRuntimeObjectSystem->GetObjectFactorySystem()->GetAll( constructors );
for(int i = 0; i < constructors.Size(); ++i )
{
PerModuleInteraface::g_pRuntimeObjectSystem->GetLogger()->LogInfo("Constructor %d: Name: %s\n", i, constructors[i]->GetName() );
}
Alternatively you can put a breakpoint in ObjectFactorySystem::AddConstructors
in ObjectFactorySystem.cpp
line 248 or so and check what the constructors being assigned are.
from runtimecompiledcplusplus.
cool, thank you this helped alot :)
from runtimecompiledcplusplus.
Related Issues (20)
- Webpage moved HOT 1
- Crash in ObjectFactorySystem.cpp line 250 when no RCC++ objects and no logger
- Visual Studio 2019 debug info issue after first recompile
- Question: Use Case: Self-optimization HOT 6
- Remove need for hierarchy of classes with virtual functions in RuntimeTracking
- RUNTIME_COMPILER_SOURCEDEPENDENCY off-by-1 error HOT 2
- Improve FindFile handling of relative file paths
- Stack Cookie Check Failure error HOT 1
- Dynamic loading of generated code without writing to files HOT 2
- Linking compile output back into project HOT 3
- Getting Log: ObjectFactorySystem::AddConstructors() called with no constructors HOT 3
- Question: Modifiable class macro discovery within static libs HOT 8
- Simplify RuntimeCompiledCPlusPlus by loading .dll's in RAM HOT 1
- Games HOT 1
- Runtime Linker issues HOT 7
- Runtime Compiled C++ Linker Errors HOT 2
- _kbhit on the linux HOT 1
- Code or executable in directories with non-ascii characters breaks RCC++
- Compiling many files on Windows may exceed maximum line length of compile command line
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from runtimecompiledcplusplus.