以前从未见过这种技术,它是如何工作的? [英] Never seen this technique before, how does it work?

查看:60
本文介绍了以前从未见过这种技术,它是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ID \ Zenimax最近向公众发布的Doom3源代码,但遇到了一些似乎无法弄清的东西. (我不是最好的C ++程序员,我更喜欢C#.)

I''m working with the Doom3 source code that ID\Zenimax recently released to the public, and I came across something that I can''t seem to figure out. (I''m not the best C++ programmer, I''m more of C# kinda guy.)

/*
================
idTarget_EndLevel::Spawn
================
*/
void idTarget_EndLevel::Spawn( void ) {
	idStr		guiName;

	gui = NULL;
	noGui = spawnArgs.GetBool("noGui");
	if (!noGui) {
		spawnArgs.GetString( "guiName", "guis/EndLevel.gui", guiName );

		if (guiName.Length()) {
			gui = idUserInterface::FindGui( guiName, true, false, true );			
		}
	}

	buttonsReleased = false;
	readyToExit = false;

	exitCommand = "";
}



重要的一点是"idUnserInterface :: FindGui"函数调用,该函数在该类中不存在,该类也不从任何其他类继承该成员. ? (即idUserInterface,不包含该成员,并且似乎也没有继承该成员.但是,代码是正确的,并且可以编译.)

这是函数的定义方式,据我所知,这是最好的.



The important bit, is the "idUnserInterface::FindGui" function call, this function does not exist in that class, nor does that class inherit that member from any other class. ? (ie, idUserInterface, doesn''t contain that member, and it doesn''t seem to inherit it. But, the code is correct, and compiles.)

Here is how the function is being defined, the best I can tell.

class idUserInterfaceManagerLocal : public idUserInterfaceManager {
	friend class idUserInterfaceLocal;

public:
	virtual idUserInterface *	FindGui( const char *qpath, bool autoLoad = false, bool needInteractive = false, bool forceUnique = false );



此链接包含游戏完整源代码的参考,因此您可以轻松查找类,查看关系等,以帮助回答此问题.

https://dev.visucore.com/doom3/doxygen/index.html [ ^ ]

您也可以在此处下载完整的源代码.

https://github.com/TTimo/doom3.gpl [



This link contains a reference for the entire source code for the game, so you can easily look up the classes, view relations, etc, to help answer this question.

https://dev.visucore.com/doom3/doxygen/index.html[^]

You can also download the full source here.

https://github.com/TTimo/doom3.gpl[^]

(Just ask if you need any more info, I tried to keep it short, and relevant.)

-----

For the record, here is what I''m actually working on, I''m creating a new solution in VC++, and remaking the project by importing the original code, it originally consisted of several sub projects, which I''m condensing into a single project, since most of it''s not needed for my purposes. (ie, it had code for the expansion packs, an SDK, editors, etc,.)

It was going well until I hit this error.

game\EndLevel.cpp(58): error C3861: ''FindGui'': identifier not found



导致当前问题的原因是,我需要弄清楚这种技术的工作原理,名称并进行研究,以便可以在新的VC ++解决方案中正确实现原始源代码的这一部分. (希望这一切都说得通.)



Which lead to the current question, I need to figure out how this technique works, what it''s called, and research it, so I can properly implement this portion of the original source in my new VC++ solution. (Hope this all makes sense.)

推荐答案

我知道了,发生了什么事,是在项目迁移期间,我加载了一个旧文件,一定是是从较早的游戏版本开始的,所以是的,它不会构建,也不需要构建. (即,只是一个垃圾文件.)

对不起,我的错. :(

@Sergey Chepurin,是的,代码实际上有点吓人,它们做了很多事情,您确实不应该这样做,但是,我对Mac \ Linux支持所必需的内容的无知可能使我的判断蒙上阴影一点.

查看它们如何初始化主窗口以及如何加载OpenGL,这对我来说似乎很不对劲. (不过,就像我说的那样,也许是有希望的,这是因为它们支持GCC \ Linux \ Mac构建等.)

他们也做类似..(大致)

I figured it out, what happened, was during the project migration, I loaded up an old file, it must have been from a earlier game build, so yeah, that won''t build, and isn''t required to build. (ie, it was just a junk file.)

Sorry, my fault. :(

@Sergey Chepurin, yeah, the code is actually kind of scary, they do lot''s of stuff, you really shouldn''t be doing, though, my ignorance of whats necessary for Mac\Linux support, may be clouding my judgement a bit.

Check out how they initialize the main window, and how they load OpenGL, it seems very wrong to me. (Like I said though, perhaps, hopefully, it''s because they supported GCC\Linux\Mac builds, etc,.)

They also do stuff like.. (Roughly)

void SomeFunc();

void FreeTexture(tex in)
{

if (SomeFunc) // Yes, no brackets. And on a void func. ??
{
  // Unload Textures (I'm assuming it leaks memory, or there is another method that works somewhere.. ?)
    UnloadTex(in);
}
}


这篇关于以前从未见过这种技术,它是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆