本文整理汇总了C++中gd::Project::GetLayoutPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Project::GetLayoutPosition方法的具体用法?C++ Project::GetLayoutPosition怎么用?C++ Project::GetLayoutPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::Project
的用法示例。
在下文中一共展示了Project::GetLayoutPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateExternalEventsCompleteCode
gd::String EventsCodeGenerator::GenerateExternalEventsCompleteCode(gd::Project & project, gd::ExternalEvents & events, bool compilationForRuntime)
{
DependenciesAnalyzer analyzer(project, events);
gd::String associatedSceneName = analyzer.ExternalEventsCanBeCompiledForAScene();
if ( associatedSceneName.empty() || !project.HasLayoutNamed(associatedSceneName) )
{
std::cout << "ERROR: Cannot generate code for an external event: No unique associated scene." << std::endl;
return "";
}
gd::Layout & associatedScene = project.GetLayout(project.GetLayoutPosition(associatedSceneName));
gd::String output;
//Prepare the global context ( Used to get needed header files )
gd::EventsCodeGenerationContext context;
EventsCodeGenerator codeGenerator(project, associatedScene);
codeGenerator.PreprocessEventList(events.GetEvents());
codeGenerator.SetGenerateCodeForRuntime(compilationForRuntime);
//Generate whole events code
gd::String wholeEventsCode = codeGenerator.GenerateEventsListCode(events.GetEvents(), context);
//Generate default code around events:
//Includes
output += "#include <vector>\n#include <map>\n#include <string>\n#include <algorithm>\n#include <SFML/System/Clock.hpp>\n#include <SFML/System/Vector2.hpp>\n#include <SFML/Graphics/Color.hpp>\n#include \"GDCpp/RuntimeContext.h\"\n#include \"GDCpp/RuntimeObject.h\"\n";
for ( set<gd::String>::iterator include = codeGenerator.GetIncludeFiles().begin() ; include != codeGenerator.GetIncludeFiles().end(); ++include )
output += "#include \""+*include+"\"\n";
//Extra declarations needed by events
for ( set<gd::String>::iterator declaration = codeGenerator.GetCustomGlobalDeclaration().begin() ; declaration != codeGenerator.GetCustomGlobalDeclaration().end(); ++declaration )
output += *declaration+"\n";
output +=
codeGenerator.GetCustomCodeOutsideMain()+
"\n"
"void "+EventsCodeNameMangler::Get()->GetExternalEventsFunctionMangledName(events.GetName())+"(RuntimeContext * runtimeContext)\n"
"{\n"
+codeGenerator.GetCustomCodeInMain()
+wholeEventsCode+
"return;\n"
"}\n";
return output;
}